/** * Test method for 'undoAction()' for accuracy. * * <p>Verify redoAction() will remove the ActivityDiagram and the ActivityGraph to the * UMLModelManager instance. * * @throws Exception to Junit */ public void testUndoAction() throws Exception { action.executeAction(); action.undoAction(); assertTrue( "The ActivityGraph list should be empty.", UML_MODEL_MANAGER.getActivityGraphs().isEmpty()); assertTrue("The diagram list should be empty.", UML_MODEL_MANAGER.getDiagrams().isEmpty()); }
/** * Validate that the ActivityDiagram and the ActivityGraph are added to the UMLModelManager * instance. */ private void validateActivityDiagram() { ActivityGraph activityGraph = UML_MODEL_MANAGER.getActivityGraphs().get(0); assertNotNull("The ActivityGraph should not be null.", activityGraph); Diagram diagram = UML_MODEL_MANAGER.getDiagrams().get(0); assertNotNull("The diagram should not be null.", diagram); // check the owner Uml1SemanticModelBridge modelBridge = (Uml1SemanticModelBridge) diagram.getOwner(); assertNotNull("The Uml1SemanticModelBridge should not be null.", modelBridge); assertSame("The owner is incorrect.", activityGraph, modelBridge.getElement()); }
/** * Test constructor for 'CreateActivityDiagramAction(Element, String)' for accuracy. * * <p>It tests the case that the owner is null and verifies that * CreateActivityDiagramAction(Element, String) is correct. Set the context of the Activity Graph * to a new use case element added directly to the Model. * * @throws Exception to Junit */ public void testCreateActivityDiagramActionWithNullOwner() throws Exception { action = new CreateActivityDiagramAction(null, NAME); action.executeAction(); ModelElement element = UML_MODEL_MANAGER.getModel().getOwnedElements().iterator().next(); assertTrue("The ModelElement should be of UseCaseImpl type.", element instanceof UseCaseImpl); ActivityGraph activityGraph = UML_MODEL_MANAGER.getActivityGraphs().get(0); assertSame("The ModelElement should be the same", element, activityGraph.getContext()); State state = activityGraph.getTop(); assertNotNull("The top state should not be null.", state); assertTrue( "The top state should be of CompositeStateImpl type.", state instanceof CompositeStateImpl); }
/** * Tests constructor for 'CreateActivityDiagramAction(Element, String)' for accuracy. * * <p>Verify that CreateActivityDiagramAction(Element, String) is correct. * * @throws Exception to Junit */ public void testCreateActivityDiagramAction() throws Exception { assertNotNull("The CreateActivityDiagramAction instance should not be null.", action); action.executeAction(); ActivityGraph activityGraph = UML_MODEL_MANAGER.getActivityGraphs().get(0); assertSame("The owner ModelElement should be the same", owner, activityGraph.getContext()); State state = activityGraph.getTop(); assertNotNull("The top state should not be null.", state); assertTrue( "The top state should be of CompositeStateImpl type.", state instanceof CompositeStateImpl); }