use of com.archimatetool.help.cheatsheets.CreateMapViewCheatSheetAction.NewMapViewCommand in project archi by archimatetool.
the class CreateMapViewCheatSheetActionTests method testNewMapViewCommand.
@Test
public void testNewMapViewCommand() throws IOException {
// Load ArchiMate model
ArchimateTestModel tm = new ArchimateTestModel(TestData.TEST_MODEL_FILE_ARCHISURANCE);
IArchimateModel model = tm.loadModel();
// Has 17 diagrams
assertEquals(17, model.getDiagramModels().size());
NewMapViewCommand cmd = new NewMapViewCommand(model);
cmd.execute();
assertNotNull(cmd.diagramModel);
assertNotNull(cmd.diagramModel.eContainer());
// Model now has 18 diagrams
assertEquals(18, model.getDiagramModels().size());
// New diagram has 17 children...
assertEquals(17, cmd.diagramModel.getChildren().size());
// ...all of which are IDiagramModelReference types with IDs
for (IDiagramModelObject dmo : cmd.diagramModel.getChildren()) {
assertTrue(dmo instanceof IDiagramModelReference);
assertNotNull(dmo.getId());
}
// Undo
cmd.undo();
assertEquals(17, model.getDiagramModels().size());
assertNull(cmd.diagramModel.eContainer());
}
Aggregations