File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
src/test/java/pl/edu/agh/mwo/invoice Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,22 @@ public void testEmptyInvoiceHasEmptyTotal() {
3636 Assert .assertThat (BigDecimal .ZERO , Matchers .comparesEqualTo (invoice .getTotal ()));
3737 }
3838
39+ @ Test
40+ public void testInvoiceSubtotalWithTwoDifferentProducts () {
41+ Product onions = new TaxFreeProduct ("Warzywa" , new BigDecimal ("10" ));
42+ Product apples = new TaxFreeProduct ("Owoce" , new BigDecimal ("10" ));
43+ invoice .addProduct (onions );
44+ invoice .addProduct (apples );
45+ Assert .assertThat (new BigDecimal ("20" ), Matchers .comparesEqualTo (invoice .getSubtotal ()));
46+ }
47+
48+ @ Test
49+ public void testInvoiceSubtotalWithManySameProducts () {
50+ Product onions = new TaxFreeProduct ("Warzywa" , new BigDecimal ("10" ));
51+ invoice .addProduct (onions , 100 );
52+ Assert .assertThat (new BigDecimal ("1000" ), Matchers .comparesEqualTo (invoice .getSubtotal ()));
53+ }
54+
3955 @ Test
4056 public void testInvoiceHasTheSameSubtotalAndTotalIfTaxIsZero () {
4157 Product taxFreeProduct = new TaxFreeProduct ("Warzywa" , new BigDecimal ("199.99" ));
You can’t perform that action at this time.
0 commit comments