Search in sources :

Example 1 with NewMapViewCommand

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());
}
Also used : IDiagramModelReference(com.archimatetool.model.IDiagramModelReference) NewMapViewCommand(com.archimatetool.help.cheatsheets.CreateMapViewCheatSheetAction.NewMapViewCommand) IDiagramModelObject(com.archimatetool.model.IDiagramModelObject) IArchimateModel(com.archimatetool.model.IArchimateModel) ArchimateTestModel(com.archimatetool.testingtools.ArchimateTestModel) Test(org.junit.Test)

Aggregations

NewMapViewCommand (com.archimatetool.help.cheatsheets.CreateMapViewCheatSheetAction.NewMapViewCommand)1 IArchimateModel (com.archimatetool.model.IArchimateModel)1 IDiagramModelObject (com.archimatetool.model.IDiagramModelObject)1 IDiagramModelReference (com.archimatetool.model.IDiagramModelReference)1 ArchimateTestModel (com.archimatetool.testingtools.ArchimateTestModel)1 Test (org.junit.Test)1