OGCConfiguration configuration = new OGCConfiguration();
configuration.getProperties().add(Properties.IGNORE_SCHEMA_LOCATION);
Parser parser = new Parser(configuration);
DWithin filter = (DWithin) parser.parse(new ByteArrayInputStream(xml.getBytes()));
assertNotNull(filter);
//Asserting the Property Name
assertNotNull(filter.getExpression1());
PropertyName propName = (PropertyName) filter.getExpression1();
String name = propName.getPropertyName();
assertEquals("the_geom", name);
//Asserting the Geometry
assertNotNull(filter.getExpression2());
Literal geom = (Literal) filter.getExpression2();
assertEquals("POINT (-74.817265 40.5296504)", geom.toString());
//Asserting the Distance
assertTrue(filter.getDistance() > 0 );
Double dist = filter.getDistance();
assertEquals(200.0, dist);
//Asserting the Distance Units
assertNotNull(filter.getDistanceUnits());
String unit = filter.getDistanceUnits();
assertEquals("km", unit);
}