We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9434002 commit 29fa499Copy full SHA for 29fa499
src/main/java/pl/edu/agh/mwo/invoice/product/Product.java
@@ -10,6 +10,12 @@ public abstract class Product {
10
private final BigDecimal taxPercent;
11
12
protected Product(String name, BigDecimal price, BigDecimal tax) {
13
+ if (name == null || name.isEmpty()) {
14
+ throw new IllegalArgumentException("Product name cannot be null or empty.");
15
+ }
16
+ if (price == null || price.signum() == -1) {
17
+ throw new IllegalArgumentException("Price name cannot be null.");
18
19
this.name = name;
20
this.price = price;
21
this.taxPercent = tax;
0 commit comments