Пример #1
0
  @Test
  public void aCellAliveTest() {
    // GIVEN
    Cell cell = new Cell();

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

    // THEN
    assertFalse("A new cell is dead", status);
  }
Пример #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);
  }
Пример #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);
  }
Пример #4
0
  @Test
  public void shouldReturnFalseIfCellIsDeadWhenIsAliveIsCalled() {
    Cell cell = new Cell(false);

    assertFalse(cell.isAlive());
  }
Пример #5
0
  @Test
  public void shouldReturnTrueIfCellIsAliveWhenIsAliveIsCalled() {
    Cell cell = new Cell(true);

    assertTrue(cell.isAlive());
  }