Requirement 5 – win condition (I)

This requirement tells the system whether the game is finished.

When no more discs can be inserted, the game finishes and it is considered a draw.

There are two conditions to test. The first condition is that new game must be unfinished; the second condition is that full board games must be finished:

@Test
public void whenTheGameStartsItIsNotFinished() {
  assertFalse("The game must not be finished", tested.isFinished()); 
} 
 
@Test 
public void whenNoDiscCanBeIntroducedTheGamesIsFinished() { 
  for (int row = 0; row < 6; row++)
    for (int column = 0; column < 7; column++)
      tested.putDiscInColumn(column);
    assertTrue("The game must be finished", tested.isFinished()); 
}

An easy and simple solution to these two tests is ...

Get Test-Driven Java Development - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.