コード例 #1
0
 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());
 }
コード例 #2
0
 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());
 }
コード例 #3
0
 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());
 }
コード例 #4
0
 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());
 }
コード例 #5
0
 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());
 }
コード例 #6
0
 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());
 }
コード例 #7
0
 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());
 }
コード例 #8
0
 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());
 }
コード例 #9
0
  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]"));
  }
コード例 #10
0
 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"));
 }