### Question:
CoordinatePath implements Iterator<Coordinate> { public static CoordinatePath create(Geometry g) { if (g == null || g.isEmpty()) { return new EmptyPath(g); } switch(Geom.Type.from(g)) { case POINT: return new PointPath((Point) g); case LINESTRING: return new LineStringPath((LineString)g); case POLYGON: return new PolygonPath((Polygon)g); case MULTIPOINT: case MULTILINESTRING: case MULTIPOLYGON: case GEOMETRYCOLLECTION: return new GeometryCollectionPath((GeometryCollection) g); default: throw new IllegalArgumentException("Unsupported type: " + g); } } protected  CoordinatePath(); static CoordinatePath create(Geometry g); CoordinatePath generalize(double dx, double dy); CoordinatePath transform(CoordinateFilter tx); abstract Geometry geometry(); Coordinate coordinate(); PathStep step(); @Override boolean hasNext(); @Override Coordinate next(); void reset(); @Override void remove();  }### Answer:
@Test public void testLineString() { LineString l = gb.points(1,2,3,4,5,6).toLineString(); CoordinatePath li = CoordinatePath.create(l); assertSequence(li, 1,2,MOVE_TO, 3,4,LINE_TO, 5,6,LINE_TO); }
@Test public void testPolygon() { Polygon p = gb.points(1,2,3,4,5,6,1,2).ring().toPolygon(); CoordinatePath pi = CoordinatePath.create(p); assertSequence(pi, 1,2,MOVE_TO, 3,4,LINE_TO, 5,6,LINE_TO, 1,2,CLOSE); }
@Test public void testPolygonWithHole() { Polygon p = gb.points(0,0,10,0,10,10,0,10,0,0).ring() .points(2,2,8,2,8,8,2,8,2,2).ring().toPolygon(); CoordinatePath pi = CoordinatePath.create(p); assertSequence(pi, 0,0,MOVE_TO, 10,0,LINE_TO, 10,10,LINE_TO, 0,10,LINE_TO, 0,0,CLOSE, 2,2,MOVE_TO, 8,2,LINE_TO, 8,8,LINE_TO, 2,8,LINE_TO, 2,2,CLOSE); }
@Test public void testMultiPoint() throws Exception { MultiPoint mp = gb.points(1,1, 2,2, 3,3).toMultiPoint(); CoordinatePath mpi = CoordinatePath.create(mp); assertSequence(mpi, 1,1,MOVE_TO, 2,2,MOVE_TO, 3,3,MOVE_TO); }
@Test public void testGeometryCollection() { GeometryCollection gcol = gb.points(1,2,3,4,5,6,1,2).ring().polygon() .points(1,2,3,4,5,6).lineString() .point(1,2).point().toCollection(); CoordinatePath gci = CoordinatePath.create(gcol); assertSequence(gci, 1,2,MOVE_TO, 3,4,LINE_TO, 5,6,LINE_TO, 1,2,CLOSE, 1,2,MOVE_TO, 3,4,LINE_TO, 5,6,LINE_TO, 1, 2, MOVE_TO); }