Beispiel #1
0
 /** Test the parsing of a bound element as returned by the OSM API with an origin. */
 @Test
 public void testBoundsWithOrigin() {
   parseString(
       OSM_PREFIX
           + "<bounds minlat=\"-1\" minlon=\"-1\" maxlat=\"1\" maxlon=\"1\" "
           + " origin=\"someorigin\"/>"
           + OSM_SUFFIX);
   Bound b = (Bound) entityInspector.getLastEntityContainer().getEntity();
   assertEquals("someorigin", b.getOrigin());
 }
Beispiel #2
0
 /** Test the inheritance of generator to the origin. */
 @Test
 public void testBoundsOriginInheritance() {
   parseString(
       "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
           + "<osm version=\"0.6\" generator=\"somegenerator\">"
           + "<bounds minlat=\"-1.234\" minlon=\"-1.234\" maxlat=\"1.234\" maxlon=\"1.234\"/>"
           + "</osm>");
   Bound b = (Bound) entityInspector.getLastEntityContainer().getEntity();
   assertEquals("somegenerator", b.getOrigin());
 }
Beispiel #3
0
 /** Test the parsing of a bound element as returned by the OSM API without an origin. */
 @Test
 public void testBoundsNoOrigin() {
   parseString(
       OSM_PREFIX
           + "<bounds minlat=\"-1.234\" minlon=\"-1.234\" maxlat=\"1.234\" maxlon=\"1.234\"/>"
           + OSM_SUFFIX);
   Bound b = (Bound) entityInspector.getLastEntityContainer().getEntity();
   assertEquals(-1.234, b.getLeft(), 1E-6);
   assertEquals(-1.234, b.getBottom(), 1E-6);
   assertEquals(1.234, b.getRight(), 1E-6);
   assertEquals(1.234, b.getTop(), 1E-6);
   assertNull(b.getOrigin());
 }
Beispiel #4
0
 /** Test a normal, well-formed bound element. */
 @Test
 public final void testBoundElement1() {
   parseString(
       OSM_PREFIX
           + "<bound box=\"-12.34567,-23.45678,34.56789,45.67891\""
           + " origin=\"someorigin\"/>"
           + OSM_SUFFIX);
   Bound b = (Bound) entityInspector.getLastEntityContainer().getEntity();
   assertTrue(
       Double.compare(b.getRight(), 45.67891) == 0
           && Double.compare(b.getLeft(), -23.45678) == 0
           && Double.compare(b.getTop(), 34.56789) == 0
           && Double.compare(b.getBottom(), -12.34567) == 0);
   assertTrue(b.getOrigin().equals("someorigin"));
 }
Beispiel #5
0
 /** Tests that an empty xml document can be parsed successfully. */
 @Test
 public final void testEmptyDocument() {
   parseString(OSM_PREFIX + OSM_SUFFIX);
   assertNull(entityInspector.getLastEntityContainer());
 }