CreateNewOrSelectExitingFeatureCommand command=new CreateNewOrSelectExitingFeatureCommand("newID", layer, fac.createPoint(new Coordinate(10,10))); //$NON-NLS-1$
command.setMap(map);
NullProgressMonitor nullProgressMonitor = new NullProgressMonitor();
command.run(nullProgressMonitor);
FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
Filter filter = filterFactory.id(FeatureUtils.stringToId(filterFactory, original.getID()));
filter = filterFactory.not(filter);
SimpleFeature feature=resource.getFeatures(
filter).features().next();
assertEquals(2, getCount());
assertEquals(new Coordinate(10,10), ((Geometry) feature.getDefaultGeometry()).getCoordinates()[0]);
assertFalse( feature.getID().equals(original));
command.rollback(nullProgressMonitor);
assertEquals(1, getCount());
feature=resource.getFeatures(filterFactory.id(FeatureUtils.stringToId(filterFactory,original.getID()))).features().next();
assertEquals(original.getID(), feature.getID());
assertFalse( new Coordinate(10,10).equals(((Geometry) feature.getDefaultGeometry()).getCoordinates()[0] ));
}