@Test public void testWriteReference() throws Exception { final Multiplicity multiplicity = new Multiplicity(new Range(Occurs.ZERO, Occurs.ONE)); final Identifier id = Identifier.fromString("1234"); final List<TaggedValue> taggedValueList = new ArrayList<TaggedValue>(); final TaggedValue mockTaggedValue = new TaggedValue("MockValue", id); taggedValueList.add(mockTaggedValue); final AssociationEnd mockEnd = new AssociationEnd(multiplicity, "test", true, taggedValueList, id, "test"); final ClassType mockClassType = Mockito.mock(ClassType.class); final ModelIndex mockIndex = Mockito.mock(ModelIndex.class); final Uml2XsdPluginWriter mockWriter = Mockito.mock(Uml2XsdPluginWriter.class); final TagDefinition mockTagDef = new TagDefinition(id, TagName.MONGO_NAME, multiplicity); Mockito.when(mockIndex.getTagDefinition(id)).thenReturn(mockTagDef); pluginForREST.writeReference(mockClassType, mockEnd, mockIndex, mockWriter); Mockito.verify(mockWriter).element(); Mockito.verify(mockWriter).type(WxsNamespace.STRING); Mockito.verify(mockWriter).minOccurs(Occurs.ZERO); Mockito.verify(mockWriter).maxOccurs(Occurs.ONE); Mockito.verify(mockWriter, Mockito.atLeastOnce()).end(); }
public void writeReference(final ClassType complexType, final AssociationEnd end, final ModelIndex model, final Uml2XsdPluginWriter xsw) { xsw.element(); try { xsw.elementName(new QName(PluginHelpers.getMongoName(end, model))); xsw.type(WxsNamespace.STRING); xsw.minOccurs(end.getMultiplicity().getRange().getLower()); xsw.maxOccurs(end.getMultiplicity().getRange().getUpper()); xsw.annotation(); try { PluginHelpers.writeDocumentation(end, model, xsw); } finally { xsw.end(); } } finally { xsw.end(); } }
PluginForREST implements Uml2XsdPlugin { public void writeReference(final ClassType complexType, final AssociationEnd end, final ModelIndex model, final Uml2XsdPluginWriter xsw) { xsw.element(); try { xsw.elementName(new QName(PluginHelpers.getMongoName(end, model))); xsw.type(WxsNamespace.STRING); xsw.minOccurs(end.getMultiplicity().getRange().getLower()); xsw.maxOccurs(end.getMultiplicity().getRange().getUpper()); xsw.annotation(); try { PluginHelpers.writeDocumentation(end, model, xsw); } finally { xsw.end(); } } finally { xsw.end(); } } }
PluginForREST implements Uml2XsdPlugin { public void writeReference(final ClassType complexType, final AssociationEnd end, final ModelIndex model, final Uml2XsdPluginWriter xsw) { xsw.element(); try { xsw.elementName(new QName(PluginHelpers.getMongoName(end, model))); xsw.type(WxsNamespace.STRING); xsw.minOccurs(end.getMultiplicity().getRange().getLower()); xsw.maxOccurs(end.getMultiplicity().getRange().getUpper()); xsw.annotation(); try { PluginHelpers.writeDocumentation(end, model, xsw); } finally { xsw.end(); } } finally { xsw.end(); } }  }
PluginForREST implements Uml2XsdPlugin { public void writeReference(final ClassType complexType, final AssociationEnd end, final ModelIndex model, final Uml2XsdPluginWriter xsw) { xsw.element(); try { xsw.elementName(new QName(PluginHelpers.getMongoName(end, model))); xsw.type(WxsNamespace.STRING); xsw.minOccurs(end.getMultiplicity().getRange().getLower()); xsw.maxOccurs(end.getMultiplicity().getRange().getUpper()); xsw.annotation(); try { PluginHelpers.writeDocumentation(end, model, xsw); } finally { xsw.end(); } } finally { xsw.end(); } }  @Override Map<String, String> declarePrefixMappings(); @Override QName getElementName(final String name, final boolean isReference); @Override QName getElementType(final String name, final boolean isAssociation); @Override QName getGraphAssociationEndName(final PsmDocument<Type> classType); @Override QName getElementName(final PsmDocument<Type> classType); @Override String getTargetNamespace(); @Override QName getTypeName(final String name); @Override boolean isAttributeFormDefaultQualified(); @Override boolean isElementFormDefaultQualified(); @Override boolean isEnabled(final QName name); @Override void writeAppInfo(final TaggedValue taggedValue, final ModelIndex lookup, final Uml2XsdPluginWriter xsw); @Override void writeAssociation(final ClassType complexType, final AssociationEnd end, final ModelIndex model,
            final Uml2XsdPluginWriter xsw); void writeEmbedded(final ClassType complexType, final AssociationEnd end, final ModelIndex model,
            final Uml2XsdPluginWriter xsw); void writeReference(final ClassType complexType, final AssociationEnd end, final ModelIndex model,
            final Uml2XsdPluginWriter xsw); @Override void writeTopLevelElement(final PsmDocument<Type> classType, final ModelIndex model,
            final Uml2XsdPluginWriter xsw); }
PluginForREST implements Uml2XsdPlugin { public void writeReference(final ClassType complexType, final AssociationEnd end, final ModelIndex model, final Uml2XsdPluginWriter xsw) { xsw.element(); try { xsw.elementName(new QName(PluginHelpers.getMongoName(end, model))); xsw.type(WxsNamespace.STRING); xsw.minOccurs(end.getMultiplicity().getRange().getLower()); xsw.maxOccurs(end.getMultiplicity().getRange().getUpper()); xsw.annotation(); try { PluginHelpers.writeDocumentation(end, model, xsw); } finally { xsw.end(); } } finally { xsw.end(); } }  @Override Map<String, String> declarePrefixMappings(); @Override QName getElementName(final String name, final boolean isReference); @Override QName getElementType(final String name, final boolean isAssociation); @Override QName getGraphAssociationEndName(final PsmDocument<Type> classType); @Override QName getElementName(final PsmDocument<Type> classType); @Override String getTargetNamespace(); @Override QName getTypeName(final String name); @Override boolean isAttributeFormDefaultQualified(); @Override boolean isElementFormDefaultQualified(); @Override boolean isEnabled(final QName name); @Override void writeAppInfo(final TaggedValue taggedValue, final ModelIndex lookup, final Uml2XsdPluginWriter xsw); @Override void writeAssociation(final ClassType complexType, final AssociationEnd end, final ModelIndex model,
            final Uml2XsdPluginWriter xsw); void writeEmbedded(final ClassType complexType, final AssociationEnd end, final ModelIndex model,
            final Uml2XsdPluginWriter xsw); void writeReference(final ClassType complexType, final AssociationEnd end, final ModelIndex model,
            final Uml2XsdPluginWriter xsw); @Override void writeTopLevelElement(final PsmDocument<Type> classType, final ModelIndex model,
            final Uml2XsdPluginWriter xsw);  }