This is the second win condition, which is pretty similar to the previous one.
This time, we are trying to win the game by inserting discs into adjacent columns:
@Test public void when4HorizontalDiscsAreConnectedThenPlayerWins() { int column; for (column = 0; column < 3; column++) { tested.putDiscInColumn(column); // R tested.putDiscInColumn(column); // G } assertThat(tested.getWinner(), isEmptyString()); tested.putDiscInColumn(column); // R assertThat(tested.getWinner(), is("R")); }
The code to pass this test is put into the checkWinners method:
if (winner.isEmpty()) { String ...