Redo if statement with exception throwing
This commit is contained in:
parent
3049650bc4
commit
c16ddc6bca
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue