Exemplo n.º 1
0
  @Test
  public void aCellAliveTest() {
    // GIVEN
    Cell cell = new Cell();

    // WHEN
    boolean status = cell.isAlive();

    // THEN
    assertFalse("A new cell is dead", status);
  }
Exemplo n.º 2
0
  public void aDeadCellWith2NeighboursStaysDeadTest() {
    // GIVEN
    int numberOfNeighbours = 2;
    Cell cell = new Cell(false, numberOfNeighbours);

    // WHEN
    cell.nextStep();
    boolean status = cell.isAlive();

    // THEN
    assertFalse("A cell with 2 neighbours stays dead", status);
  }
Exemplo n.º 3
0
  @Test
  public void aCellLivesWith3NeighboursTest() {
    // GIVEN
    int numberOfNeighbours = 3;
    Cell cell = new Cell(true, numberOfNeighbours);

    // WHEN
    cell.nextStep();
    boolean status = cell.isAlive();

    // THEN
    assertTrue("A cell with 3 neighbours lives or is reanimated", status);
  }
Exemplo n.º 4
0
  @Test
  public void shouldReturnFalseIfCellIsDeadWhenIsAliveIsCalled() {
    Cell cell = new Cell(false);

    assertFalse(cell.isAlive());
  }
Exemplo n.º 5
0
  @Test
  public void shouldReturnTrueIfCellIsAliveWhenIsAliveIsCalled() {
    Cell cell = new Cell(true);

    assertTrue(cell.isAlive());
  }