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