SimpleDate { @Override public boolean equals(Object obj) { if (obj == this) { return true; } else if (!(obj instanceof SimpleDate)) { return false; } SimpleDate other = (SimpleDate) obj; return this.year == other.year && this.month == other.month && this.day == other.day; } SimpleDate(int year, int month, int day); int getYear(); int getMonth(); int getDay(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void testEquals() { assertEquals(new SimpleDate(2013, 5, 10), new SimpleDate(2013, 5, 10)); assertThat(new SimpleDate(2013, 5, 10)).isNotEqualTo(new SimpleDate(2014, 5, 10)); assertThat(new SimpleDate(2013, 5, 10)).isNotEqualTo(new SimpleDate(2013, 6, 10)); assertThat(new SimpleDate(2013, 5, 10)).isNotEqualTo(new SimpleDate(2013, 5, 11)); }