StationBasedExcelRowComparator extends AbstractExcelRowComparator<ExcelRow<T>> { @Override public int compare(ExcelRow<T> lho, ExcelRow<T> rho) { return nullsLast(compareReferences( comparing(T::getDate, nullsLast(naturalOrder())) .thenComparing(getStationName(T::getDepartureStation), nullsLast(naturalOrder())) .thenComparing(getStationName(T::getArrivalStation), nullsLast(naturalOrder())) )).compare(lho, rho); } StationBasedExcelRowComparator(Language language); @Override int compare(ExcelRow<T> lho, ExcelRow<T> rho);  }
@Test public final void testCompareNullDate() throws Exception { Assert.assertThat( comparator.compare( new ExcelRow.Builder(now, null).build(false), new BatchExcelRow.Builder(null, null).build(false) ), lessThan(0) ); }
@Test public final void testCompareNullOnTheLeft() throws Exception { Assert.assertThat( comparator.compare( null, new BatchExcelRow.Builder(null, null).build(false) ), greaterThan(0) ); }
@Test public final void testCompareNullOnTheRight() throws Exception { Assert.assertThat( comparator.compare( new ExcelRow.Builder(now, null).build(false), null ), lessThan(0) ); }
@Test public void testCompareNullDepartureStation() throws Exception { Assert.assertThat( comparator.compare( new ExcelRow.Builder(now, null).departureStation(new Station("foo")).build(false), new BatchExcelRow.Builder(now, null).build(false) ), lessThan(0) ); }
@Test public void testCompareNullArrivalStation() throws Exception { Assert.assertThat( comparator.compare( new ExcelRow.Builder(now, null) .departureStation(new Station("foo")) .arrivalStation(new Station("bar")) .build(false), new BatchExcelRow.Builder(now, null) .departureStation(new Station("foo")) .build(false) ), lessThan(0) ); }