From a25971d02bbf4737818573307389e2c8be0b0cc1 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Tue, 5 Dec 2017 20:39:34 +0100 Subject: [PATCH] Add AffiliationsExtensionTest --- .../pubsub/AffiliationsExtensionTest.java | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/AffiliationsExtensionTest.java diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/AffiliationsExtensionTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/AffiliationsExtensionTest.java new file mode 100644 index 000000000..079733aab --- /dev/null +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/AffiliationsExtensionTest.java @@ -0,0 +1,49 @@ +/** + * + * Copyright 2017 Florian Schmaus + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smackx.pubsub; + +import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.jivesoftware.smackx.pubsub.Affiliation.Type; + +import org.junit.Test; +import org.jxmpp.jid.BareJid; +import org.jxmpp.jid.JidTestUtil; +import org.xml.sax.SAXException; + +public class AffiliationsExtensionTest { + + @Test + public void testAffiliationsExtensionToXml() throws SAXException, IOException { + BareJid affiliatedJid = JidTestUtil.BARE_JID_1; + Affiliation affiliation = new Affiliation(affiliatedJid, Type.member); + List affiliationsList = new ArrayList<>(); + affiliationsList.add(affiliation); + + AffiliationsExtension affiliationsExtension = new AffiliationsExtension(affiliationsList, "testNode"); + + CharSequence xml = affiliationsExtension.toXML(); + + assertXMLEqual("", + xml.toString()); + } + +}