@Test
 public void testIsValidNavigonUrl() throws IOException {
   ParserResult result = read(TEST_PATH + "from-nmn.txt");
   assertEquals(NmnUrlFormat.class, result.getFormat().getClass());
   ParserResult plainResult = read(TEST_PATH + "from-nmn-plain.txt");
   assertEquals(NmnUrlFormat.class, plainResult.getFormat().getClass());
 }
 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());
     }
   }
 }
 ParserResult read(String testFileName) throws IOException {
   File source = new File(testFileName);
   ParserResult result = parser.read(source);
   assertNotNull(result.getFormat());
   assertNotNull(result.getAllRoutes());
   assertTrue(result.getAllRoutes().size() > 0);
   assertNotNull("Cannot read route from " + source, result.getTheRoute());
   assertTrue(result.getTheRoute().getPositionCount() > 0);
   return result;
 }
 @Test
 public void testIsValidGoogleMapsUrl() throws IOException {
   ParserResult result = read(TEST_PATH + "from-googlemaps.url");
   assertEquals(GoogleMapsUrlFormat.class, result.getFormat().getClass());
 }
  @Test
  public void testReadWithFormatList() throws IOException {
    List<NavigationFormat> formats = new ArrayList<>();
    ParserResult result1 = parser.read(new File(TEST_PATH + "from.itn"), formats);
    assertFalse(result1.isSuccessful());

    formats.add(new TomTom8RouteFormat());
    ParserResult result2 = parser.read(new File(TEST_PATH + "from.itn"), formats);
    assertTrue(result2.isSuccessful());
    assertEquals(0, result2.getTheRoute().getPositions().size());
    assertEquals(1, result2.getAllRoutes().size());
    assertEquals(result2.getFormat().getClass(), TomTom8RouteFormat.class);

    formats.add(new TomTom5RouteFormat());
    ParserResult result3 = parser.read(new File(TEST_PATH + "from.itn"), formats);
    assertTrue(result3.isSuccessful());
    assertEquals(46, result3.getTheRoute().getPositions().size());
    assertEquals(1, result3.getAllRoutes().size());
    assertEquals(result3.getFormat().getClass(), TomTom5RouteFormat.class);
  }