File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
exercises/tiered_pricing/solutions/oflorez/src/test/java/tv/codely/checkout Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 55import java .util .stream .IntStream ;
66
77import static org .junit .jupiter .api .Assertions .assertEquals ;
8+ import static org .junit .jupiter .api .Assertions .assertThrows ;
89
910public class TieredPricingShould {
1011
@@ -48,6 +49,13 @@ void calculate_total_value_for_fifth_pricing_tier() {
4849 assertEquals (calculateTotalPriceExpected (tier .getUnitPrice (), subscription ), pricing .calculateTotalPrice (subscription ));
4950 }
5051
52+ @ Test
53+ void throws_illegal_argument_when_subscription_be_non_positive_value () {
54+ var pricing = new TieredPricing ();
55+ var subscription = IntStream .rangeClosed (-100000 , 0 ).findAny ().getAsInt ();
56+ assertThrows (IllegalArgumentException .class , () -> pricing .calculateTotalPrice (subscription ));
57+ }
58+
5159 private int retrieveSubscriptionGivenTier (Tier tier ) {
5260 return IntStream .rangeClosed (tier .getLowerLimit (), tier .getUpperLimit ()).findAny ().getAsInt ();
5361 }
You can’t perform that action at this time.
0 commit comments