### Question:
Uml2XsdPluginWriterAdapter implements Uml2XsdPluginWriter { @Override public void ref(final QName name) { try { if (name.getNamespaceURI().equals(WxsNamespace.URI)) { xsw.writeAttribute("ref", prefix.concat(":").concat(name.getLocalPart())); } else { xsw.writeAttribute("ref", typeLexicalName(name, xsw)); } } catch (final XMLStreamException e) { throw new XsdGenRuntimeException(e); } } Uml2XsdPluginWriterAdapter(final XMLStreamWriter xsw, final String prefix); @Override void annotation(); @Override void appinfo(); @Override void begin(final String prefix, final String localName, final String namespace); @Override void characters(final String text); @Override void choice(); @Override void comment(final String data); @Override void complexType(); @Override void documentation(); @Override void element(); @Override void elementName(final QName name); @Override void end(); @Override void maxOccurs(final Occurs value); @Override void minOccurs(final Occurs value); @Override void ref(final QName name); @Override void sequence(); @Override void type(final QName name);  }### Answer:
@Test public void testRef() throws Exception { final NamespaceContext mockNamespaceContext = Mockito.mock(NamespaceContext.class); Mockito.when(mockWriter.getNamespaceContext()).thenReturn(mockNamespaceContext); Mockito.when(mockNamespaceContext.getPrefix(Matchers.anyString())).thenReturn("sli"); final QName qName = new QName(WxsNamespace.URI, "test"); uml2XsdPluginWriterAdapter.ref(qName); Mockito.verify(mockWriter).writeAttribute("ref", "sli:test"); final QName qName1 = new QName("ns", "test2"); uml2XsdPluginWriterAdapter.ref(qName1); Mockito.verify(mockWriter).writeAttribute("ref", "sli:test2"); }