/**
   * Test constructor ClassElementsTransfer(Class), with correct Excpetion instance.
   *
   * @throws Exception if an unexpected exception occurs
   */
  public void testCtorException() throws Exception {
    // create a Exception
    com.topcoder.uml.model.core.classifiers.Class classElement = new ClassImpl();
    Stereotype stereoType = new StereotypeImpl();
    stereoType.setName("Exception");
    classElement.addStereotype(stereoType);

    ClassElementsTransfer classElementsTransfer = new ClassElementsTransfer(classElement);

    assertEquals(
        "Constructor failed, supportedFlavor is not correctly set.",
        ClassElementsTransfer.EXCEPTION_FLAVOR,
        classElementsTransfer.getTransferDataFlavors()[0]);
    assertEquals(
        "Constructor failed, element is not correctly set.",
        classElement,
        classElementsTransfer.getTransferData(ClassElementsTransfer.EXCEPTION_FLAVOR));
  }
 /**
  * Gets the standard stereotype according to specified name.
  *
  * @param name specified stereotype name
  * @return the found stereotype, null if not found
  */
 private Stereotype getStandardStereotype(String name) {
   try {
     List<Stereotype> standardStereotypes =
         getMainFrame().getPropertiesPanel().getStereotypes(element.getClass());
     for (Stereotype standard : standardStereotypes) {
       if (standard.getName().equalsIgnoreCase(name)) {
         return standard;
       }
     }
   } catch (Exception e) {
     // ignore
   }
   return null;
 }
  /** Creates the model element for new node. */
  protected void createModelElement() {
    element = new ClassImpl();
    element.setName(name);

    // Obtain the stereotypes from project configuration manager
    Set<Stereotype> newStereotypes = new HashSet<Stereotype>();

    newStereotypes.add(getStandardStereotype("Enum"));

    getMainFrame().getPropertiesPanel().addStereotypes(newStereotypes, element.getClass());
    for (Stereotype stereotype : newStereotypes) {
      element.addStereotype(stereotype);
    }

    NodeContainer nodeContainer = getNodeContainer();
    if (nodeContainer != null) {
      setAddModelElementAction(
          new AddClassAction(
              element, modelManager, (Namespace) DeployHelper.getElement(nodeContainer)));
    } else {
      setAddModelElementAction(new AddClassAction(element, modelManager));
    }
  }