-
Notifications
You must be signed in to change notification settings - Fork 10
Exercises completed #25
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
Codecov Report
@@ Coverage Diff @@
## develop #25 +/- ##
============================================
+ Coverage 94.78% 95.19% +0.4%
- Complexity 138 207 +69
============================================
Files 26 39 +13
Lines 307 458 +151
Branches 50 75 +25
============================================
+ Hits 291 436 +145
- Misses 5 6 +1
- Partials 11 16 +5
Continue to review full report at Codecov.
|
boolean actualResult = BankOCR.validAccountNumbers(value); | ||
|
||
// 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
*/ | ||
@Test | ||
public void testWhenSentenceIsEmpty() { | ||
CadInv cadI = new CadInv(); |
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.
@before method
|
||
// then | ||
final boolean expectedResult = true; | ||
assertEquals(actualResult, expectedResult); |
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.
assertTrue
*/ | ||
@Test | ||
public void testWhenSentenceISEmpty() { | ||
CheckSum cs = new CheckSum(); |
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.
@before method
*/ | ||
@Test | ||
public void testPromWhenHave5Elements() { | ||
Prom p = new Prom(); |
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.
@before method
@Test | ||
public void testCalculateAmountWhenTheRentedDaysIsLessThanThree() { | ||
// given: | ||
Children childrenInstance = new Children("Toy Story"); |
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.
Movie childrenInstance = new Children("Toy Story");
@before method
@NandoOU |
*/ | ||
public final class StringInv { | ||
|
||
static final int CANT_MAJOR = 5; |
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.
CANT_MAJOR ?
* @return String to get the all numbers. | ||
*/ | ||
public static String parseDigit(final String[] cad) { | ||
String res = ""; |
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?
*/ | ||
@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 for that
* @return the string. | ||
*/ | ||
public String generateDetail() { | ||
StringBuffer result = new StringBuffer(); |
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.
Consider using a StringBuilder
StringBuffer result = new StringBuffer(); | ||
result.append("Rental Record for " + getName() + "\n"); | ||
for (Rental rental : rentalsCustomer) { | ||
result.append("\t" + rental.getMovie().getTitle() + "\t"); |
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.
Don't concatenate strings using +
Consider using a String format
*/ | ||
public class AverageTest { | ||
|
||
private Average p; |
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 does mean p ?
}; | ||
|
||
// when: | ||
String actualResult = BankOCR.parseDigit(data); |
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
String actualResult = BankOCR.parseDigit(data); | ||
|
||
// 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.
same as above
|
||
// then | ||
final boolean expectedResult = true; | ||
assertEquals(actualResult, expectedResult); |
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.
assertTrue
|
||
// then | ||
final boolean expectedResult = false; | ||
assertEquals(actualResult, expectedResult); |
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 the actualResult
|
||
// then: | ||
final double expectedResult = 10.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.
Same as above
* @return boolean valor if is valid account number. | ||
*/ | ||
public static boolean validAccountNumbers(final String input) { | ||
int suma = 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.
typo
suma?
*/ | ||
public class NewRelease extends Movie { | ||
|
||
private static final int LIMITNEWCHILD = 3; |
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.
LIMITNEWCHILD ?
/** | ||
* @param daysRented param. | ||
* @return double value. | ||
*/ |
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}
|
||
private static final double PRICE = 1.5; | ||
|
||
private static final int LIMITREGULAR = 2; |
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.
LIMITREGULAR ?
/** | ||
* @param daysRented param. | ||
* @return Children value. | ||
*/ |
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}
/** | ||
* @param daysRented param. | ||
* @return double value. | ||
*/ |
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}
/** | ||
* @param daysRented param. | ||
* @return int value. | ||
*/ |
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
import java.lang.reflect.Constructor; | ||
import java.lang.reflect.Modifier; | ||
|
||
import static junit.framework.TestCase.assertTrue; |
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.
import static org.junit.Assert.assertTrue; ?
@Test | ||
public void testToGetNumber() { | ||
// given: | ||
String[] data = { |
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 data = "021453789"; | ||
|
||
// when: | ||
String actualResult = BankOCR.accountStatus(data); |
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
|
||
// 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.
what is wrong here?
Coding Exercises