Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
package org.fundacionjala.coding.norman.movies;

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

/**
* Created by NORMAN on 2/7/2017.
*/
public class NewReleaseTest {
private Movie newReleaseInstance;

/**
* create NewRelease movie.
*/
@Before
public void before() {
newReleaseInstance = new NewRelease("Test");
}


/**
* Test to verify the amount if the rented days
Expand All @@ -16,14 +28,14 @@ public class NewReleaseTest {
@Test
public void testCalculateAmountWhenTheRentedDaysIsLessThanThree() {
// given:
NewRelease newReleaseInstance = new NewRelease("Test");

// when:
final double actualResult = newReleaseInstance.calculateAmount(1);

// then
final double expectedResult = 3;
assertEquals(0, expectedResult, actualResult);
assertTrue(expectedResult - actualResult == 0);

}

/**
Expand All @@ -33,14 +45,13 @@ public void testCalculateAmountWhenTheRentedDaysIsLessThanThree() {
@Test
public void testCalculateAmountWhenTheRentedDaysIsGreaterThanThree() {
// given:
NewRelease newReleaseInstance = new NewRelease("Test");

// when:
final double actualResult = newReleaseInstance.calculateAmount(10);

// then:
final double expectedResult = 30;
assertEquals(0, expectedResult, actualResult);
assertTrue(expectedResult - actualResult == 0);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you should use an assertEquals

}

/**
Expand All @@ -50,7 +61,6 @@ public void testCalculateAmountWhenTheRentedDaysIsGreaterThanThree() {
@Test
public void testCalculateFrequentRenterPointsVerifyTheResultIsOne() {
// given:
NewRelease newReleaseInstance = new NewRelease("Test");

// when:
final int actualResultOne = newReleaseInstance.calculateFrequentRenterPoints(1);
Expand Down