/**
  * 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());
 }
 /**
  * Test constructor for 'CreateActivityDiagramAction(Element, String)' for accuracy.
  *
  * <p>It tests the case that the name is null and verify that CreateActivityDiagramAction(Element,
  * String) is correct.
  */
 public void testCreateActivityDiagramActionWithNullName() {
   CreateActivityDiagramAction activityAction = new CreateActivityDiagramAction(owner, null);
   assertNotNull("The CreateActivityDiagramAction instance should not be null.", activityAction);
   assertEquals(
       "The presentation name is incorrect.",
       "Create activity diagram untitled",
       activityAction.getPresentationName());
 }
 /**
  * Tests the {@link CreateActivityDiagramAction#executeAction()} method.
  *
  * <p>Calling the execute twice.
  *
  * <p>{@link ActionExecutionException} Expected.
  *
  * @throws Exception Any exception to JUnit.
  */
 public void testFailureexecuteAction() throws Exception {
   try {
     createActivityDiagramAction.executeAction();
     createActivityDiagramAction.executeAction();
     fail("ActionExecutionException Expected.");
   } catch (ActionExecutionException e) {
     // As expected.
   }
 }
 /**
  * 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);
 }
 /**
  * Test method for 'redoAction()' for accuracy.
  *
  * <p>Verify redoAction() will add again the ActivityDiagram and the ActivityGraph to the
  * UMLModelManager instance.
  *
  * @throws Exception to Junit
  */
 public void testRedoAction() throws Exception {
   action.executeAction();
   action.undoAction();
   action.redoAction();
   validateActivityDiagram();
 }
 /**
  * Test method for 'executeAction()' for accuracy.
  *
  * <p>Verify executeAction() will add the ActivityDiagram and the ActivityGraph to the
  * UMLModelManager instance.
  *
  * @throws Exception to Junit
  */
 public void testExecuteAction() throws Exception {
   action.executeAction();
   validateActivityDiagram();
 }
 /**
  * Test constructor for 'CreateActivityDiagramAction(Element, String)' for accuracy.
  *
  * <p>Verify that the PresentationName is correct.
  */
 public void testCreateActivityDiagramActionForPresentationName() {
   assertEquals(
       "The PresentationName is incorrect.",
       "Create activity diagram " + NAME,
       action.getPresentationName());
 }