### Question:
SimpleTimePeriod implements TimePeriod, Comparable<TimePeriod>, Serializable { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof TimePeriod)) { return false; } TimePeriod that = (TimePeriod) obj; if (!this.getStart().equals(that.getStart())) { return false; } if (!this.getEnd().equals(that.getEnd())) { return false; } return true; } SimpleTimePeriod(long start, long end);  SimpleTimePeriod(Date start, Date end); @Override Date getStart(); long getStartMillis(); @Override Date getEnd(); long getEndMillis(); @Override boolean equals(Object obj); @Override int compareTo(TimePeriod that); @Override int hashCode();  }### Answer:
@Test public void testEquals() { SimpleTimePeriod p1 = new SimpleTimePeriod(new Date(1000L), new Date(1004L)); SimpleTimePeriod p2 = new SimpleTimePeriod(new Date(1000L), new Date(1004L)); assertEquals(p1, p2); assertEquals(p2, p1); p1 = new SimpleTimePeriod(new Date(1002L), new Date(1004L)); assertFalse(p1.equals(p2)); p2 = new SimpleTimePeriod(new Date(1002L), new Date(1004L)); assertEquals(p1, p2); p1 = new SimpleTimePeriod(new Date(1002L), new Date(1003L)); assertFalse(p1.equals(p2)); p2 = new SimpleTimePeriod(new Date(1002L), new Date(1003L)); assertEquals(p1, p2); }