updated SiedlerGameTest
This commit is contained in:
@@ -14,7 +14,9 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
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.assertThrows;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SiedlerGameTest Class
|
* SiedlerGameTest Class
|
||||||
@@ -143,11 +145,14 @@ public class SiedlerGameTest {
|
|||||||
@ValueSource(ints = {1, 5})
|
@ValueSource(ints = {1, 5})
|
||||||
@DisplayName("Starting Siedler game with one player or 5 players, expects fail")
|
@DisplayName("Starting Siedler game with one player or 5 players, expects fail")
|
||||||
public void startSiedlerGameWithOnePlayErrorMoreThanMaximum(int playerAmount) {
|
public void startSiedlerGameWithOnePlayErrorMoreThanMaximum(int playerAmount) {
|
||||||
Exception exc = assertThrows(IllegalArgumentException.class, () -> {
|
boolean exception = false;
|
||||||
|
try{
|
||||||
new SiedlerGame(DEFAULT_WINPOINTS, playerAmount);
|
new SiedlerGame(DEFAULT_WINPOINTS, playerAmount);
|
||||||
});
|
}
|
||||||
|
catch (IllegalArgumentException e){
|
||||||
Assertions.assertEquals(IllegalArgumentException.class, exc.getClass());
|
exception = true;
|
||||||
|
}
|
||||||
|
assertTrue(exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -156,11 +161,13 @@ public class SiedlerGameTest {
|
|||||||
@Test
|
@Test
|
||||||
@DisplayName("Starting Siedler game with one player, expects fail")
|
@DisplayName("Starting Siedler game with one player, expects fail")
|
||||||
public void startSiedlerGameWithLowerThanMinimumWinPoints() {
|
public void startSiedlerGameWithLowerThanMinimumWinPoints() {
|
||||||
Exception exc = assertThrows(IllegalArgumentException.class, () -> {
|
boolean exception = false;
|
||||||
|
try{
|
||||||
new SiedlerGame(1, 4);
|
new SiedlerGame(1, 4);
|
||||||
});
|
}
|
||||||
|
catch (IllegalArgumentException e){
|
||||||
Assertions.assertEquals(IllegalArgumentException.class, exc.getClass());
|
exception = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user