PlainFeatureFactory { public static SimpleFeature createPlainFeature(SimpleFeatureType type, String id, Geometry geometry, String styleCSS) { SimpleFeatureBuilder sfb = new SimpleFeatureBuilder(type); sfb.set(ATTRIB_NAME_GEOMETRY, geometry); sfb.set(ATTRIB_NAME_STYLE_CSS, styleCSS); return sfb.buildFeature(id); }  static SimpleFeatureType createDefaultFeatureType(); static SimpleFeatureType createDefaultFeatureType(CoordinateReferenceSystem crs); static SimpleFeatureType createPlainFeatureType(String typeName,
                                                           Class<? extends Geometry> geometryType,
                                                           CoordinateReferenceSystem crs); static SimpleFeature createPlainFeature(SimpleFeatureType type, String id, Geometry geometry, String styleCSS); static final String DEFAULT_TYPE_NAME; static final String ATTRIB_NAME_GEOMETRY; static final String ATTRIB_NAME_STYLE_CSS; }
@Test public void testCreatePlainFeature() { SimpleFeatureType sft = PlainFeatureFactory.createPlainFeatureType("MyPoint", Point.class, DefaultGeographicCRS.WGS84); final GeometryFactory gf = new GeometryFactory(); final Point point = gf.createPoint(new Coordinate(0.5, 0.6)); final SimpleFeature feature1 = PlainFeatureFactory.createPlainFeature(sft, "_1", point, "fill:#0033AA"); assertEquals("_1", feature1.getID()); assertEquals(point, feature1.getDefaultGeometry()); assertEquals(point, feature1.getAttribute(PlainFeatureFactory.ATTRIB_NAME_GEOMETRY)); assertEquals("fill:#0033AA", feature1.getAttribute(PlainFeatureFactory.ATTRIB_NAME_STYLE_CSS)); SimpleFeature feature2 = PlainFeatureFactory.createPlainFeature(sft, "_2", null, "fill:#0033AA"); assertNotNull(feature2.getDefaultGeometry()); assertTrue(gf.createPoint(new Coordinate()).compareTo(feature2.getDefaultGeometry()) == 0); final SimpleFeature feature3 = PlainFeatureFactory.createPlainFeature(sft, "_3", point, null); assertEquals(null, feature3.getAttribute(PlainFeatureFactory.ATTRIB_NAME_STYLE_CSS)); }