Search in sources :

Example 1 with OmemoDeviceListVAxolotlProvider

use of org.jivesoftware.smackx.omemo.provider.OmemoDeviceListVAxolotlProvider in project Smack by igniterealtime.

the class OmemoDeviceListVAxolotlElementTest method serializationTest.

@Test
public void serializationTest() throws Exception {
    HashSet<Integer> ids = new HashSet<>();
    ids.add(1234);
    ids.add(9876);
    OmemoDeviceListElement_VAxolotl element = new OmemoDeviceListElement_VAxolotl(ids);
    String xml = element.toXML().toString();
    XmlPullParser parser = TestUtils.getParser(xml);
    OmemoDeviceListElement_VAxolotl parsed = new OmemoDeviceListVAxolotlProvider().parse(parser);
    assertTrue("Parsed element must equal the original.", parsed.getDeviceIds().equals(element.getDeviceIds()));
    assertEquals("Generated XML must match.", "<list xmlns='eu.siacs.conversations.axolotl'>" + "<device id='1234'/>" + "<device id='9876'/>" + "</list>", xml);
}
Also used : OmemoDeviceListVAxolotlProvider(org.jivesoftware.smackx.omemo.provider.OmemoDeviceListVAxolotlProvider) OmemoDeviceListElement_VAxolotl(org.jivesoftware.smackx.omemo.element.OmemoDeviceListElement_VAxolotl) XmlPullParser(org.jivesoftware.smack.xml.XmlPullParser) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

HashSet (java.util.HashSet)1 XmlPullParser (org.jivesoftware.smack.xml.XmlPullParser)1 OmemoDeviceListElement_VAxolotl (org.jivesoftware.smackx.omemo.element.OmemoDeviceListElement_VAxolotl)1 OmemoDeviceListVAxolotlProvider (org.jivesoftware.smackx.omemo.provider.OmemoDeviceListVAxolotlProvider)1 Test (org.junit.Test)1