Game { public char winner() { if (board.charAt(0) != '-' && board.charAt(0) == board.charAt(1) && board.charAt(1) == board.charAt(2)) return board.charAt(0); if (board.charAt(3) != '-' && board.charAt(3) == board.charAt(4) && board.charAt(4) == board.charAt(5)) return board.charAt(3); if (board.charAt(6) != '-' && board.charAt(6) == board.charAt(7) && board.charAt(7) == board.charAt(8)) return board.charAt(6); return '-'; } Game(String s);  Game(StringBuffer s, int position, char player); int move(char player); Game play(int i, char player); char winner(); public StringBuffer board; }
@Test public void testWinConditions() { Game game = new Game("---XXX---"); assertEquals('X', game.winner()); }