-
Notifications
You must be signed in to change notification settings - Fork 10
Feature/all katas #19
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?
Conversation
*/ | ||
public final class BankOCR { | ||
|
||
private static Map<Integer, String> mapNum = new HashMap<>(); |
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.
this should be final
final int finalFactor = 10; | ||
final int aux = 48; | ||
for (int i = 0; i < finalNumber; i++) { | ||
if (i % 2 != 0) { |
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.
Instead of using an if else
Consider using a ternary condition.
public int evaporator(final double content, final int evap, final int threshold) { | ||
int days = 0; | ||
double waste1; | ||
double limit1 = content * threshold / 100.00; |
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 variable?
double limit1 = content * threshold / 100.00; | ||
double conte = content; | ||
while (conte >= limit1) { | ||
waste1 = conte * evap / 100.00; |
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 variable?
* @param sentence is the word or words | ||
* @return the word spined. | ||
*/ | ||
public static String spinWords(final String sentence) { |
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.
A lot of code. :(
Try to refactor it
public void testNewRealeasenMovieAmount() { | ||
|
||
// given: | ||
final NewRelease newRelease = new NewRelease("Logan"); |
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.
this should be
final Movie newRelease = new NewRelease("Logan");
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.
Apply in all your unit tests
coding.iml
Outdated
@@ -0,0 +1,12 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> |
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 unnecessary file
Coverage 80%
Codecov Report
@@ Coverage Diff @@
## develop #19 +/- ##
============================================
+ Coverage 94.78% 95.09% +0.3%
- Complexity 138 210 +72
============================================
Files 26 39 +13
Lines 307 469 +162
Branches 50 73 +23
============================================
+ Hits 291 446 +155
- Misses 5 6 +1
- Partials 11 17 +6
Continue to review full report at Codecov.
|
Coverage 90%
if (i % 2 != 0) { | ||
sum += ((eanCode.charAt(i) - aux) * multiply); | ||
} else { | ||
sum += (eanCode.charAt(i) - aux); |
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 use a ternary condition here
* @param sentence is the word or words | ||
* @return the word spined. | ||
*/ | ||
public static String spinWords(final String sentence) { |
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.
please refactor this code
* Created by Administrator on 6/28/2017. | ||
*/ | ||
public class EvaporatorTest { | ||
private Evaporator evaporator = new Evaporator(); |
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.
this is a bad practice
* Created by Administrator on 6/28/2017. | ||
*/ | ||
public class HightesAndLowestTest { | ||
private HightesAndLowest hightesAndLowest = new HightesAndLowest(); |
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.
this is a bad practice
/** | ||
* Created by Juan Pablo on 26/03/2017. | ||
*/ | ||
public final class BankOCR { |
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.
This solution is not completed
|
||
for (Rental rental : rentalsCustomer) { | ||
|
||
result += String.format("%s ", rental.getMovie().getTitle()); |
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 sentence is the word or words | ||
* @return the word reversed. | ||
*/ | ||
public static String spinWords(final String sentence) { |
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 improve this method.
String account = "021453789"; | ||
|
||
// when: | ||
String expectedResult = "ERR"; |
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[] accountArray = BankOCR.parseScannedFigures(figureScanned); | ||
|
||
// when: | ||
String actualResult = BankOCR.accountRepresentation(accountArray); |
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
* Testing an invalid account. | ||
*/ | ||
@Test | ||
public void verifyValidateAccountNumbersFalse() { |
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
all your unit tests should start with the prefix test not verify
* Initialize variables. | ||
*/ | ||
@Before | ||
public void initialize() { |
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
Consider using setUp instead of initialize
* Created by Administrator on 6/28/2017. | ||
*/ | ||
public class MultiplesOf3And5Test { | ||
private MultiplesOf3And5 kata = new MultiplesOf3And5(); |
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?
int checkSum = 0; | ||
int digit = 0; | ||
for (int i = 0; i < code.length; i++) { | ||
digit = (code[i]); |
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 unnecessary parenthesis
int digit = 0; | ||
for (int i = 0; i < code.length; i++) { | ||
digit = (code[i]); | ||
checkSum += ((i + 1) % 2 == 0) ? digit * 3 : digit; |
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 unnecessary parenthesis
double cont = content; | ||
double limit1 = content * threshold / 100.00; | ||
while (cont >= limit1) { | ||
cont = cont - cont * evap / 100.00; |
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.
please refactor this line of code
public NewRelease(final String title) { | ||
super(title); | ||
} | ||
|
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.
{@inherentDoc}
|
||
@Override | ||
public int calculateFrequentRenterPoints(final int daysRented) { | ||
return 1; |
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.
use a constant
" _ _ _ _ _ _ _ " | ||
+ " ||_||_||_||_| _"; | ||
// when: | ||
final Boolean actualResult = BankOCR.validateAccountNumbers(figureScanned); |
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 are using the Boolean class?
you should use the primitive boolean
* Created by Administrator on 7/2/2017. | ||
*/ | ||
public class RentalTest { | ||
private Regular regular; |
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.
What is wrong here?
* @param account account. | ||
* @return true or false. | ||
*/ | ||
static boolean isLegible(final String account) { |
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
Mine