|
@ -3,33 +3,31 @@ package de.tims.tictactoe; |
|
|
import static org.junit.jupiter.api.Assertions.assertArrayEquals; |
|
|
import static org.junit.jupiter.api.Assertions.assertArrayEquals; |
|
|
import static org.junit.jupiter.api.Assertions.assertEquals; |
|
|
import static org.junit.jupiter.api.Assertions.assertEquals; |
|
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
|
|
import java.util.stream.Stream; |
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.BeforeAll; |
|
|
import org.junit.jupiter.api.BeforeAll; |
|
|
import org.junit.jupiter.api.BeforeEach; |
|
|
|
|
|
import org.junit.jupiter.api.Test; |
|
|
import org.junit.jupiter.api.Test; |
|
|
|
|
|
import org.junit.jupiter.api.TestInstance; |
|
|
|
|
|
import org.junit.jupiter.api.TestInstance.Lifecycle; |
|
|
import org.junit.jupiter.params.ParameterizedTest; |
|
|
import org.junit.jupiter.params.ParameterizedTest; |
|
|
import org.junit.jupiter.params.provider.Arguments; |
|
|
import org.junit.jupiter.params.provider.Arguments; |
|
|
import org.junit.jupiter.params.provider.MethodSource; |
|
|
import org.junit.jupiter.params.provider.MethodSource; |
|
|
|
|
|
|
|
|
|
|
|
@TestInstance(Lifecycle.PER_CLASS) |
|
|
class GameLogicTest { |
|
|
class GameLogicTest { |
|
|
|
|
|
|
|
|
private int size = 3; |
|
|
|
|
|
private GameLogic game = new GameLogic(size); |
|
|
|
|
|
|
|
|
private final int SIZE = 3; |
|
|
|
|
|
private GameLogic game; |
|
|
|
|
|
|
|
|
@BeforeAll |
|
|
@BeforeAll |
|
|
static void setUpBeforeClass() throws Exception { |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@BeforeEach |
|
|
|
|
|
void setUp() throws Exception { |
|
|
|
|
|
|
|
|
void setUpBeforeClass() throws Exception { |
|
|
|
|
|
this.game = new GameLogic(SIZE); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Test |
|
|
@Test |
|
|
void createGameLogicTest() { |
|
|
void createGameLogicTest() { |
|
|
GameLogic expectedResult = this.game; |
|
|
GameLogic expectedResult = this.game; |
|
|
GameLogic realResult = new GameLogic(size); |
|
|
|
|
|
|
|
|
GameLogic realResult = new GameLogic(SIZE); |
|
|
|
|
|
|
|
|
assertEquals(expectedResult.getClass(), realResult.getClass()); |
|
|
assertEquals(expectedResult.getClass(), realResult.getClass()); |
|
|
} |
|
|
} |
|
@ -79,7 +77,7 @@ class GameLogicTest { |
|
|
{'-', '-', '-'}, |
|
|
{'-', '-', '-'}, |
|
|
{'-', '-', '-'}}), |
|
|
{'-', '-', '-'}}), |
|
|
Arguments.of("set field [1][0] for player 2", 1, 0, 'o', new char[][] |
|
|
Arguments.of("set field [1][0] for player 2", 1, 0, 'o', new char[][] |
|
|
{{'-', '-', '-'}, |
|
|
|
|
|
|
|
|
{{'x', '-', '-'}, |
|
|
{'o', '-', '-'}, |
|
|
{'o', '-', '-'}, |
|
|
{'-', '-', '-'}}) |
|
|
{'-', '-', '-'}}) |
|
|
); |
|
|
); |
|
|