/*
* Test method for 'org.locationtech.udig.tools.edit.behaviour.SetGeomCommand.run(IProgressMonitor)'
*/
@Test
public void testRun() throws Exception {
IEditManager editManager = handler.getContext().getEditManager();
assertEquals("Does the ID match",feature.getID(), editManager.getEditFeature().getID());
assertEquals("Is the feature equal",feature.getDefaultGeometry(), editManager.getEditFeature().getDefaultGeometry());
assertEquals("Is the layer equal",layer, editManager.getEditLayer());
SelectFeatureAsEditFeatureCommand command = new SelectFeatureAsEditFeatureCommand(handler, feature2, layer, Point.valueOf(10,10));
handler.getContext().sendSyncCommand(command);
assertEquals(handler.getEditBlackboard().getGeoms().get(0), handler.getCurrentGeom());
assertEquals(handler.getEditBlackboard().getGeoms().get(0).getShell(), handler.getCurrentShape());
assertEquals(EditState.MODIFYING, handler.getCurrentState());
assertFalse(bb.getGeoms().contains(editGeom));
assertFalse(bb.getGeoms().contains(editGeom2));
assertEquals(feature2.getDefaultGeometry(), editManager.getEditFeature().getDefaultGeometry());
assertEquals( feature2.getID(), handler.getCurrentGeom().getFeatureIDRef().get());
((CommandManager)((Map)handler.getContext().getMap()).getCommandStack()).undo(false);
command.rollback(new NullProgressMonitor());
assertEquals(editGeom2.getShell().getPoint(0), handler.getCurrentGeom().getShell().getPoint(0));
assertEquals(editGeom2.getShell().getPoint(1), handler.getCurrentGeom().getShell().getPoint(1));
assertEquals(hole.getPoint(0), handler.getCurrentShape().getPoint(0));
assertEquals(hole.getPoint(1), handler.getCurrentShape().getPoint(1));
assertTrue(handler.getCurrentGeom().getHoles().contains(handler.getCurrentShape()));
assertEquals(EditState.CREATING, handler.getCurrentState());
assertEquals(2, bb.getGeoms().size());
assertEquals( editGeom2.getFeatureIDRef().get(), handler.getCurrentGeom().getFeatureIDRef().get());
assertEquals(feature.getDefaultGeometry(), editManager.getEditFeature().getDefaultGeometry());
assertEquals(layer, editManager.getEditLayer());
}