private List<BaseRoute> getRouteCharacteristics( List<BaseRoute> routes, RouteCharacteristics characteristics) { List<BaseRoute> result = new ArrayList<>(); for (BaseRoute route : routes) { if (route.getCharacteristics().equals(characteristics)) result.add(route); } return result.size() > 0 ? result : null; }
void readRouteCharacteristics( String testFileName, RouteCharacteristics characteristics, int characteristicsCount, int[] positionCount) throws IOException { ParserResult result = read(testFileName); List<BaseRoute> routes = getRouteCharacteristics(result.getAllRoutes(), characteristics); if (routes == null || characteristicsCount == 0) { assertNull(routes); } else { assertEquals(characteristicsCount, routes.size()); for (int i = 0; i < routes.size(); i++) { BaseRoute route = routes.get(i); assertEquals(characteristics, route.getCharacteristics()); assertEquals(positionCount[i], route.getPositionCount()); } } }