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