BatchExcelRowMapperProcessor implements ItemProcessor<LineStop, BatchExcelRow>, InitializingBean { @Override public BatchExcelRow process(final LineStop item) throws Exception { BatchExcelRow result; LOGGER.trace("item", item); result = extractSens(item, stationAName, stationBName); LOGGER.trace("result", result); return result; }  @Override void afterPropertiesSet(); @Override BatchExcelRow process(final LineStop item); void setStationAName(String stationAName); void setStationBName(String stationBName); void setLanguage(String language);  }
@Test(expected = ArrivalDepartureEqualsException.class) public void testArrivalDepartureEquals() throws Exception { LineStop actual = new LineStop .Builder(fromA, false, false) .station(new Station("foo")) .build(); processor.process(actual); }
@Test public void testProcessFromA() throws Exception { BatchExcelRow excelRow = processor.process(fromA); Assert.assertEquals(new Station("stationA"), excelRow.getDepartureStation()); Assert.assertEquals(new Station("stationB"), excelRow.getArrivalStation()); Assert.assertEquals(new TrainLine.Builder(466L).build(), excelRow.getExpectedTrainLine1()); Assert.assertEquals(new TrainLine.Builder(466L).build(), excelRow.getEffectiveTrainLine1()); Assert.assertEquals(LocalTime.parse("12:25"), excelRow.getExpectedDepartureTime()); Assert.assertEquals(LocalTime.parse("12:55"), excelRow.getExpectedArrivalTime()); Assert.assertEquals(LocalTime.parse("12:35"), excelRow.getEffectiveDepartureTime()); Assert.assertEquals(LocalTime.parse("13:15"), excelRow.getEffectiveArrivalTime()); Assert.assertEquals(20, excelRow.getDelay().longValue()); }
@Test public void testProcessFromB() throws Exception { BatchExcelRow excelRow = processor.process(fromB); Assert.assertEquals(new Station("stationA"), excelRow.getDepartureStation()); Assert.assertEquals(new Station("stationB"), excelRow.getArrivalStation()); Assert.assertEquals(20, excelRow.getDelay().longValue()); }
@Test public void testProcessSensDeparture() throws Exception { BatchExcelRow excelRow = processor.process(fromB); Assert.assertEquals(Sens.DEPARTURE, excelRow.getSens()); }