@Test public void testGetAssociationEndTypeName() throws Exception { ClassType classType = Mockito.mock(ClassType.class); Attribute attribute = Mockito.mock(Attribute.class); Xsd2UmlPluginHost host = Mockito.mock(Xsd2UmlPluginHost.class); TaggedValue taggedValue = Mockito.mock(TaggedValue.class); TagDefinition tagDefinition = Mockito.mock(TagDefinition.class); Identifier id = Identifier.random(); List<TaggedValue> taggedValueList = new ArrayList<TaggedValue>(); taggedValueList.add(taggedValue); Mockito.when(attribute.getTaggedValues()).thenReturn(taggedValueList); Mockito.when(taggedValue.getTagDefinition()).thenReturn(id); Mockito.when(host.getTagDefinition(Matchers.any(Identifier.class))).thenReturn(tagDefinition); Mockito.when(tagDefinition.getName()).thenReturn(SliUmlConstants.TAGDEF_REFERENCE); Mockito.when(taggedValue.getValue()).thenReturn("test"); String name = pluginForSLI.getAssociationEndTypeName(classType, attribute, host); Assert.assertNotNull(name); }
@Override public String getAssociationEndTypeName(final ClassType classType, final Attribute attribute, final Xsd2UmlPluginHost host) { String name = null; final List<TaggedValue> taggedValues = attribute.getTaggedValues(); for (final TaggedValue taggedValue : taggedValues) { final TagDefinition tagDefinition = host.getTagDefinition(taggedValue.getTagDefinition()); if (tagDefinition.getName().equals(SliUmlConstants.TAGDEF_REFERENCE)) { name = nameFromSchemaTypeName(new QName(taggedValue.getValue())); break; } } return name; }
Xsd2UmlPluginForSLI extends Xsd2UmlPluginDefault { @Override public String getAssociationEndTypeName(final ClassType classType, final Attribute attribute, final Xsd2UmlPluginHost host) { String name = null; final List<TaggedValue> taggedValues = attribute.getTaggedValues(); for (final TaggedValue taggedValue : taggedValues) { final TagDefinition tagDefinition = host.getTagDefinition(taggedValue.getTagDefinition()); if (tagDefinition.getName().equals(SliUmlConstants.TAGDEF_REFERENCE)) { name = nameFromSchemaTypeName(new QName(taggedValue.getValue())); break; } } return name; } }
Xsd2UmlPluginForSLI extends Xsd2UmlPluginDefault { @Override public String getAssociationEndTypeName(final ClassType classType, final Attribute attribute, final Xsd2UmlPluginHost host) { String name = null; final List<TaggedValue> taggedValues = attribute.getTaggedValues(); for (final TaggedValue taggedValue : taggedValues) { final TagDefinition tagDefinition = host.getTagDefinition(taggedValue.getTagDefinition()); if (tagDefinition.getName().equals(SliUmlConstants.TAGDEF_REFERENCE)) { name = nameFromSchemaTypeName(new QName(taggedValue.getValue())); break; } } return name; } Xsd2UmlPluginForSLI(); }
Xsd2UmlPluginForSLI extends Xsd2UmlPluginDefault { @Override public String getAssociationEndTypeName(final ClassType classType, final Attribute attribute, final Xsd2UmlPluginHost host) { String name = null; final List<TaggedValue> taggedValues = attribute.getTaggedValues(); for (final TaggedValue taggedValue : taggedValues) { final TagDefinition tagDefinition = host.getTagDefinition(taggedValue.getTagDefinition()); if (tagDefinition.getName().equals(SliUmlConstants.TAGDEF_REFERENCE)) { name = nameFromSchemaTypeName(new QName(taggedValue.getValue())); break; } } return name; } Xsd2UmlPluginForSLI(); @Override List<TagDefinition> declareTagDefinitions(final Xsd2UmlPluginHost host); @Override String getAssociationEndTypeName(final ClassType classType, final Attribute attribute,
            final Xsd2UmlPluginHost host); @Override /** * The most reliable way to determine whether the attribute should be an association is to look for the tag that indicates * that the attribute should be treated as a reference. If there is no tag then we look for clues in the name of the attribute. */ boolean isAssociationEnd(final ClassType classType, final Attribute attribute, final Xsd2UmlPluginHost host); @Override String nameAssociation(final AssociationEnd lhs, final AssociationEnd rhs, final Xsd2UmlHostedPlugin host); @Override String nameFromSchemaTypeName(final QName name); @Override List<TaggedValue> tagsFromAppInfo(final XmlSchemaAppInfo appInfo, final Xsd2UmlPluginHost host); }
Xsd2UmlPluginForSLI extends Xsd2UmlPluginDefault { @Override public String getAssociationEndTypeName(final ClassType classType, final Attribute attribute, final Xsd2UmlPluginHost host) { String name = null; final List<TaggedValue> taggedValues = attribute.getTaggedValues(); for (final TaggedValue taggedValue : taggedValues) { final TagDefinition tagDefinition = host.getTagDefinition(taggedValue.getTagDefinition()); if (tagDefinition.getName().equals(SliUmlConstants.TAGDEF_REFERENCE)) { name = nameFromSchemaTypeName(new QName(taggedValue.getValue())); break; } } return name; } Xsd2UmlPluginForSLI(); @Override List<TagDefinition> declareTagDefinitions(final Xsd2UmlPluginHost host); @Override String getAssociationEndTypeName(final ClassType classType, final Attribute attribute,
            final Xsd2UmlPluginHost host); @Override /** * The most reliable way to determine whether the attribute should be an association is to look for the tag that indicates * that the attribute should be treated as a reference. If there is no tag then we look for clues in the name of the attribute. */ boolean isAssociationEnd(final ClassType classType, final Attribute attribute, final Xsd2UmlPluginHost host); @Override String nameAssociation(final AssociationEnd lhs, final AssociationEnd rhs, final Xsd2UmlHostedPlugin host); @Override String nameFromSchemaTypeName(final QName name); @Override List<TaggedValue> tagsFromAppInfo(final XmlSchemaAppInfo appInfo, final Xsd2UmlPluginHost host);  }