@Test
 public void testFindURL() {
   String url = format.findURL(INPUT1_EMAIL);
   assertNotNull(url);
   assertTrue(url.startsWith("?f=d"));
   assertNull(format.findURL("don't care"));
 }
 private List<Wgs84Position> parsePositions(String text) {
   String url = format.findURL(text);
   if (url.startsWith("/dir/")) {
     return format.parsePositions(url.substring(5));
   } else {
     Map<String, List<String>> parameters = format.parseURLParameters(url, "UTF-8");
     return format.parsePositions(parameters);
   }
 }
 @Test
 public void testParseDestinationPosition() {
   Wgs84Position position =
       format.parseCommentPosition("L339/Wuppertaler Strasse @50.918890,7.560880 ");
   assertDoubleEquals(7.560880, position.getLongitude());
   assertDoubleEquals(50.918890, position.getLatitude());
   assertEquals("L339/Wuppertaler Strasse", position.getDescription());
 }
 @Test
 public void testCreateURL() {
   List<Wgs84Position> positions = new ArrayList<>();
   positions.add(new Wgs84Position(10.02571156, 53.57497745, null, 5.5, null, "Hamburg, Germany"));
   positions.add(
       new Wgs84Position(10.20026067, 53.57662034, null, 4.5, null, "Stemwarde, Germany"));
   positions.add(
       new Wgs84Position(10.35735078, 53.59171021, null, 3.5, null, "Gro\u00dfensee, Germany"));
   positions.add(new Wgs84Position(10.45696089, 53.64781001, null, 2.5, null, "Linau, Germany"));
   String expected =
       "http://maps.google.com/maps?ie=UTF8&saddr=Hamburg,+Germany%4053.574977,10.025711&daddr=Stemwarde,+Germany%4053.576620,10.200260+to:Gro%C3%9Fensee,+Germany%4053.591710,10.357350+to:Linau,+Germany%4053.647810,10.456960";
   String actual = format.createURL(positions, 0, positions.size());
   assertEquals(expected, actual);
 }
 @Test
 public void testParseDestinationPositions() {
   List<Wgs84Position> positions =
       format.parseDestinationPositions(
           "L339/Wuppertaler Strasse @50.918890,7.560880 to: B @ -1.1 , -2.2to:[email protected],4.4");
   assertEquals(3, positions.size());
   Wgs84Position position1 = positions.get(0);
   assertDoubleEquals(7.560880, position1.getLongitude());
   assertDoubleEquals(50.918890, position1.getLatitude());
   assertEquals("L339/Wuppertaler Strasse", position1.getDescription());
   Wgs84Position position2 = positions.get(1);
   assertDoubleEquals(-2.2, position2.getLongitude());
   assertDoubleEquals(-1.1, position2.getLatitude());
   assertEquals("B", position2.getDescription());
   Wgs84Position position3 = positions.get(2);
   assertDoubleEquals(4.4, position3.getLongitude());
   assertDoubleEquals(3.3, position3.getLatitude());
   assertEquals("C", position3.getDescription());
 }
 @Test
 public void testParseNegativeStartPosition() {
   Wgs84Position position = format.parsePlainPosition("-50.954318,-7.311401");
   assertDoubleEquals(-7.311401, position.getLongitude());
   assertDoubleEquals(-50.954318, position.getLatitude());
 }