### Question:
AbstractXMLStreamWriter implements XMLStreamWriter { @Override public void writeEmptyElement(String localName) throws XMLStreamException { String namespaceURI = scope.getNamespaceURI(XMLConstants.DEFAULT_NS_PREFIX); if (namespaceURI == null) { throw new XMLStreamException("Default namespace URI has not been set"); } writeStartElement(XMLConstants.DEFAULT_NS_PREFIX, localName, namespaceURI, true); } AbstractXMLStreamWriter(T rootInfo, boolean repaireNamespaces); @Override void writeStartElement(String localName); @Override void writeStartElement(String namespaceURI, String localName); @Override void writeStartElement(String prefix, String localName, String namespaceURI); @Override void writeEndElement(); @Override void writeEmptyElement(String localName); @Override void writeEmptyElement(String namespaceURI, String localName); @Override void writeEmptyElement(String prefix, String localName, String namespaceURI); @Override void writeAttribute(String localName, String value); @Override void writeAttribute(String namespaceURI, String localName, String value); @Override void writeAttribute(String prefix, String namespaceURI, String localName, String value); @Override void writeCharacters(String text); @Override void writeCharacters(char[] text, int start, int length); @Override void writeCData(String data); @Override void writeStartDocument(); @Override void writeStartDocument(String version); @Override void writeStartDocument(String encoding, String version); @Override void writeEndDocument(); @Override void close(); @Override void writeNamespace(String prefix, String namespaceURI); @Override void writeDefaultNamespace(String namespaceURI); @Override String getPrefix(String namespaceURI); @Override void setPrefix(String prefix, String namespaceURI); @Override void setDefaultNamespace(String namespaceURI); @Override void setNamespaceContext(NamespaceContext context); @Override NamespaceContext getNamespaceContext(); @Override void writeComment(String data); @Override void writeProcessingInstruction(String target); @Override void writeProcessingInstruction(String target, String data); @Override void writeDTD(String dtd); @Override void writeEntityRef(String name); @Override Object getProperty(String name);  }### Answer:
@Test public void testWriteEmptyElement0() throws XMLStreamException { XMLStreamWriter writer = createXMLStreamWriter(false); writer.writeEmptyElement("foo"); writer.flush(); Assert.assertEquals("<foo", writer.toString()); }
@Test(expected = XMLStreamException.class) public void testWriteEmptyElement1b() throws XMLStreamException { XMLStreamWriter writer = createXMLStreamWriter(false); writer.writeEmptyElement("http: }
@Test public void testWriteEmptyElement1bRepaired() throws XMLStreamException { XMLStreamWriter writer = createXMLStreamWriter(true); writer.writeEmptyElement("http: writer.flush(); Assert.assertEquals("<foo xmlns=\"http: }
@Test public void testWriteEmptyElement2c() throws XMLStreamException { XMLStreamWriter writer = createXMLStreamWriter(false); writer.writeEmptyElement("p", "foo", "http: writer.flush(); Assert.assertEquals("<p:foo", writer.toString()); }