IMap map=MapTests.createDefaultMap("name", 1, true, new Dimension(10,10)); //$NON-NLS-1$
ILayer layer=map.getMapLayers().get(0);
FeatureCollection<SimpleFeatureType, SimpleFeature> collection = layer.getResource(FeatureSource.class, null).getFeatures();
SimpleFeature feature=collection.features().next();
IIssue original=new FeatureIssue(Priority.WARNING, "test description", layer, feature, "groupID"); //$NON-NLS-1$ //$NON-NLS-2$
XMLMemento memento=XMLMemento.createWriteRoot("memento"); //$NON-NLS-1$
XMLMemento viewMemento=XMLMemento.createWriteRoot("viewMemento"); //$NON-NLS-1$
original.save(memento);
original.getViewMemento(viewMemento);
FeatureIssue restored=new FeatureIssue();
restored.init(memento, viewMemento, original.getId(), original.getGroupId(), original.getBounds());
restored.setDescription(original.getDescription());
restored.setPriority(original.getPriority());
restored.setResolution(original.getResolution());
assertEquals(original.getBounds(), restored.getBounds());
assertEquals(original.getDescription(), restored.getDescription());
assertEquals(original.getEditorID(), restored.getEditorID());
assertEquals(original.getEditorInput(), restored.getEditorInput());
assertEquals(original.getExtensionID(), restored.getExtensionID());
assertEquals(original.getGroupId(), restored.getGroupId());
assertEquals(original.getId(), restored.getId());
assertEquals(original.getPerspectiveID(), restored.getPerspectiveID());
assertEquals(original.getPriority(), restored.getPriority());
assertEquals(original.getProblemObject(), restored.getProblemObject());
for( int i = 0; i < original.getPropertyNames().length; i++ ) {
assertEquals(original.getPropertyNames()[i], restored.getPropertyNames()[i]);
}
assertEquals(original.getResolution(), restored.getResolution());
assertEquals(original.getViewPartId(), restored.getViewPartId());
}