Skip to content

Commit

Permalink
Feat: Validation for savegame
Browse files Browse the repository at this point in the history
  • Loading branch information
tommyah committed May 25, 2026
1 parent de95bc3 commit 290fdab
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package edu.ntnu.idi.idatt2003.g40.mappe.model;

import edu.ntnu.idi.idatt2003.g40.mappe.utils.Validator;

/**
* Represents one save game entry.
*
Expand Down Expand Up @@ -44,6 +46,11 @@ public SaveGame(final String name,
final double balance,
final double startingCapital,
final String stockDataPath) {
if (!Validator.NOT_EMPTY.isValid(name)
|| balance <= 0
|| startingCapital <= 0) {
throw new IllegalArgumentException("Invalid Save configuration!");
}
this.name = name;
this.balance = balance;
this.startingCapital = startingCapital;
Expand Down

0 comments on commit 290fdab

Please sign in to comment.