@Override
    public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
        XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace);
        xml.rightAngleBracket();

        xml.emptyElement(compressFailureError);
        xml.optElement(stanzaError);

        xml.closeElement(this);
        return xml;
    }
@Test
    public void simpleFailureTest() throws SAXException, IOException {
        Failure failure = new Failure(Failure.CompressFailureError.processing_failed);
        CharSequence xml = failure.toXML();

        final String expectedXml = "<failure xmlns='http://jabber.org/protocol/compress'><processing-failed/></failure>";

        assertXmlSimilar(expectedXml, xml.toString());
    }