SimpleDate { @Override public int hashCode() { return Objects.hash(year, month, 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 testHashCode() { assertEquals(new SimpleDate(2013, 5, 10).hashCode(), new SimpleDate(2013, 5, 10).hashCode()); assertThat(new SimpleDate(2013, 5, 10).hashCode()).isNotEqualTo( new SimpleDate(2014, 5, 10).hashCode()); assertThat(new SimpleDate(2013, 5, 10).hashCode()).isNotEqualTo( new SimpleDate(2013, 6, 10).hashCode()); assertThat(new SimpleDate(2013, 5, 10).hashCode()).isNotEqualTo( new SimpleDate(2013, 5, 11).hashCode()); }