#include #include #include "Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h" using namespace Swift; class SecurityLabelsCatalogSerializerTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(SecurityLabelsCatalogSerializerTest); CPPUNIT_TEST(testSerialize); CPPUNIT_TEST_SUITE_END(); public: SecurityLabelsCatalogSerializerTest() {} void testSerialize() { SecurityLabelsCatalogSerializer testling; boost::shared_ptr catalog(new SecurityLabelsCatalog()); catalog->setTo(JID("example.com")); catalog->setName("Default"); catalog->setDescription("an example set of labels"); SecurityLabel securityLabel1; securityLabel1.setDisplayMarking("SECRET"); securityLabel1.setForegroundColor("black"); securityLabel1.setBackgroundColor("red"); securityLabel1.setLabel("MQYCAQQGASk="); catalog->addLabel(securityLabel1); SecurityLabel securityLabel2; securityLabel2.setDisplayMarking("CONFIDENTIAL"); securityLabel2.setForegroundColor("black"); securityLabel2.setBackgroundColor("navy"); securityLabel2.setLabel("MQMGASk="); catalog->addLabel(securityLabel2); CPPUNIT_ASSERT_EQUAL(String( "" "" "SECRET" "" "" "" "CONFIDENTIAL" "" "" ""), testling.serialize(catalog)); } }; CPPUNIT_TEST_SUITE_REGISTRATION(SecurityLabelsCatalogSerializerTest);