Browse Source

tictactoe: added generateGUI method

tictactoe
Malte Schellhardt 3 years ago
committed by Lorenz Hohmann
parent
commit
435c51f3d7
  1. 7
      src/main/java/de/tims/tictactoe/GameLogic.java
  2. 10
      src/test/java/de/tims/tictactoe/GameLogicTest.java

7
src/main/java/de/tims/tictactoe/GameLogic.java

@ -1,5 +1,7 @@
package de.tims.tictactoe;
import javax.swing.JPanel;
public class GameLogic {
private static final char PLAYER_1 = 'x';
@ -94,4 +96,9 @@ public class GameLogic {
return checkForWin(PLAYER_1) || checkForWin(PLAYER_2);
}
public JPanel generateGUI() {
// TODO Auto-generated method stub
return new JPanel();
}
}

10
src/test/java/de/tims/tictactoe/GameLogicTest.java

@ -5,6 +5,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.stream.Stream;
import javax.swing.JPanel;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
@ -53,6 +55,14 @@ class GameLogicTest {
assertArrayEquals(expectedResult, realResult);
}
@Test
void generateGUITest() {
JPanel expectedResult = new JPanel();
JPanel realResult = game.generateGUI();
assertEquals(expectedResult.getClass(), realResult.getClass());
}
@ParameterizedTest(name = "[{index}] {0} -> {2} fields")
@MethodSource("testCasesForCountPlayfields")
void fieldCountTest(String testName, int size, int expectedResult) {

Loading…
Cancel
Save