-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test for ShieldDbBuilder, refactoring extract method for nesting shield #10
test for ShieldDbBuilder, refactoring extract method for nesting shield #10
Conversation
Hi, |
shielddb-core/src/main/java/nf/fr/k49/shielddb/core/ShieldDBBuilder.java
Show resolved
Hide resolved
private void doNestShields() { | ||
Iterator<ShieldDBShield<T>> shieldIterator = shields.iterator(); | ||
|
||
ShieldDBShield<T> bindTo = shieldIterator.next(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think "previousShield" could be a better name for the bindTo variable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be. In similar topics I like using "outer" and "inner".
I'll change it
shielddb-core/src/test/java/nf/fr/k49/shielddb/core/ShieldDBBuilderTest.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
|
||
private static class MockDBShield implements ShieldDBShield<String> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can implements PassThroughShield (https://github.com/kuroidoruido/ShieldDB/blob/master/shielddb-core/src/main/java/nf/fr/k49/shielddb/core/shield/PassThroughShield.java) instead of ShieldDBShield. This way you can avoid implementing a lot of methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aaah, I don't get the complete survey of all classes ;)
My additional plan is using a really mock (e.g. via mockito) so that a test can check calling some methods like setNextShield etc. Would this a better way? If so, I change the test by using the mock. Alternatively I can use the PassThroughShield. Give me a hint ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem. I notice you for that reason 😉
If you add Mockito and add some tests about binding, yeah no problem to add Mockito. I think we will use it one day, so adding it now or in the future it's the same thing for me 🙂
using outer and innter names placed static imports used Mockito for check proper builder-behavior
Hi, |
shielddb-core/src/main/java/nf/fr/k49/shielddb/core/ShieldDBBuilder.java
Show resolved
Hide resolved
shielddb-core/src/test/java/nf/fr/k49/shielddb/core/ShieldDBBuilderTest.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
|
||
private static class MockDBShield implements ShieldDBShield<String> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem. I notice you for that reason 😉
If you add Mockito and add some tests about binding, yeah no problem to add Mockito. I think we will use it one day, so adding it now or in the future it's the same thing for me 🙂
No description provided.