YearDate extends AmazonDate { @Override public boolean equals(Object o) { if (!super.equals(o)) return false; YearDate yearDate = (YearDate) o; return year == yearDate.year; } YearDate(Slot slot, int year); int getYear(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void testEquals() { YearDate date1 = new YearDate(mockSlot, 1); YearDate date2 = new YearDate(mockSlot, 1); assertEquals(date1, date2); assertEquals(date1.getYear(), date2.getYear()); assertEquals(date1.getSlot(), date2.getSlot()); assertEquals(date1.hashCode(), date2.hashCode()); assertEquals(date1.toString(), date2.toString()); }