Compare commits

..

2 commits

2 changed files with 13 additions and 1 deletions

View file

@ -5,7 +5,7 @@ public class Visitor {
private FeeCalculationStrategy feeCalculationStrategy;
public Visitor (int age) {
if (age < 14) {
if (age <= 14) {
feeCalculationStrategy = new FeeCalculationStartegyForChildren();
} else {
feeCalculationStrategy = new FeeCalculationStrategyForAdults();

View file

@ -30,6 +30,18 @@ class FeeCalculatorTest {
assertThat(actualFee).isEqualTo(50.0);
}
@Test
public void for_age_exactly_14_should_be_child() {
//GIVEN
Visitor child = new Visitor(14);
//WHEN
double actualFee = FeeCalculator.calculateFee(child, TicketType.FULL_DAY);
//THEN
assertThat(actualFee).isEqualTo(50.0);
}
@Test
public void for_age_above_14_HALF_DAY_should_calculate_60() {
//GIVEN