import org.junit.jupiter.api.*; import static org.junit.jupiter.api.Assertions.*; class GameBaseTest { private domain.GameBase game; private static final int[][] TEST_BOARD = { {1, 2, 1, 3}, {3, 1, 2, 1}, {2, 3, 3, 2}, {1, 2, 1, 3} }; @BeforeEach void setUp() { game = new domain.GameBase(TEST_BOARD); } @Test void testInitialization() { assertNotNull(game); assertArrayEquals(TEST_BOARD, game.getBoard()); assertEquals(0, game.getMistakeCount()); } @Test void testReset() { // Directly set some cells (since we can't use markCell methods in base class) game.blackCells[0][0] = true; game.whiteCells[1][1] = true; // Reset game game.reset(); // Verify all cells are reset boolean[][] blackCells = game.getBlackCells(); boolean[][] whiteCells = game.getWhiteCells(); for (int i = 0; i < TEST_BOARD.length; i++) { for (int j = 0; j < TEST_BOARD[0].length; j++) { assertFalse(blackCells[i][j], "Black cell at [" + i + "][" + j + "] should be false"); assertFalse(whiteCells[i][j], "White cell at [" + i + "][" + j + "] should be false"); } } assertEquals(0, game.getMistakeCount()); } @Test void testGetCurrentState() { int[][] currentState = game.getCurrentState(); assertArrayEquals(TEST_BOARD, currentState); } @Test void testGetBlackCells() { boolean[][] blackCells = game.getBlackCells(); assertNotNull(blackCells); assertEquals(TEST_BOARD.length, blackCells.length); assertEquals(TEST_BOARD[0].length, blackCells[0].length); } @Test void testGetWhiteCells() { boolean[][] whiteCells = game.getWhiteCells(); assertNotNull(whiteCells); assertEquals(TEST_BOARD.length, whiteCells.length); assertEquals(TEST_BOARD[0].length, whiteCells[0].length); } @Test void testGetMistakeCount() { assertEquals(0, game.getMistakeCount()); } @Test void testBoardDimensions() { int[][] board = game.getBoard(); assertEquals(TEST_BOARD.length, board.length); assertEquals(TEST_BOARD[0].length, board[0].length); } }