1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-09 17:19:39 +02:00

Treat <body/> just like all other extension elements in Message

This turned out to be a rather large change.
This commit is contained in:
Florian Schmaus 2018-05-09 16:53:08 +02:00
parent cb9a11b74e
commit a9e45475ab
39 changed files with 261 additions and 219 deletions

View file

@ -17,6 +17,7 @@
package org.jivesoftware.smackx.chat_markers;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.StreamOpen;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smackx.chat_markers.element.ChatMarkersElements;
@ -40,7 +41,7 @@ public class AcknowledgedExtensionTest {
Message message = new Message(JidCreate.from("northumberland@shakespeare.lit/westminster"));
message.setStanzaId("message-2");
message.addExtension(new ChatMarkersElements.AcknowledgedExtension("message-1"));
Assert.assertEquals(acknowledgedMessageStanza, message.toXML(null).toString());
Assert.assertEquals(acknowledgedMessageStanza, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
}
@Test

View file

@ -17,6 +17,7 @@
package org.jivesoftware.smackx.chat_markers;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.StreamOpen;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smackx.chat_markers.element.ChatMarkersElements;
@ -40,7 +41,7 @@ public class DisplayedExtensionTest {
Message message = new Message(JidCreate.from("northumberland@shakespeare.lit/westminster"));
message.setStanzaId("message-2");
message.addExtension(new ChatMarkersElements.DisplayedExtension("message-1"));
Assert.assertEquals(displayedMessageStanza, message.toXML(null).toString());
Assert.assertEquals(displayedMessageStanza, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
}
@Test

View file

@ -30,7 +30,7 @@ import org.xmlpull.v1.XmlPullParser;
public class MarkableExtensionTest {
String markableMessageStanza = "<message to='ingrichard@royalty.england.lit/throne' id='message-1'>"
String markableMessageStanza = "<message xmlns='jabber:client' to='ingrichard@royalty.england.lit/throne' id='message-1'>"
+ "<body>My lord, dispatch; read o&apos;er these articles.</body>"
+ "<markable xmlns='urn:xmpp:chat-markers:0'/>" + "</message>";

View file

@ -17,6 +17,7 @@
package org.jivesoftware.smackx.chat_markers;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.StreamOpen;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smackx.chat_markers.element.ChatMarkersElements;
@ -40,7 +41,7 @@ public class ReceivedExtensionTest {
Message message = new Message(JidCreate.from("northumberland@shakespeare.lit/westminster"));
message.setStanzaId("message-2");
message.addExtension(new ChatMarkersElements.ReceivedExtension("message-1"));
Assert.assertEquals(receivedMessageStanza, message.toXML(null).toString());
Assert.assertEquals(receivedMessageStanza, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
}
@Test

View file

@ -1,6 +1,6 @@
/**
*
* Copyright © 2017 Grigory Fedorov, Florian Schmaus
* Copyright © 2017-2018 Grigory Fedorov, Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals;
import java.net.MalformedURLException;
import java.net.URL;
import org.jivesoftware.smack.packet.StreamOpen;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smackx.httpfileupload.element.Slot;
@ -68,7 +69,7 @@ public class SlotProviderTest {
checkUrls(slot);
assertXMLEqual(SLOT_IQ, slot.toXML(null).toString());
assertXMLEqual(SLOT_IQ, slot.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
}
private static final String SLOT_V0_2_IQ =
@ -88,7 +89,7 @@ public class SlotProviderTest {
checkUrls(slot);
String slotXml = slot.toXML(null).toString();
String slotXml = slot.toXML(StreamOpen.CLIENT_NAMESPACE).toString();
assertXMLEqual(SLOT_V0_2_IQ, slotXml);
}
@ -112,7 +113,7 @@ public class SlotProviderTest {
checkUrls(slot);
String slotXml = slot.toXML(null).toString();
String slotXml = slot.toXML(StreamOpen.CLIENT_NAMESPACE).toString();
assertXMLEqual(SLOT_WITH_HEADERS_IQ, slotXml);
}

View file

@ -17,6 +17,7 @@
package org.jivesoftware.smackx.mam;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.StreamOpen;
import org.jivesoftware.smackx.mam.element.MamQueryIQ;
import org.jivesoftware.smackx.rsm.packet.RSMSet;
@ -45,7 +46,7 @@ public class PagingTest extends MamTest {
Assert.assertEquals(mamQueryIQ.getDataForm(), dataForm);
Assert.assertEquals(mamQueryIQ.getDataForm().getFields().get(0).getValues().get(0), "urn:xmpp:mam:1");
Assert.assertEquals(mamQueryIQ.toXML(null).toString(), pagingStanza);
Assert.assertEquals(mamQueryIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString(), pagingStanza);
}
}

View file

@ -19,6 +19,8 @@ package org.jivesoftware.smackx.mam;
import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.smack.packet.StreamOpen;
import org.jivesoftware.smackx.mam.element.MamElements;
import org.jivesoftware.smackx.mam.element.MamPrefsIQ;
import org.jivesoftware.smackx.mam.element.MamPrefsIQ.DefaultBehavior;
@ -41,7 +43,7 @@ public class PreferencesTest {
public void checkRetrievePrefsStanza() throws Exception {
MamPrefsIQ mamPrefIQ = new MamPrefsIQ();
mamPrefIQ.setStanzaId("sarasa");
Assert.assertEquals(mamPrefIQ.toXML(null).toString(), retrievePrefsStanzaExample);
Assert.assertEquals(mamPrefIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString(), retrievePrefsStanzaExample);
}
@Test
@ -55,7 +57,7 @@ public class PreferencesTest {
MamPrefsIQ mamPrefIQ = new MamPrefsIQ(alwaysJids, neverJids, DefaultBehavior.roster);
mamPrefIQ.setStanzaId("sarasa");
Assert.assertEquals(mamPrefIQ.toXML(null).toString(), updatePrefsStanzaExample);
Assert.assertEquals(mamPrefIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString(), updatePrefsStanzaExample);
}
}

View file

@ -23,6 +23,7 @@ import java.util.TimeZone;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Message.Type;
import org.jivesoftware.smack.packet.StreamOpen;
import org.jivesoftware.smackx.delay.packet.DelayInformation;
import org.jivesoftware.smackx.forward.packet.Forwarded;
@ -45,7 +46,7 @@ public class QueryArchiveTest extends MamTest {
+ "<result xmlns='urn:xmpp:mam:1' queryid='g27' id='34482-21985-73620'>"
+ "<forwarded xmlns='urn:xmpp:forward:0'>"
+ "<delay xmlns='urn:xmpp:delay' stamp='2002-10-13T23:58:37.000+00:00'></delay>" + "<message "
+ "from='coven@chat.shakespeare.lit/firstwitch' " + "id='162BEBB1-F6DB-4D9A-9BD8-CFDCC801A0B2' "
+ "xmlns='jabber:client' from='coven@chat.shakespeare.lit/firstwitch' " + "id='162BEBB1-F6DB-4D9A-9BD8-CFDCC801A0B2' "
+ "type='chat'>" + "<body>Thrice the brinded cat hath mew.</body>" + "</message>" + "</forwarded>"
+ "</result>" + "</message>";
@ -55,7 +56,7 @@ public class QueryArchiveTest extends MamTest {
MamQueryIQ mamQueryIQ = new MamQueryIQ(queryId, dataForm);
mamQueryIQ.setType(IQ.Type.set);
mamQueryIQ.setStanzaId("sarasa");
Assert.assertEquals(mamQueryIQ.toXML(null).toString(), mamSimpleQueryIQ);
Assert.assertEquals(mamQueryIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString(), mamSimpleQueryIQ);
}
@Test
@ -80,7 +81,8 @@ public class QueryArchiveTest extends MamTest {
message.addExtension(new MamResultExtension("g27", "34482-21985-73620", forwarded));
Assert.assertEquals(message.toXML(null).toString(), mamQueryResultExample);
// FIXME: The order of assertEquals is reversed, fix it by switching it.
Assert.assertEquals(message.toXML(StreamOpen.CLIENT_NAMESPACE).toString(), mamQueryResultExample);
MamResultExtension mamResultExtension = MamResultExtension.from(message);

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.mam;
import java.lang.reflect.Method;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.StreamOpen;
import org.jivesoftware.smackx.mam.element.MamElements;
import org.jivesoftware.smackx.mam.element.MamQueryIQ;
@ -46,7 +47,7 @@ public class ResultsLimitTest extends MamTest {
mamQueryIQ.setStanzaId("sarasa");
methodAddResultsLimit.invoke(mamManager, 10, mamQueryIQ);
Assert.assertEquals(mamQueryIQ.toXML(null).toString(), resultsLimitStanza);
Assert.assertEquals(mamQueryIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString(), resultsLimitStanza);
}
}

View file

@ -20,6 +20,8 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import org.jivesoftware.smack.packet.StreamOpen;
import org.jivesoftware.smackx.mam.element.MamElements;
import org.jivesoftware.smackx.mam.element.MamQueryIQ;
import org.jivesoftware.smackx.xdata.FormField;
@ -44,7 +46,7 @@ public class RetrieveFormFieldsTest extends MamTest {
MamQueryIQ mamQueryIQ = new MamQueryIQ(queryId);
mamQueryIQ.setStanzaId("sarasa");
Assert.assertEquals(mamQueryIQ.toXML(null).toString(), retrieveFormFieldStanza);
Assert.assertEquals(mamQueryIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString(), retrieveFormFieldStanza);
}
@Test

View file

@ -30,19 +30,19 @@ import org.jxmpp.jid.impl.JidCreate;
public class MUCLightAffiliationsChangeExtensionTest {
private static final String exampleMessageStanza = "<message " + "to='coven@muclight.shakespeare.lit' id='member1' type='groupchat'>"
private static final String exampleMessageStanza = "<message xmlns='jabber:client' to='coven@muclight.shakespeare.lit' id='member1' type='groupchat'>"
+ "<x xmlns='urn:xmpp:muclight:0#affiliations'>"
+ "<user affiliation='owner'>sarasa2@shakespeare.lit</user>"
+ "<user affiliation='member'>sarasa1@shakespeare.lit</user>"
+ "<user affiliation='none'>sarasa3@shakespeare.lit</user>" + "</x>" + "</message>";
private static final String exampleMessageStanzaWithVersion = "<message "
private static final String exampleMessageStanzaWithVersion = "<message xmlns='jabber:client' "
+ "to='coven@muclight.shakespeare.lit' id='member1' type='groupchat'>"
+ "<x xmlns='urn:xmpp:muclight:0#affiliations'>" + "<version>qwerty</version>"
+ "<user affiliation='member'>sarasa1@shakespeare.lit</user>"
+ "<user affiliation='none'>sarasa3@shakespeare.lit</user>" + "</x>" + "<body></body>" + "</message>";
private static final String exampleMessageStanzaWithPrevVersion = "<message "
private static final String exampleMessageStanzaWithPrevVersion = "<message xmlns='jabber:client' "
+ "to='coven@muclight.shakespeare.lit' id='member1' type='groupchat'>"
+ "<x xmlns='urn:xmpp:muclight:0#affiliations'>" + "<prev-version>njiokm</prev-version>"
+ "<version>qwerty</version>" + "<user affiliation='owner'>sarasa2@shakespeare.lit</user>"

View file

@ -20,6 +20,7 @@ import java.util.HashMap;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.IQ.Type;
import org.jivesoftware.smack.packet.StreamOpen;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smackx.muclight.element.MUCLightBlockingIQ;
@ -61,7 +62,7 @@ public class MUCLightBlockingTest {
mucLightBlockingIQ.setStanzaId("getblock1");
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
Assert.assertEquals(getBlockingListIQExample, mucLightBlockingIQ.toXML(null).toString());
Assert.assertEquals(getBlockingListIQExample, mucLightBlockingIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
}
@Test
@ -88,7 +89,7 @@ public class MUCLightBlockingTest {
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
mucLightBlockingIQ.setStanzaId("block1");
Assert.assertEquals(blockingRoomsIQExample, mucLightBlockingIQ.toXML(null).toString());
Assert.assertEquals(blockingRoomsIQExample, mucLightBlockingIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
}
@Test
@ -102,7 +103,7 @@ public class MUCLightBlockingTest {
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
mucLightBlockingIQ.setStanzaId("block2");
Assert.assertEquals(blockingUsersIQExample, mucLightBlockingIQ.toXML(null).toString());
Assert.assertEquals(blockingUsersIQExample, mucLightBlockingIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
}
@Test
@ -118,7 +119,7 @@ public class MUCLightBlockingTest {
mucLightBlockingIQ.setTo(JidCreate.from("muclight.shakespeare.lit"));
mucLightBlockingIQ.setStanzaId("unblock1");
Assert.assertEquals(unblockingUsersAndRoomsExample, mucLightBlockingIQ.toXML(null).toString());
Assert.assertEquals(unblockingUsersAndRoomsExample, mucLightBlockingIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
}
}

View file

@ -26,16 +26,16 @@ import org.junit.Test;
public class MUCLightConfigurationsChangeExtensionTest {
private static final String messageWithSubjectChangeExample = "<message to='crone1@shakespeare.lit' from='coven@muclight.shakespeare.lit' id='newsubject' type='groupchat'>"
private static final String messageWithSubjectChangeExample = "<message xmlns='jabber:client' to='crone1@shakespeare.lit' from='coven@muclight.shakespeare.lit' id='newsubject' type='groupchat'>"
+ "<body></body>" + "<x xmlns='urn:xmpp:muclight:0#configuration'>"
+ "<prev-version>asdfghj000</prev-version>" + "<version>asdfghj</version>"
+ "<subject>To be or not to be?</subject>" + "</x>" + "</message>";
private static final String messageWithRoomNameChangeExample = "<message to='crone1@shakespeare.lit' from='coven@muclight.shakespeare.lit' id='newsubject' type='groupchat'>"
private static final String messageWithRoomNameChangeExample = "<message xmlns='jabber:client' to='crone1@shakespeare.lit' from='coven@muclight.shakespeare.lit' id='newsubject' type='groupchat'>"
+ "<body></body>" + "<x xmlns='urn:xmpp:muclight:0#configuration'>" + "<prev-version>zaqwsx</prev-version>"
+ "<version>zxcvbnm</version>" + "<roomname>A Darker Cave</roomname>" + "</x>" + "</message>";
private static final String messageWithConfigsChangeExample = "<message to='crone1@shakespeare.lit' from='coven@muclight.shakespeare.lit' id='newsubject' type='groupchat'>"
private static final String messageWithConfigsChangeExample = "<message xmlns='jabber:client' to='crone1@shakespeare.lit' from='coven@muclight.shakespeare.lit' id='newsubject' type='groupchat'>"
+ "<body></body>" + "<x xmlns='urn:xmpp:muclight:0#configuration'>" + "<prev-version>zaqwsx</prev-version>"
+ "<version>zxcvbnm</version>" + "<roomname>A Darker Cave</roomname>" + "<color>blue</color>" + "</x>"
+ "</message>";

View file

@ -16,6 +16,8 @@
*/
package org.jivesoftware.smackx.muclight;
import org.jivesoftware.smack.packet.StreamOpen;
import org.jivesoftware.smackx.muclight.element.MUCLightDestroyIQ;
import org.junit.Assert;
@ -31,7 +33,7 @@ public class MUCLightDestroyTest {
public void checkDestroyMUCLightStanza() throws Exception {
MUCLightDestroyIQ mucLightDestroyIQ = new MUCLightDestroyIQ(JidCreate.from("coven@muclight.shakespeare.lit"));
mucLightDestroyIQ.setStanzaId("destroy1");
Assert.assertEquals(mucLightDestroyIQ.toXML(null).toString(), stanza);
Assert.assertEquals(mucLightDestroyIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString(), stanza);
}
}

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.muclight;
import java.util.HashMap;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.StreamOpen;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smackx.muclight.element.MUCLightAffiliationsIQ;
@ -45,7 +46,7 @@ public class MUCLightGetAffiliationsTest {
MUCLightGetAffiliationsIQ mucLightGetAffiliationsIQ = new MUCLightGetAffiliationsIQ(
JidCreate.from("coven@muclight.shakespeare.lit"), "abcdefg");
mucLightGetAffiliationsIQ.setStanzaId("getmembers");
Assert.assertEquals(getAffiliationsIQExample, mucLightGetAffiliationsIQ.toXML(null).toString());
Assert.assertEquals(getAffiliationsIQExample, mucLightGetAffiliationsIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
}
@Test

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.muclight;
import java.util.HashMap;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.StreamOpen;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smackx.muclight.element.MUCLightConfigurationIQ;
@ -48,7 +49,7 @@ public class MUCLightGetConfigsTest {
MUCLightGetConfigsIQ mucLightGetConfigsIQ = new MUCLightGetConfigsIQ(
JidCreate.from("coven@muclight.shakespeare.lit"), "abcdefg");
mucLightGetConfigsIQ.setStanzaId("config0");
Assert.assertEquals(getConfigsIQExample, mucLightGetConfigsIQ.toXML(null).toString());
Assert.assertEquals(getConfigsIQExample, mucLightGetConfigsIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
}
@Test

View file

@ -17,6 +17,7 @@
package org.jivesoftware.smackx.muclight;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.StreamOpen;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.jivesoftware.smackx.muclight.element.MUCLightGetInfoIQ;
@ -45,7 +46,7 @@ public class MUCLightInfoTest {
MUCLightGetInfoIQ mucLightGetInfoIQWithVersion = new MUCLightGetInfoIQ(
JidCreate.from("coven@muclight.shakespeare.lit"), "abcdefg");
mucLightGetInfoIQWithVersion.setStanzaId("getinfo1");
Assert.assertEquals(mucLightGetInfoIQWithVersion.toXML(null).toString(), exampleWithVersion);
Assert.assertEquals(mucLightGetInfoIQWithVersion.toXML(StreamOpen.CLIENT_NAMESPACE).toString(), exampleWithVersion);
}
@Test
@ -53,7 +54,7 @@ public class MUCLightInfoTest {
MUCLightGetInfoIQ mucLightGetInfoIQWithoutVersion = new MUCLightGetInfoIQ(
JidCreate.from("coven@muclight.shakespeare.lit"), null);
mucLightGetInfoIQWithoutVersion.setStanzaId("getinfo1");
Assert.assertEquals(mucLightGetInfoIQWithoutVersion.toXML(null).toString(), exampleWithoutVersion);
Assert.assertEquals(mucLightGetInfoIQWithoutVersion.toXML(StreamOpen.CLIENT_NAMESPACE).toString(), exampleWithoutVersion);
}
@Test

View file

@ -18,6 +18,8 @@ package org.jivesoftware.smackx.muclight;
import java.util.HashMap;
import org.jivesoftware.smack.packet.StreamOpen;
import org.jivesoftware.smackx.muclight.element.MUCLightSetConfigsIQ;
import org.junit.Assert;
@ -47,7 +49,7 @@ public class MUCLightSetConfigsIQTest {
JidCreate.from("coven@muclight.shakespeare.lit"), "A Darker Cave", customConfigs);
mucLightSetConfigsIQ.setStanzaId("conf1");
Assert.assertEquals(setConfigsIQExample, mucLightSetConfigsIQ.toXML(null).toString());
Assert.assertEquals(setConfigsIQExample, mucLightSetConfigsIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
}
@Test
@ -56,7 +58,7 @@ public class MUCLightSetConfigsIQTest {
JidCreate.from("coven@muclight.shakespeare.lit"), "A Darker Cave", null);
mucLightChangeRoomNameIQ.setStanzaId("roomName1");
Assert.assertEquals(changeRoomNameIQExample, mucLightChangeRoomNameIQ.toXML(null).toString());
Assert.assertEquals(changeRoomNameIQExample, mucLightChangeRoomNameIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
}
@Test
@ -65,7 +67,7 @@ public class MUCLightSetConfigsIQTest {
JidCreate.from("coven@muclight.shakespeare.lit"), null, "To be or not to be?", null);
mucLightChangeSubjectIQ.setStanzaId("subject1");
Assert.assertEquals(changeSubjectIQExample, mucLightChangeSubjectIQ.toXML(null).toString());
Assert.assertEquals(changeSubjectIQExample, mucLightChangeSubjectIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
}
}

View file

@ -16,6 +16,8 @@
*/
package org.jivesoftware.smackx.push_notifications;
import org.jivesoftware.smack.packet.StreamOpen;
import org.jivesoftware.smackx.push_notifications.element.DisablePushNotificationsIQ;
import org.junit.Assert;
@ -36,7 +38,7 @@ public class DisablePushNotificationsIQTest {
DisablePushNotificationsIQ disablePushNotificationsIQ = new DisablePushNotificationsIQ(
JidCreate.from("push-5.client.example"));
disablePushNotificationsIQ.setStanzaId("x97");
Assert.assertEquals(disableAllNotificationsIQExample, disablePushNotificationsIQ.toXML(null).toString());
Assert.assertEquals(disableAllNotificationsIQExample, disablePushNotificationsIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
}
@Test
@ -44,7 +46,7 @@ public class DisablePushNotificationsIQTest {
DisablePushNotificationsIQ disablePushNotificationsIQ = new DisablePushNotificationsIQ(
JidCreate.from("push-5.client.example"), "yxs32uqsflafdk3iuqo");
disablePushNotificationsIQ.setStanzaId("x97");
Assert.assertEquals(disableNodeNotificationsIQExample, disablePushNotificationsIQ.toXML(null).toString());
Assert.assertEquals(disableNodeNotificationsIQExample, disablePushNotificationsIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
}
}

View file

@ -18,6 +18,8 @@ package org.jivesoftware.smackx.push_notifications;
import java.util.HashMap;
import org.jivesoftware.smack.packet.StreamOpen;
import org.jivesoftware.smackx.push_notifications.element.EnablePushNotificationsIQ;
import org.junit.Assert;
@ -41,7 +43,7 @@ public class EnablePushNotificationsIQTest {
EnablePushNotificationsIQ enablePushNotificationsIQ = new EnablePushNotificationsIQ(
JidCreate.from("push-5.client.example"), "yxs32uqsflafdk3iuqo");
enablePushNotificationsIQ.setStanzaId("x42");
Assert.assertEquals(exampleEnableIQ, enablePushNotificationsIQ.toXML(null).toString());
Assert.assertEquals(exampleEnableIQ, enablePushNotificationsIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
}
@Test
@ -53,7 +55,7 @@ public class EnablePushNotificationsIQTest {
JidCreate.from("push-5.client.example"), "yxs32uqsflafdk3iuqo", publishOptions);
enablePushNotificationsIQ.setStanzaId("x42");
Assert.assertEquals(exampleEnableIQWithPublishOptions, enablePushNotificationsIQ.toXML(null).toString());
Assert.assertEquals(exampleEnableIQWithPublishOptions, enablePushNotificationsIQ.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
}
}