File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
exercises/tiered_pricing/solutions/oflorez/src
main/java/tv/codely/checkout
test/java/tv/codely/checkout Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,9 @@ public enum Tier {
55
66 FIRST (1 ,2 ,299 ),
77 SECOND (3 ,10 ,239 ),
8- THIRD (11 ,25 ,219 );
8+ THIRD (11 ,25 ,219 ),
9+ FOURTH (26 ,50 ,199 ),
10+ FIFTH (51 ,Integer .MAX_VALUE ,149 );
911
1012 private final int lowerLimit ;
1113 private final int upperLimit ;
Original file line number Diff line number Diff line change @@ -32,6 +32,22 @@ void calculate_total_value_for_third_pricing_tier() {
3232 assertEquals (calculateTotalPriceExpected (tier .getUnitPrice (), subscription ), pricing .calculateTotalPrice (subscription ));
3333 }
3434
35+ @ Test
36+ void calculate_total_value_for_fourth_pricing_tier () {
37+ var pricing = new TieredPricing ();
38+ var tier = Tier .FOURTH ;
39+ var subscription = retrieveSubscriptionGivenTier (tier );
40+ assertEquals (calculateTotalPriceExpected (tier .getUnitPrice (), subscription ), pricing .calculateTotalPrice (subscription ));
41+ }
42+
43+ @ Test
44+ void calculate_total_value_for_fifth_pricing_tier () {
45+ var pricing = new TieredPricing ();
46+ var tier = Tier .FIFTH ;
47+ var subscription = retrieveSubscriptionGivenTier (tier );
48+ assertEquals (calculateTotalPriceExpected (tier .getUnitPrice (), subscription ), pricing .calculateTotalPrice (subscription ));
49+ }
50+
3551 private int retrieveSubscriptionGivenTier (Tier tier ) {
3652 return IntStream .rangeClosed (tier .getLowerLimit (), tier .getUpperLimit ()).findAny ().getAsInt ();
3753 }
You can’t perform that action at this time.
0 commit comments