Skip to content

Commit

Permalink
Update Transaction class with exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
elisab3 committed May 24, 2026
1 parent 30d025e commit b332c59
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/java/Model/Transaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ public abstract class Transaction {
protected boolean committed;

protected Transaction(Share share, int week, TransactionCalculator calculator) {
if (share == null) {
throw new IllegalArgumentException("Share cannot be null");
}
if (week < 1) {
throw new IllegalArgumentException("Week must be at least 1");
}
if (calculator == null) {
throw new IllegalArgumentException("Calculator cannot be null");
}

this.share = share;
this.week = week;
this.calculator = calculator;
Expand Down

0 comments on commit b332c59

Please sign in to comment.