diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index fcf3534..eff8ac0 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -32,6 +32,9 @@ public class SiedlerGame { * or players is not between two and four */ public SiedlerGame(int winPoints, int numberOfPlayers) { + if (winPoints < 3 || numberOfPlayers < Config.MIN_NUMBER_OF_PLAYERS || numberOfPlayers > 4) { + throw new IllegalArgumentException(); + } bank = new Bank(); board = new SiedlerBoard(); board.createFixGameField(); diff --git a/test/ch/zhaw/catan/SiedlerGameTest.java b/test/ch/zhaw/catan/SiedlerGameTest.java index eea1873..42a68ee 100644 --- a/test/ch/zhaw/catan/SiedlerGameTest.java +++ b/test/ch/zhaw/catan/SiedlerGameTest.java @@ -152,7 +152,6 @@ public class SiedlerGameTest { @Test @DisplayName("Starting Siedler game with one player, expects fail") public void startSiedlerGameWithLowerThanMinimumWinPoints() { - Exception exc = assertThrows(IllegalArgumentException.class, () -> { SiedlerGame game = new SiedlerGame(1, 4); });