SimpleCell implements Cell { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SimpleCell that = (SimpleCell) o; if (neighborCount != that.neighborCount) return false; if (state != that.state) return false; if (x != that.x) return false; if (y != that.y) return false; return true; } SimpleCell(int x, int y, int state); @Override void setOverseer(Overseer overseer); @Override void reset(int state); @Override long getId(); @Override int getX(); @Override int getY(); @Override int getState(); @Override void setState(int newState); @Override boolean isAlive(); @Override boolean isDead(); @Override void onNeighborStateChange(int newState); int getNeighborCount(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testEquals() { SimpleCell other = null; assertThat(cell).isEqualTo(cell); assertThat(cell.equals(other)).isFalse(); assertThat(cell.equals(this)).isFalse(); other = new SimpleCell(0, 0, Cell.STATE_DEAD); assertThat(cell.equals(other)).isFalse(); other = new SimpleCell(0, 0, Cell.STATE_ALIVE); other.increaseNeighborCount(); assertThat(cell.equals(other)).isFalse(); cell.increaseNeighborCount(); assertThat(cell.equals(other)).isTrue(); }