Search in sources :

Example 1 with MamPrefsIQProvider

use of org.jivesoftware.smackx.mam.provider.MamPrefsIQProvider in project Smack by igniterealtime.

the class MamPrefIQProviderTest method checkMamPrefsIQProvider.

@Test
public void checkMamPrefsIQProvider() throws Exception {
    XmlPullParser parser1 = PacketParserUtils.getParserFor(exampleMamPrefsIQ1);
    MamPrefsIQ mamPrefIQ1 = new MamPrefsIQProvider().parse(parser1);
    Assert.assertEquals(IQ.Type.set, mamPrefIQ1.getType());
    Assert.assertEquals(mamPrefIQ1.getAlwaysJids().get(0), "romeo@montague.lit");
    Assert.assertEquals(mamPrefIQ1.getNeverJids().get(0), "montague@montague.lit");
    XmlPullParser parser2 = PacketParserUtils.getParserFor(exampleMamPrefsIQ2);
    MamPrefsIQ mamPrefIQ2 = new MamPrefsIQProvider().parse(parser2);
    Assert.assertEquals(IQ.Type.set, mamPrefIQ2.getType());
    Assert.assertEquals(mamPrefIQ2.getAlwaysJids().get(0), "romeo@montague.lit");
    Assert.assertEquals(mamPrefIQ2.getAlwaysJids().get(1), "montague@montague.lit");
    Assert.assertTrue(mamPrefIQ2.getNeverJids().isEmpty());
    XmlPullParser parser3 = PacketParserUtils.getParserFor(exampleMamPrefsIQ3);
    MamPrefsIQ mamPrefIQ3 = new MamPrefsIQProvider().parse(parser3);
    Assert.assertEquals(IQ.Type.set, mamPrefIQ3.getType());
}
Also used : MamPrefsIQ(org.jivesoftware.smackx.mam.element.MamPrefsIQ) XmlPullParser(org.xmlpull.v1.XmlPullParser) MamPrefsIQProvider(org.jivesoftware.smackx.mam.provider.MamPrefsIQProvider) Test(org.junit.Test)

Aggregations

MamPrefsIQ (org.jivesoftware.smackx.mam.element.MamPrefsIQ)1 MamPrefsIQProvider (org.jivesoftware.smackx.mam.provider.MamPrefsIQProvider)1 Test (org.junit.Test)1 XmlPullParser (org.xmlpull.v1.XmlPullParser)1