GraphToListTranslator { public List<SurveyListEntry> toChronoListOfSurveyListEntries(Survey survey) { final List<Leg> chronoLegs = survey.getAllLegsInChronoOrder(); List<SurveyListEntry> entries = toListOfSurveyListEntries(survey); Collections.sort(entries, new Comparator<SurveyListEntry>() { @Override public int compare(SurveyListEntry e0, SurveyListEntry e1) { return chronoLegs.indexOf(e0.leg) - chronoLegs.indexOf(e1.leg); } }); return entries; }  List<SurveyListEntry> toListOfSurveyListEntries(Survey survey); List<SurveyListEntry> toChronoListOfSurveyListEntries(Survey survey); List<Map<TableCol, Object>> toListOfColMaps(Survey survey); static Map<TableCol, Object> createMap(SurveyListEntry entry);  }
@Test public void testChronoListGeneration() { GraphToListTranslator translator = new GraphToListTranslator(); Survey baseSurvey = BasicTestSurveyCreator.createStraightNorth(); baseSurvey.setActiveStation(baseSurvey.getStationByName("1")); SurveyUpdater.updateWithNewStation(baseSurvey, new Leg(5, 270, 0)); List<GraphToListTranslator.SurveyListEntry> chronoList = translator.toChronoListOfSurveyListEntries(baseSurvey); GraphToListTranslator.SurveyListEntry last = chronoList.get(chronoList.size() - 1); Assert.assertEquals("5", last.getLeg().getDestination().getName()); }