diff options
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp')
-rw-r--r-- | Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp index fdf93a9..bf30db8 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp @@ -15,6 +15,7 @@ class RosterSerializerTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(RosterSerializerTest); CPPUNIT_TEST(testSerialize); + CPPUNIT_TEST(testSerialize_ItemWithUnknownContent); CPPUNIT_TEST_SUITE_END(); public: @@ -49,6 +50,33 @@ class RosterSerializerTest : public CppUnit::TestFixture CPPUNIT_ASSERT_EQUAL(expectedResult, testling.serialize(roster)); } + + void testSerialize_ItemWithUnknownContent() { + RosterSerializer testling; + boost::shared_ptr<RosterPayload> roster(new RosterPayload()); + + RosterItemPayload item; + item.setJID(JID("baz@blo.com")); + item.setName("Baz"); + item.addGroup("Group 1"); + item.addGroup("Group 2"); + item.addUnknownContent(String( + "<foo xmlns=\"http://example.com\"><bar xmlns=\"http://example.com\">Baz</bar></foo>" + "<baz xmlns=\"jabber:iq:roster\"><fum xmlns=\"jabber:iq:roster\">foo</fum></baz>")); + roster->addItem(item); + + String expectedResult = + "<query xmlns=\"jabber:iq:roster\">" + "<item jid=\"baz@blo.com\" name=\"Baz\" subscription=\"none\">" + "<group>Group 1</group>" + "<group>Group 2</group>" + "<foo xmlns=\"http://example.com\"><bar xmlns=\"http://example.com\">Baz</bar></foo>" + "<baz xmlns=\"jabber:iq:roster\"><fum xmlns=\"jabber:iq:roster\">foo</fum></baz>" + "</item>" + "</query>"; + + CPPUNIT_ASSERT_EQUAL(expectedResult, testling.serialize(roster)); + } }; CPPUNIT_TEST_SUITE_REGISTRATION(RosterSerializerTest); |