Compare commits
2 commits
2294ce5351
...
45e760fcac
| Author | SHA1 | Date | |
|---|---|---|---|
| 45e760fcac | |||
| a93f449d76 |
2 changed files with 13 additions and 1 deletions
|
|
@ -5,7 +5,7 @@ public class Visitor {
|
||||||
private FeeCalculationStrategy feeCalculationStrategy;
|
private FeeCalculationStrategy feeCalculationStrategy;
|
||||||
|
|
||||||
public Visitor (int age) {
|
public Visitor (int age) {
|
||||||
if (age < 14) {
|
if (age <= 14) {
|
||||||
feeCalculationStrategy = new FeeCalculationStartegyForChildren();
|
feeCalculationStrategy = new FeeCalculationStartegyForChildren();
|
||||||
} else {
|
} else {
|
||||||
feeCalculationStrategy = new FeeCalculationStrategyForAdults();
|
feeCalculationStrategy = new FeeCalculationStrategyForAdults();
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,18 @@ class FeeCalculatorTest {
|
||||||
assertThat(actualFee).isEqualTo(50.0);
|
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
|
@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
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue