### Question:
PluginForREST implements Uml2XsdPlugin { @Override public void writeTopLevelElement(final PsmDocument<Type> classType, final ModelIndex model, final Uml2XsdPluginWriter xsw) { final Type elementType = classType.getType(); final QName elementName = getElementName(classType); final String ns = elementName.getNamespaceURI(); final QName elementList = new QName(ns, elementName.getLocalPart().concat("List")); xsw.element(); try { xsw.elementName(elementList); xsw.complexType(); try { xsw.sequence(); try { xsw.element(); try { xsw.ref(elementName); xsw.minOccurs(Occurs.ZERO); xsw.maxOccurs(Occurs.UNBOUNDED); xsw.annotation(); try { PluginHelpers.writeDocumentation(elementType, model, xsw); } finally { xsw.end(); } } finally { xsw.end(); } } finally { xsw.end(); } } finally { xsw.end(); } } finally { xsw.end(); } xsw.element(); try { xsw.elementName(elementName); xsw.type(getQName(elementType, model)); xsw.annotation(); try { PluginHelpers.writeDocumentation(elementType, 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);  }### Answer:
@Test public void testWriteTopLevelElement() throws Exception { final Type mockType = Mockito.mock(Type.class); final PsmDocument<Type> mockClassType = new PsmDocument<Type>(mockType, new PsmResource("resource"), new PsmCollection("collection")); final ModelIndex mockIndex = Mockito.mock(ModelIndex.class); final Uml2XsdPluginWriter mockWriter = Mockito.mock(Uml2XsdPluginWriter.class); Mockito.when(mockType.getName()).thenReturn("MockType"); final QName elementName = pluginForREST.getElementName(mockClassType); final QName expectedQName = new QName(elementName.getNamespaceURI(), elementName.getLocalPart().concat("List")); pluginForREST.writeTopLevelElement(mockClassType, mockIndex, mockWriter); Mockito.verify(mockWriter, Mockito.atLeastOnce()).element(); Mockito.verify(mockWriter).elementName(expectedQName); Mockito.verify(mockWriter).complexType(); Mockito.verify(mockWriter).sequence(); Mockito.verify(mockWriter, Mockito.atLeastOnce()).end(); }