public void testReadComment() throws IOException {
   StringWriter writer = new StringWriter();
   format.write(route, new PrintWriter(writer), 0, 2);
   List<BcrRoute> routes =
       format.read(
           new BufferedReader(new StringReader(writer.toString())),
           null,
           BcrFormat.DEFAULT_ENCODING);
   assertEquals(1, routes.size());
   BcrRoute route = routes.get(0);
   List<BcrPosition> positions = route.getPositions();
   assertEquals(2, positions.size());
   BcrPosition position1 = positions.get(0);
   assertEquals("Start", position1.getComment());
   BcrPosition position2 = positions.get(1);
   assertEquals("End", position2.getComment());
 }
 public void testParsePositionFromMotorradTourenplaner() {
   BcrPosition position =
       format.parsePosition("Standort,999999999", "1115508,7081108", "Großensee/Schwarzeka,,@,0,");
   assertNull(position.getZipCode());
   assertEquals("Großensee/Schwarzeka", position.getCity());
   assertEquals(BcrPosition.STREET_DEFINES_CENTER_NAME, position.getStreet());
   assertEquals("0", position.getType());
   assertFalse(position.isUnstructured());
 }
 public void testParsePositionFromITNConv() {
   BcrPosition position =
       format.parsePosition("Standort,999999999", "1115508,7081108", "Hamburg/Uhlenhorst");
   assertEquals(999999999, position.getAltitude());
   assertEquals(1115508, position.getX());
   assertEquals(7081108, position.getY());
   assertNull(position.getZipCode());
   assertEquals("Hamburg/Uhlenhorst", position.getCity());
   assertNull(position.getStreet());
   assertNull(position.getType());
   assertTrue(position.isUnstructured());
 }
 public void testParsePosition() {
   BcrPosition position =
       format.parsePosition(
           "Standort,999999999", "1139093,7081574", "bei D 22885,Barsbüttel/Stemwarde,,0,");
   assertEquals(999999999, position.getAltitude());
   assertEquals(1139093, position.getX());
   assertEquals(7081574, position.getY());
   assertEquals("bei D 22885", position.getZipCode());
   assertEquals("Barsbüttel/Stemwarde", position.getCity());
   assertNull(position.getStreet());
   assertEquals("0", position.getType());
   assertFalse(position.isUnstructured());
 }
 public void testParsePositionFromMTP20082009() {
   BcrPosition position =
       format.parsePosition(
           "TOWN,210945415755,1", "1115508,7081108", "D 22081,Hamburg/Uhlenhorst,Finkenau,0,");
   assertEquals(210945415755L, position.getAltitude());
   assertEquals(1115508, position.getX());
   assertEquals(7081108, position.getY());
   assertEquals("D 22081", position.getZipCode());
   assertEquals("Hamburg/Uhlenhorst", position.getCity());
   assertEquals("Finkenau", position.getStreet());
   assertEquals("0", position.getType());
   assertFalse(position.isUnstructured());
 }
 public void testParseNegativePosition() {
   BcrPosition position =
       format.parsePosition(
           "Standort,999999999", "-449242,6182322", "bei F 29400,Lampaul Guimiliau,@,0,");
   assertEquals("bei F 29400", position.getZipCode());
   assertEquals("Lampaul Guimiliau", position.getCity());
   assertEquals(BcrPosition.STREET_DEFINES_CENTER_NAME, position.getStreet());
   assertEquals("0", position.getType());
   assertFalse(position.isUnstructured());
   assertEquals(BcrPosition.NO_ALTITUDE_DEFINED, position.getAltitude());
   assertEquals(-449242, position.getX());
   assertEquals(6182322, position.getY());
 }
 public void testSetComment() {
   BcrPosition position = format.parsePosition("TOWN,210845415855", "2115508,9081108", null);
   assertEquals(210845415855L, position.getAltitude());
   assertEquals(2115508, position.getX());
   assertEquals(9081108, position.getY());
   assertNull(position.getZipCode());
   assertNull(position.getCity());
   assertNull(position.getStreet());
   assertNull(position.getType());
   assertNull(position.getComment());
   assertTrue(position.isUnstructured());
   position.setComment(null);
   assertNull(position.getComment());
 }
 public void testSetLongitudeAndLatitudeAndElevation() {
   BcrPosition position = format.parsePosition("TOWN,210945416161", "2115508,9081108", null);
   assertEquals(2115508, position.getX());
   assertEquals(9081108, position.getY());
   assertEquals(55.52, position.getElevation());
   position.setLongitude(19.02522);
   position.setLatitude(62.963395);
   position.setElevation(14.42);
   assertEquals(2115508, position.getX());
   assertEquals(9081108, position.getY());
   assertEquals(19.02522, position.getLongitude());
   assertEquals(62.96339, position.getLatitude());
   assertEquals(14.42, position.getElevation());
   position.setLongitude(null);
   position.setLatitude(null);
   position.setElevation(null);
   assertNull(position.getX());
   assertNull(position.getY());
   assertNull(position.getLongitude());
   assertNull(position.getLatitude());
   assertNull(position.getElevation());
 }
  public void testIsSectionTitle() {
    assertTrue(format.isSectionTitle("[CLIENT]"));
    assertTrue(format.isSectionTitle("[COORDINATES]"));
    assertTrue(format.isSectionTitle("[DESCRIPTION]"));
    assertTrue(format.isSectionTitle("[ROUTE]"));

    assertFalse(format.isSectionTitle(" [COORDINATES]"));
    assertFalse(format.isSectionTitle("[DESCRIPTION] "));
    assertFalse(format.isSectionTitle(" [ROUTE] "));
    assertFalse(format.isSectionTitle("[[ROUTE]"));
    assertFalse(format.isSectionTitle("ROUTE]"));
    assertFalse(format.isSectionTitle("[NEW]"));

    assertFalse(format.isSectionTitle("[Egal]"));
    assertFalse(format.isSectionTitle("[Symbol 1]"));
    assertFalse(format.isSectionTitle("[Symbol 12]"));
    assertFalse(format.isSectionTitle("[Symbol 123]"));
    assertFalse(format.isSectionTitle("[Symbol 1234]"));
    assertFalse(format.isSectionTitle("[Overlay]"));
    assertFalse(format.isSectionTitle("[MapLage]"));
  }
 public void testWriteComment() {
   StringWriter writer = new StringWriter();
   format.write(route, new PrintWriter(writer), 0, 2);
   assertTrue(writer.toString().contains("STATION1=Start"));
   assertTrue(writer.toString().contains("STATION2=End"));
 }