ShapeInMemLayer extends FeatureSourceRetriever implements VectorLayer { @Override public Object create(Object feature) throws LayerException { String id = featureModel.getId(feature); if (id != null && !features.containsKey(id)) { SimpleFeature realFeature = asFeature(feature); features.put(id, realFeature); return realFeature; } return null; }  @Override String getId(); void setId(String id); @Override CoordinateReferenceSystem getCrs(); @Api void setLayerInfo(VectorLayerInfo layerInfo); @Override VectorLayerInfo getLayerInfo(); @Override boolean isCreateCapable(); @Override boolean isUpdateCapable(); @Override boolean isDeleteCapable(); @Api void setUrl(String url); Iterator<?> getElements(Filter filter, int offset, int maxResultSize); @Override Envelope getBounds(); Envelope getBounds(Filter filter); @Override FeatureModel getFeatureModel(); @Override Object create(Object feature); @Override Object read(String featureId); @Override Object saveOrUpdate(Object feature); @Override void delete(String featureId);  }
@Test public void create() throws ParseException, LayerException { Object created = null; WKTReader wktReader = new WKTReader(); Point geometry = null; geometry = (Point) wktReader.read("POINT (0 0)"); Object feature = (SimpleFeature)layer.getFeatureModel().newInstance("500"); Map<String, Attribute> map = new HashMap<String, Attribute>(); map.put("NAME", new StringAttribute("Tsjakamaka")); map.put("POP_OTHER", new IntegerAttribute(342)); layer.getFeatureModel().setAttributes(feature, map); layer.getFeatureModel().setGeometry(feature, geometry); created = layer.create(feature); Assert.assertNotNull(created); }