### Question:
XmlRootNodeHandler implements RootNodeHandler { @Override public void close() throws IOException { try { xmlStreamWriter.writeEndElement(); } catch (XMLStreamException e) { throw new IOException(e); } finally { try { xmlStreamWriter.close(); } catch (XMLStreamException e) { throw new IOException(e); } } } XmlRootNodeHandler(OutputStream outputStream);  XmlRootNodeHandler(XMLStreamWriter xmlStreamWriter, XmlBxmlNodeVisitorFactory xmlBxmlNodeVisitorFactory); @Override void handle(RootNode rootNode); @Override void close(); static final String EVENTS; }### Answer:
@Test public void testClose() throws IOException, XMLStreamException { xmlRootNodeHandler.close(); verify(xmlStreamWriter).writeEndElement(); verify(xmlStreamWriter).close(); }
@Test(expected = IOException.class) public void testCloseException() throws IOException, XMLStreamException { doThrow(new XMLStreamException()).when(xmlStreamWriter).close(); xmlRootNodeHandler.close(); }