### Question:
AbstractXMLStreamWriter implements XMLStreamWriter { @Override public void writeEntityRef(String name) throws XMLStreamException { ensureStartTagClosed(); writeData(name, XMLStreamConstants.ENTITY_REFERENCE); } 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 testWriteEntityRef() throws XMLStreamException { XMLStreamWriter writer = createXMLStreamWriter(false); writer.writeStartElement("foo"); writer.writeEntityRef("bar"); writer.writeEndElement(); writer.flush(); Assert.assertEquals("<foo>&bar;</foo>", writer.toString()); }