Ajout de test pour ticket invalide
This commit is contained in:
parent
df205faea0
commit
c5067ca768
1 changed files with 28 additions and 8 deletions
|
|
@ -7,8 +7,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
class FeeCalculatorTest {
|
class FeeCalculatorTest {
|
||||||
@Test
|
@Test
|
||||||
public void for_age_under_14_HALF_DAY_should_calculate_20()
|
public void for_age_under_14_HALF_DAY_should_calculate_20() {
|
||||||
{
|
|
||||||
//GIVEN
|
//GIVEN
|
||||||
Visitor child = new Visitor(10);
|
Visitor child = new Visitor(10);
|
||||||
|
|
||||||
|
|
@ -20,8 +19,7 @@ class FeeCalculatorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void for_age_under_14_FULL_DAY_should_calculate_50()
|
public void for_age_under_14_FULL_DAY_should_calculate_50() {
|
||||||
{
|
|
||||||
//GIVEN
|
//GIVEN
|
||||||
Visitor child = new Visitor(10);
|
Visitor child = new Visitor(10);
|
||||||
|
|
||||||
|
|
@ -33,8 +31,7 @@ class FeeCalculatorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void for_age_above_14_HALF_DAY_should_calculate_60()
|
public void for_age_above_14_HALF_DAY_should_calculate_60() {
|
||||||
{
|
|
||||||
//GIVEN
|
//GIVEN
|
||||||
Visitor adult = new Visitor(20);
|
Visitor adult = new Visitor(20);
|
||||||
|
|
||||||
|
|
@ -46,8 +43,7 @@ class FeeCalculatorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void for_age_above_14_FULL_DAY_should_calculate_120()
|
public void for_age_above_14_FULL_DAY_should_calculate_120() {
|
||||||
{
|
|
||||||
//GIVEN
|
//GIVEN
|
||||||
Visitor adult = new Visitor(20);
|
Visitor adult = new Visitor(20);
|
||||||
|
|
||||||
|
|
@ -57,4 +53,28 @@ class FeeCalculatorTest {
|
||||||
//THEN
|
//THEN
|
||||||
assertThat(actualFee).isEqualTo(120.0);
|
assertThat(actualFee).isEqualTo(120.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void for_age_under_14_invalid_ticket_should_throw_error() {
|
||||||
|
//GIVEN
|
||||||
|
Visitor child = new Visitor(10);
|
||||||
|
|
||||||
|
//WHEN
|
||||||
|
assertThrows(
|
||||||
|
IllegalArgumentException.class,
|
||||||
|
() -> FeeCalculator.calculateFee(child, TicketType.WEEK)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void for_age_above_14_invalid_ticket_should_throw_error() {
|
||||||
|
//GIVEN
|
||||||
|
Visitor child = new Visitor(20);
|
||||||
|
|
||||||
|
//WHEN
|
||||||
|
assertThrows(
|
||||||
|
IllegalArgumentException.class,
|
||||||
|
() -> FeeCalculator.calculateFee(child, TicketType.WEEK)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Reference in a new issue