LineStop extends AbstractEntity implements Comparable<LineStop> { @Override @SuppressWarnings("NullableProblems") public int compareTo(final LineStop lineStop) { int result; if (lineStop == null) { result = -1; } else { result = new CompareToBuilder() .append(date, lineStop.getDate()) .append(station, lineStop.getStation()) .append(trainLine, lineStop.getTrainLine()) .append(arrivalTime, lineStop.getArrivalTime()) .append(departureTime, lineStop.getDepartureTime()) .toComparison(); } return result; } protected  LineStop(); private  LineStop(Builder builder); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); @Override @SuppressWarnings("NullableProblems") // We handle it in our implementation int compareTo(final LineStop lineStop); @Override Long getId(); TimeDelay getArrivalTime(); TimeDelay getDepartureTime(); TrainLine getTrainLine(); Station getStation(); LocalDate getDate(); boolean isCanceled(); boolean isCanceledDeparture(); boolean isCanceledArrival(); LineStop getPrevious(); LineStop getNext();  }
@Test public void testCompareToEquals() { assertThat(DATA_POINT1.compareTo(DATA_POINT2), is(equalTo(0))); }
@Test public void testCompareToGreater() { assertThat(DATA_POINT1.compareTo(DATA_POINT4), is(greaterThan(0))); }
@Test public void testCompareToLess() { assertThat(DATA_POINT4.compareTo(DATA_POINT1), is(lessThan(0))); }