-
Notifications
You must be signed in to change notification settings - Fork 10
all katas #28
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
base: develop
Are you sure you want to change the base?
all katas #28
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #28 +/- ##
=============================================
+ Coverage 94.78% 95.01% +0.22%
- Complexity 138 210 +72
=============================================
Files 26 40 +14
Lines 307 461 +154
Branches 50 70 +20
=============================================
+ Hits 291 438 +147
- Misses 5 9 +4
- Partials 11 14 +3
Continue to review full report at Codecov.
|
* @param numberAccount image of type String. | ||
* @return <code>true</code> \\ <code>false</code> | ||
*/ | ||
private static boolean size(final String numberAccount) { |
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.
refactor this method
it can be implemented in a single line of code
* @param numberAccount image of type String. | ||
* @return <code>true</code> \\ <code>false</code> | ||
*/ | ||
private static boolean size(final String numberAccount) { |
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.
why this method is called size ?
* @param scannedAccount of String type. | ||
* @return true. | ||
*/ | ||
private static boolean sizeImageIsValid(final String scannedAccount) { |
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 we need this method?
* @return true if the checksum is ok. | ||
*/ | ||
|
||
public static boolean validate(final String eAN) { |
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.
refactor this code
avoid the else condition
* @param stringNumber number | ||
* @return true if stringNumber length is exactly 13. | ||
*/ | ||
public static boolean checkCorrectLength(final String stringNumber) { |
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 we need this method?
/** | ||
* Created by administrator on 3/10/2017. | ||
*/ | ||
public final class Main { |
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.
Remove this class since you will add unit tests
}; | ||
|
||
// when: | ||
String actualResult = BankOcr.numberAccountPresentImage(scannedImage); |
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.
final
String actualResult = BankOcr.numberAccountPresentImage(scannedImage); | ||
|
||
// then: | ||
String expectedResult = "0123456789"; |
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.
final
boolean actualResult = BankOcr.validateNumberAccount(incorrectAccount); | ||
|
||
// then: | ||
assertTrue(!actualResult); |
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.
assertFalse
final boolean actualResult = EANValidator.checkCorrectLength(eanStringNumber); | ||
|
||
// then: | ||
assertTrue(!actualResult); |
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.
assertFalse
final boolean actualResult = EANValidator.validate(eanStringNumber); | ||
|
||
// then: | ||
assertTrue(!actualResult); |
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.
assertFalse
|
||
// then | ||
final double expectedResult = 1.5; | ||
assertEquals(0, expectedResult, actualResult); |
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.
first argument should be expectedResult and the second argument should be actualResult
@Test | ||
public void testRentalEmpty() { | ||
// given: | ||
Customer customer = new Customer("Test"); |
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 are repeating this code in all your test
Consider put it in a @before method
/** | ||
* Created by Administrator on 7/5/2017. | ||
*/ | ||
public class MainTest { |
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 we need this test class?
/** | ||
* Created by Administrator on 7/5/2017. | ||
*/ | ||
public class MovieTest { |
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.
@AT-03/at-03
Do we need this unit tests?
@Test | ||
public void testCalculateAmountWhenTheRentedDaysIsLessThanThree() { | ||
// given: | ||
NewRelease newReleaseInstance = new NewRelease("Test"); |
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.
@AT-03/at-03
what is wrong here?
*/ | ||
public class RentalTest { | ||
|
||
private Movie movie = new Movie("test") { |
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.
@AT-03/at-03
what is wrong here?
* @param numberAccount image of type String. | ||
* @return <code>true</code> \\ <code>false</code> | ||
*/ | ||
private static boolean isCorrectLength(final String numberAccount) { |
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 still refactor this
all katas of the coding.