Skip to content

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

Open
wants to merge 28 commits into
base: develop
Choose a base branch
from
Open

Conversation

NandoOU
Copy link

@NandoOU NandoOU commented Jul 4, 2017

Coding Exercises

@codecov-io
Copy link

codecov-io commented Jul 4, 2017

Codecov Report

Merging #25 into develop will increase coverage by 0.4%.
The diff coverage is 96.02%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ Complexity Δ
...ndacionjala/coding/Fernando/movies/NewRelease.java 100% <100%> (ø) 4 <4> (?)
...g/fundacionjala/coding/Fernando/movies/Rental.java 100% <100%> (ø) 5 <5> (?)
...rg/fundacionjala/coding/Fernando/movies/Movie.java 100% <100%> (ø) 2 <2> (?)
...ionjala/coding/Fernando/evaporator/Evaporator.java 100% <100%> (ø) 3 <3> (?)
...acionjala/coding/Fernando/multiples/Multiples.java 100% <100%> (ø) 5 <5> (?)
...a/coding/Fernando/haghestandlowest/HighAndLow.java 100% <100%> (ø) 5 <5> (?)
...fundacionjala/coding/Fernando/movies/Children.java 100% <100%> (ø) 4 <4> (?)
...fundacionjala/coding/Fernando/movies/Customer.java 100% <100%> (ø) 8 <8> (?)
...acionjala/coding/Fernando/StringInv/StringInv.java 100% <100%> (ø) 4 <4> (?)
.../fundacionjala/coding/Fernando/movies/Regular.java 100% <100%> (ø) 4 <4> (?)
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 112c303...8461702. Read the comment docs.

boolean actualResult = BankOCR.validAccountNumbers(value);

// then:
assertTrue(!actualResult);
Copy link
Contributor

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();
Copy link
Contributor

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);
Copy link
Contributor

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();
Copy link
Contributor

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();
Copy link
Contributor

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");
Copy link
Contributor

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

@carledriss
Copy link
Contributor

@NandoOU
Please update your branch against develop

*/
public final class StringInv {

static final int CANT_MAJOR = 5;
Copy link
Contributor

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 = "";
Copy link
Contributor

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;
Copy link
Contributor

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();
Copy link
Contributor

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");
Copy link
Contributor

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;
Copy link
Contributor

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);
Copy link
Contributor

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";
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

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;
Copy link
Contributor

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;
Copy link
Contributor

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.
*/
Copy link
Contributor

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;
Copy link
Contributor

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.
*/
Copy link
Contributor

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.
*/
Copy link
Contributor

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.
*/
Copy link
Contributor

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;
Copy link
Contributor

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;
Copy link
Contributor

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 = {
Copy link
Contributor

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);
Copy link
Contributor

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is wrong here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants