layer.getMapInternal().getEditManagerInternal().commitTransaction();
FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
FeatureSource<SimpleFeatureType, SimpleFeature> resource = layer.getResource(FeatureSource.class, new NullProgressMonitor());
Id id = filterFactory.id(FeatureUtils.stringToId(filterFactory, feature.getID()));
feature=resource.getFeatures(id).features().next();
Id id2 = filterFactory.id(FeatureUtils.stringToId(filterFactory, feature2.getID()));
feature2=resource.getFeatures(id2).features().next();
assertTrue(feature.getDefaultGeometry() instanceof LineString);
assertTrue(feature2.getDefaultGeometry() instanceof Polygon);