Skip to content

Commit 3fd9d6c

Browse files
committed
Final product test changes
1 parent 3f41017 commit 3fd9d6c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/main/java/pl/edu/agh/mwo/invoice/Invoice.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public void addProduct(Product product, Integer quantity) {
1717
}
1818

1919
public BigDecimal getSubtotal() {
20-
return null;
20+
return BigDecimal.ZERO;
2121
}
2222

2323
public BigDecimal getTax() {

src/main/java/pl/edu/agh/mwo/invoice/product/Product.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ protected Product(String name, BigDecimal price, BigDecimal tax) {
1313
if (name == null || name.equals("")) {
1414
throw new IllegalArgumentException("Product name cannot be null");
1515
}
16+
if (price == null || price.compareTo(BigDecimal.ZERO) == -1) {
17+
throw new IllegalArgumentException("Price is invalid");
18+
}
1619
this.name = name;
1720
this.price = price;
1821
this.taxPercent = tax;

0 commit comments

Comments
 (0)