From 828890c7e601c38016ec508a1c4e5d6c6d5b040b Mon Sep 17 00:00:00 2001 From: schrom01 Date: Fri, 10 Dec 2021 22:48:40 +0100 Subject: [PATCH] updated SiedlerGameTest --- test/ch/zhaw/catan/SiedlerGameTest.java | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) 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; + } }