/** The accuracy test for the method {@link ZUMLFlowFinalNodeImpl#convertToTCUML()}. */
  public void testConvertToTCUML() {
    ZUMLFlowFinalNodeImpl instance = new ZUMLFlowFinalNodeImpl();
    instance.setName("final");

    Namespace namespace = new CollaborationImpl();
    instance.setNamespace(namespace);

    instance.setVisibility(null);
    instance.setSpecification(true);

    ModelElement element = instance.convertToTCUML();

    assertTrue(element instanceof FinalState);

    assertEquals(1, element.getTaggedValues().size());

    TaggedValue taggedValue = (TaggedValue) element.getTaggedValues().toArray()[0];
    assertEquals("FlowFinalNode", taggedValue.getDataValue());
    assertEquals("FinalNodeType", taggedValue.getType().getTagType());

    // Verify that the simple attributes are copied.
    assertEquals("final", element.getName());
    assertEquals(namespace, element.getNamespace());
    assertNull(element.getVisibility());
    assertTrue(element.isSpecification());
  }
  /**
   * Test <code>{@link UsecaseToolUtil#copyModelElementAttributes(ModelElement, ModelElement)}
   * </code> with success process.
   */
  public void testCopyModelElementAttributes_ModelElementModelElement_Success() {
    ModelElement newElement = new MockModelElementAbstractImpl();
    // set the old element's values
    modelElement.setName("name");
    modelElement.setSpecification(true);
    modelElement.setVisibility(VisibilityKind.PUBLIC);

    Stereotype stereotype = new StereotypeImpl();
    modelElement.addStereotype(stereotype);

    TemplateParameter templateParameter = new TemplateParameterImpl();
    modelElement.addTemplateParameter(templateParameter);

    TemplateArgument templateArgument = new TemplateArgumentImpl();
    modelElement.addTemplateArgument(templateArgument);

    ElementImport elementImport = new ElementImportImpl();
    modelElement.addElementImport(elementImport);

    StateMachine stateMachine = new StateMachineImpl();
    modelElement.addBehavior(stateMachine);

    TaggedValue taggedValue = new TaggedValueImpl();
    taggedValue.setDataValue("str");
    modelElement.addTaggedValue(taggedValue);
    modelElement.addReferenceTag(taggedValue);
    modelElement.addDefaultParameter(templateParameter);
    // call the copy method
    usecaseToolUtil.copyModelElementAttributes(modelElement, newElement);
    // verify the new element's values
    assertEquals("name", newElement.getName());
    assertTrue(newElement.isSpecification());
    assertEquals(VisibilityKind.PUBLIC, newElement.getVisibility());
    assertEquals(stereotype, newElement.getStereotypes().iterator().next());
    assertEquals(templateParameter, newElement.getTemplateParameters().get(0));
    assertEquals(templateArgument, newElement.getTemplateArguments().iterator().next());
    assertEquals(elementImport, newElement.getElementImports().iterator().next());
    assertEquals(stateMachine, newElement.getBehaviors().iterator().next());
    assertEquals("str", modelElement.getTaggedValues().iterator().next().getDataValue());
    assertEquals("str", modelElement.getReferenceTags().iterator().next().getDataValue());
    assertEquals(templateParameter, modelElement.getDefaultParameters().iterator().next());
  }
 /** Set up the test environment. */
 protected void setUp() {
   AccuracyHelper.loadDefaultConfig();
   ModelElement element = new OperationImpl();
   oldDocumentations = new HashMap<TaggedValue, String>();
   newDocumentations = new HashMap<TaggedValue, String>();
   taggedValue = new TaggedValueImpl();
   taggedValue.setDataValue("oldValue");
   oldDocumentations.put(taggedValue, "oldValue");
   newDocumentations.put(taggedValue, "newValue");
   instance =
       new UpdateDocumentationTagsAction(
           element, newDocumentations, UpdateDocumentationTagsOperationType.UPDATE);
 }
 /**
  * Test executeAction().
  *
  * @throws Exception exception to JUnit.
  */
 public void testExecuteAction() throws Exception {
   instance.executeAction();
   assertEquals("executeAction() is incorrect.", "newValue", taggedValue.getDataValue());
 }
 /** Test redoAction(). */
 public void testRedoAction() {
   instance.redoAction();
   assertEquals("redoAction() is incorrect.", "newValue", taggedValue.getDataValue());
 }
 /** Test undoAction()</code>. */
 public void testUndoAction() {
   instance.undoAction();
   assertEquals("undoAction() is incorrect.", "oldValue", taggedValue.getDataValue());
 }