/** * 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); }
/** * 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); }