### Question:
PluginForMongo implements Uml2XsdPlugin { @Override public void writeTopLevelElement(PsmDocument<Type> classType, ModelIndex model, Uml2XsdPluginWriter xsw) { xsw.element(); try { final QName name = getElementName(classType); xsw.elementName(name); final Type elementType = classType.getType(); xsw.type(getQName(elementType, model)); xsw.annotation(); try { PluginHelpers.writeDocumentation(elementType, model, xsw); } finally { xsw.end(); } } finally { xsw.end(); } }  static final boolean isUnbounded(final Occurs occurs); @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); @Override void writeTopLevelElement(PsmDocument<Type> classType, ModelIndex model, Uml2XsdPluginWriter xsw);  }### Answer:
@Test public void testWriteTopLevelElement() throws Exception { @SuppressWarnings("unchecked") final PsmDocument<Type> classType = Mockito.mock(PsmDocument.class); final Type mockType = Mockito.mock(Type.class); final ModelIndex mockIndex = Mockito.mock(ModelIndex.class); final Uml2XsdPluginWriter mockWriter = Mockito.mock(Uml2XsdPluginWriter.class); Mockito.when(mockType.getName()).thenReturn("Type Name"); Mockito.when(classType.getType()).thenReturn(mockType); Mockito.when(classType.getSingularResourceName()).thenReturn(new PsmCollection("test collection")); pluginForMongo.writeTopLevelElement(classType, mockIndex, mockWriter); final QName elementQName = pluginForMongo.getElementName(classType); Mockito.verify(mockWriter).elementName(elementQName); Mockito.verify(mockWriter).annotation(); Mockito.verify(mockWriter, Mockito.atLeastOnce()).end(); }