### Question:
TaskEvent implements Comparable<TaskEvent> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof TaskEvent)) { return false; } TaskEvent taskEvent = (TaskEvent) o; if (sendCount != taskEvent.sendCount) { return false; } if (triggerTime != taskEvent.triggerTime) { return false; } return source != null ? source.equals(taskEvent.source) : taskEvent.source == null; } TaskEvent(Register source); Register getSource(); void setTriggerTime(long triggerTime); long delayTime(); @Override int compareTo(TaskEvent event); @Override boolean equals(Object o); @Override int hashCode(); int incSendCount();  }### Answer:
@Test public void testEquals() { TaskEvent event1 = new TaskEvent(null); Assert.assertTrue(event1.equals(event1)); Assert.assertFalse(event1.equals("xxxx")); TaskEvent event2 = new TaskEvent(null); Assert.assertTrue(event1.equals(event2)); event1.incSendCount(); Assert.assertFalse(event1.equals(event2)); event2.incSendCount(); event1.setTriggerTime(123); Assert.assertFalse(event1.equals(event2)); event2.setTriggerTime(123); Register register = Mockito.mock(Register.class); TaskEvent event3 = new TaskEvent(register); TaskEvent event4 = new TaskEvent(register); Assert.assertTrue(event3.equals(event4)); }