Search in sources :

Example 21 with StanzaError

use of org.jivesoftware.smack.packet.StanzaError in project Smack by igniterealtime.

the class FailureTest method withStanzaErrrorFailureTest.

@Test
public void withStanzaErrrorFailureTest() throws SAXException, IOException {
    StanzaError stanzaError = StanzaError.getBuilder().setCondition(Condition.bad_request).build();
    Failure failure = new Failure(Failure.CompressFailureError.setup_failed, stanzaError);
    CharSequence xml = failure.toXML();
    final String expectedXml = "<failure xmlns='http://jabber.org/protocol/compress'>" + "<setup-failed/>" + "<error xmlns='jabber:client' type='modify'>" + "<bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>" + "</error>" + "</failure>";
    assertXmlSimilar(expectedXml, xml.toString());
}
Also used : StanzaError(org.jivesoftware.smack.packet.StanzaError) Test(org.junit.Test)

Aggregations

StanzaError (org.jivesoftware.smack.packet.StanzaError)21 IQ (org.jivesoftware.smack.packet.IQ)7 Test (org.junit.jupiter.api.Test)5 XMPPErrorException (org.jivesoftware.smack.XMPPException.XMPPErrorException)4 ErrorIQ (org.jivesoftware.smack.packet.ErrorIQ)3 XmlEnvironment (org.jivesoftware.smack.packet.XmlEnvironment)3 XmlPullParser (org.jivesoftware.smack.xml.XmlPullParser)3 AdHocCommandData (org.jivesoftware.smackx.commands.packet.AdHocCommandData)3 Failure (org.jivesoftware.smack.compress.packet.Failure)2 EmptyResultIQ (org.jivesoftware.smack.packet.EmptyResultIQ)2 Action (org.jivesoftware.smackx.commands.AdHocCommand.Action)2 Identity (org.jivesoftware.smackx.disco.packet.DiscoverInfo.Identity)2 DiscoverInfoBuilder (org.jivesoftware.smackx.disco.packet.DiscoverInfoBuilder)2 Test (org.junit.Test)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 ThreadedDummyConnection (org.jivesoftware.smack.ThreadedDummyConnection)1 XMPPConnection (org.jivesoftware.smack.XMPPConnection)1