ExcelRowComparator extends AbstractExcelRowComparator<ExcelRow<T>> { @Override public int compare(ExcelRow lho, ExcelRow rho) { return nullsLast(compareReferences( comparing(T::getDate, nullsLast(naturalOrder())) .thenComparing(T::getArrivalStation, nullsLast(naturalOrder())) .thenComparing(T::getDepartureStation, nullsLast(naturalOrder())) .thenComparing(T::getLinkStation, nullsLast(naturalOrder())) .thenComparing(T::getExpectedDepartureTime, nullsLast(naturalOrder())) .thenComparing(T::getExpectedArrivalTime, nullsLast(naturalOrder())) .thenComparing(T::getExpectedTrainLine1, nullsLast(naturalOrder())) .thenComparing(T::getExpectedTrainLine2, nullsLast(naturalOrder())) .thenComparing(T::getEffectiveDepartureTime, nullsLast(naturalOrder())) .thenComparing(T::getEffectiveArrivalTime, nullsLast(naturalOrder())) .thenComparing(T::getEffectiveTrainLine1, nullsLast(naturalOrder())) .thenComparing(T::getEffectiveTrainLine2, nullsLast(naturalOrder())) .thenComparing(T::getDelay, nullsLast(naturalOrder())) )).compare(lho, rho); }  @Override int compare(ExcelRow lho, ExcelRow rho);  }
@Test public void testEquals() throws Exception { Assert.assertEquals(0, comparator.compare(lho.build(), rho.build())); }
@Test public void testEqualsEmpty() throws Exception { Assert.assertEquals(0, comparator.compare(new BatchExcelRow.Builder(null, null).delay(0L).build(false), BatchExcelRow.EMPTY)); }
@Test public void testEqualsReferences() throws Exception { Assert.assertThat(comparator.compare(lho.build(), lho.build()), is(equalTo(0))); }
@Test public void testLess() throws Exception { rho.delay(Delays.toMillis(15L)); Assert.assertThat(comparator.compare(lho.build(), rho.build()), is(lessThan(0))); }
@Test public void testGreater() throws Exception { lho.delay(Delays.toMillis(15L)); Assert.assertThat(comparator.compare(lho.build(), rho.build()), is(greaterThan(0))); }
@Test public void testWithNullOnLeft() throws Exception { Assert.assertThat(comparator.compare(null, rho.build()), is(greaterThan(0))); }
@Test public void testWithNullOnRight() throws Exception { Assert.assertThat(comparator.compare(lho.build(), null), is(lessThan(0))); }