@Test public void valueAnEventHigherThanAnEventThatStartedBefore() { assertEquals(1, comparator.compare(eventInApril, eventInMarch)); assertEquals(-1, comparator.compare(eventInMarch, eventInApril)); assertEquals(0, comparator.compare(eventInMarch, eventInMarch)); }
@Override public int compare(EventAdapter.Item event1, EventAdapter.Item event2) { if (event1.getEvent().getStart() == null) { if (event2.getEvent().getStart() == null) { return 0; } else { return 1; } } else if (event2.getEvent().getStart() == null) { return -1; } else { return event1.getEvent().getStart().compareTo(event2.getEvent().getStart()); } }
EventDateComparator implements Comparator<EventAdapter.Item> { @Override public int compare(EventAdapter.Item event1, EventAdapter.Item event2) { if (event1.getEvent().getStart() == null) { if (event2.getEvent().getStart() == null) { return 0; } else { return 1; } } else if (event2.getEvent().getStart() == null) { return -1; } else { return event1.getEvent().getStart().compareTo(event2.getEvent().getStart()); } } }
EventDateComparator implements Comparator<EventAdapter.Item> { @Override public int compare(EventAdapter.Item event1, EventAdapter.Item event2) { if (event1.getEvent().getStart() == null) { if (event2.getEvent().getStart() == null) { return 0; } else { return 1; } } else if (event2.getEvent().getStart() == null) { return -1; } else { return event1.getEvent().getStart().compareTo(event2.getEvent().getStart()); } }  }
EventDateComparator implements Comparator<EventAdapter.Item> { @Override public int compare(EventAdapter.Item event1, EventAdapter.Item event2) { if (event1.getEvent().getStart() == null) { if (event2.getEvent().getStart() == null) { return 0; } else { return 1; } } else if (event2.getEvent().getStart() == null) { return -1; } else { return event1.getEvent().getStart().compareTo(event2.getEvent().getStart()); } }  @Override int compare(EventAdapter.Item event1, EventAdapter.Item event2); @Override boolean equals(Object obj); }
EventDateComparator implements Comparator<EventAdapter.Item> { @Override public int compare(EventAdapter.Item event1, EventAdapter.Item event2) { if (event1.getEvent().getStart() == null) { if (event2.getEvent().getStart() == null) { return 0; } else { return 1; } } else if (event2.getEvent().getStart() == null) { return -1; } else { return event1.getEvent().getStart().compareTo(event2.getEvent().getStart()); } }  @Override int compare(EventAdapter.Item event1, EventAdapter.Item event2); @Override boolean equals(Object obj);  }