Browse Source

4gewinnt: added test for board with size 0

4gewinnt
Malte Schellhardt 3 years ago
committed by Lorenz Hohmann
parent
commit
2d4b0be4e5
  1. 2
      src/main/java/de/tims/viergewinnt/ai/Logic.java
  2. 13
      src/test/java/de/tims/viergewinnt/ai/LogicTest.java

2
src/main/java/de/tims/viergewinnt/ai/Logic.java

@ -31,7 +31,7 @@ public class Logic {
}
public int getBoardSize() {
return 6;
return 0;
}
public void setCurrentPlayer(int player) {

13
src/test/java/de/tims/viergewinnt/ai/LogicTest.java

@ -169,9 +169,10 @@ class LogicTest {
assertEquals(expectedResult.getClass(), realResult.getClass());
}
@Test
void getBoardSize() {
int expectedResult = 6;
@ParameterizedTest(name = "[{index}] size {0}")
@MethodSource("boardSizeParameters")
void getBoardSize(String testName, int size) {
int expectedResult = size;
int realResult = testObj.getBoardSize();
assertEquals(expectedResult, realResult);
@ -266,4 +267,10 @@ class LogicTest {
);
}
private static Stream<Arguments> boardSizeParameters() {
return Stream.of(
Arguments.of("board with size 0", 0)
);
}
}
Loading…
Cancel
Save