diff --git a/test/ch/zhaw/catan/SiedlerGameTest.java b/test/ch/zhaw/catan/SiedlerGameTest.java index 11f656c..e6b9251 100644 --- a/test/ch/zhaw/catan/SiedlerGameTest.java +++ b/test/ch/zhaw/catan/SiedlerGameTest.java @@ -14,7 +14,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * SiedlerGameTest Class @@ -143,11 +145,14 @@ public class SiedlerGameTest { @ValueSource(ints = {1, 5}) @DisplayName("Starting Siedler game with one player or 5 players, expects fail") public void startSiedlerGameWithOnePlayErrorMoreThanMaximum(int playerAmount) { - Exception exc = assertThrows(IllegalArgumentException.class, () -> { + boolean exception = false; + try{ new SiedlerGame(DEFAULT_WINPOINTS, playerAmount); - }); - - Assertions.assertEquals(IllegalArgumentException.class, exc.getClass()); + } + catch (IllegalArgumentException e){ + exception = true; + } + assertTrue(exception); } /** @@ -156,11 +161,13 @@ public class SiedlerGameTest { @Test @DisplayName("Starting Siedler game with one player, expects fail") public void startSiedlerGameWithLowerThanMinimumWinPoints() { - Exception exc = assertThrows(IllegalArgumentException.class, () -> { + boolean exception = false; + try{ new SiedlerGame(1, 4); - }); - - Assertions.assertEquals(IllegalArgumentException.class, exc.getClass()); + } + catch (IllegalArgumentException e){ + exception = true; + } }