@Test
public void testShapeFileWriterWithSelfCreatedContent_withMatsimFactory_Polygon() throws IOException {
String outFile = utils.getOutputDirectory() + "test.shp";
PolygonFeatureFactory ff = new PolygonFeatureFactory.Builder()
.setName("EvacuationArea")
.setCrs(DefaultGeographicCRS.WGS84)
.addAttribute("name", String.class)
.create();
Coordinate[] coordinates = new Coordinate[]{new Coordinate(0,0),new Coordinate(0,1),new Coordinate(1,1),new Coordinate(0,0)};
SimpleFeature f = ff.createPolygon(coordinates);
Collection<SimpleFeature> features = new ArrayList<SimpleFeature>();
features.add(f);
Geometry g0 = (Geometry) f.getDefaultGeometry();
ShapeFileWriter.writeGeometries(features, outFile);
SimpleFeatureSource s1 = ShapeFileReader.readDataFile(outFile);
SimpleFeatureCollection fts1 = s1.getFeatures();
SimpleFeatureIterator it1 = fts1.features();
SimpleFeature ft1 = it1.next();
Geometry g1 = (Geometry) ft1.getDefaultGeometry();
Assert.assertEquals(g0.getCoordinates().length, g1.getCoordinates().length);
}