Skip to content

Commit b9686ee

Browse files
committed
New invoice tests
1 parent 722f869 commit b9686ee

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/test/java/pl/edu/agh/mwo/invoice/InvoiceTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff 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"));

0 commit comments

Comments
 (0)