GameOfLife { public static boolean[][] blankWorld(int size) { return new boolean[size][size]; }  static boolean[][] blankWorld(int size); static boolean[][] live(boolean[][] world); static final boolean _; static final boolean X; }
@Test public void a_dead_cell_remains_dead() { assertGameOfLife(blankWorld(3), blankWorld(3)); }
@Test public void a_cell_with_no_neighbours_dies() { final boolean[][] start = { { _, _, _ }, { _, X, _ }, { _, _, _ } }; assertGameOfLife(blankWorld(3), start); }
@Test public void a_cell_with_only_one_neighbour_dies() { final boolean[][] start = { { _, _, _ }, { _, X, X }, { _, _, _ } }; assertGameOfLife(blankWorld(3), start); }
@Test public void a_cell_with_four_neighbours_dies() { final boolean[][] start = { { _, _, X }, { X, X, X }, { _, X, _ } }; assertGameOfLife(blankWorld(3), start); }
@Test public void a_dead_cell_with_two_neighbours_stay_dead() { final boolean[][] start = { { _, _, _ }, { X, _, X }, { _, _, _ } }; assertGameOfLife(blankWorld(3), start); }
@Test public void an_empty_4x4_world_should_stay_empty() { final boolean[][] start = blankWorld(4); final boolean[][] end = blankWorld(4); assertGameOfLife(end, start); }