/**
   * This method will check the action's name and type value.
   *
   * @param action the action instance to be checked.
   * @param name the name of action.
   * @param type the type of action.
   * @throws Exception if any exception occurs when testing.
   */
  private void checkCreateDiagramAction(CreateDiagramAction action, String name, String type)
      throws Exception {
    // check the attributes here.
    assertNotNull("The CreateDiagramAction constructor is incorrect.", action);

    // add the diagram into UMLModelManager.
    action.execute();

    // check the diagram here.
    Diagram diagram = UMLModelManager.getInstance().getDiagrams().get(0);
    assertEquals("The CreateDiagramAction constructor is incorrect.", diagram.getName(), name);

    Uml1SemanticModelBridge modelBridge = (Uml1SemanticModelBridge) diagram.getOwner();
    assertEquals(
        "The CreateDiagramAction constructor is incorrect.", modelBridge.getElement(), owner);
    /*
     * BugFix: UML-9507
     */
    //        assertEquals("The CreateDiagramAction constructor is incorrect.",
    //            StressTestHelper.findTypePropertyValue(diagram), type);
    assertEquals(
        "The CreateDiagramAction constructor is incorrect.",
        StressTestHelper.getTypeInfo(diagram),
        type);

    // remove the diagram from UMLModelManager.
    action.undo();
  }
 /**
  * Set up environment.
  *
  * @throws Exception to JUnit
  */
 public void setUp() throws Exception {
   UnitTestHelper.loadConfig(UnitTestHelper.CONFIG_FILE);
   this.commentGraphNode = new GraphNode();
   Uml1SemanticModelBridge usmb = new Uml1SemanticModelBridge();
   usmb.setElement(new CommentImpl());
   this.commentGraphNode.setSemanticModel(usmb);
   this.diagram = new Diagram();
   this.action = new PasteCommentGraphNodeAction(this.commentGraphNode, this.diagram);
 }
 /**
  * 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());
 }
 /**
  * Setup test environment.
  *
  * @throws Exception to JUnit
  */
 protected void setUp() throws Exception {
   TestHelper.loadXMLConfig(TestHelper.CONFIG_FILE);
   mapping = new PropertyMapping(VALID_NAMESPACE);
   graphNode = new GraphNode();
   usmb = new Uml1SemanticModelBridge();
   usmb.setElement(new CommentImpl());
   graphNode.setSemanticModel(usmb);
   graphNode.setPosition(new com.topcoder.diagraminterchange.Point());
   graphNode.setSize(new com.topcoder.diagraminterchange.Dimension());
   node = new CommentNode(graphNode, mapping);
   connector = new CommentConnector(node);
 }