MineSweeper { boolean[][] minesweeper2(int[][] gameboard, boolean[][] opening, int[][] moves) { for (int[] move: moves) { int r = move[0], c = move[1]; if (!opening[r][c]) { if (gameboard[r][c] == 9) { return new boolean[0][0]; } if (gameboard[r][c] == 0) { openZeroes(gameboard, opening, r, c); } else { opening[r][c] = true; } } } return opening; }    }
@Test(dataProvider = "mine2") public void testSweeper2(int[][] gameboard, boolean[][] opening, int[][] moves, boolean[][] expected) { boolean[][] actual = new MineSweeper().minesweeper2(gameboard, opening, moves); assertEquals(actual.length, expected.length); if (actual.length > 0) { assertEquals(actual[0].length, expected[0].length); if (actual[0].length > 0) { for (int i = 0; i < actual.length; i++) { for (int j = 0; j < actual[i].length; j++) { assertEquals(String .format("actual[%d][%d] = %b, expected[%d][%d] = %b", i, j, actual[i][j], i, j, expected[i][j]), actual[i][j], expected[i][j]); } } } } }