Skip to content

Commit ae76289

Browse files
committed
Step 2: still fake it
1 parent 8e12abb commit ae76289

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

exercises/tiered_pricing/solutions/mperezi/src/main/java/tv/codely/checkout/TieredPricing.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
public class TieredPricing {
44
public double totalPrice(int i) {
5-
return 299.0;
5+
if (i == 1) {
6+
return 299.0;
7+
}
8+
return 598.0;
69
}
710
}

exercises/tiered_pricing/solutions/mperezi/src/test/java/tv/codely/checkout/TieredPricingShould.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,13 @@ void returnUnitPriceForOneSubscription() {
1414

1515
assertThat(totalPrice).isEqualTo(299.0);
1616
}
17+
18+
@Test
19+
void returnDoubleTheUnitPriceForTwoSubscriptions() {
20+
var tieredPricing = new TieredPricing();
21+
22+
double totalPrice = tieredPricing.totalPrice(2);
23+
24+
assertThat(totalPrice).isEqualTo(598.0);
25+
}
1726
}

0 commit comments

Comments
 (0)