1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-25 15:52:06 +01:00

Remove xmlunit-lagacy and add xmlunit-assertj

This commit is contained in:
Florian Schmaus 2019-05-07 18:51:52 +02:00
parent 95dbf5bb36
commit e1ed035beb
27 changed files with 163 additions and 146 deletions

View file

@ -14,7 +14,15 @@ dependencies {
testCompile project(':smack-xmlparser-xpp3') testCompile project(':smack-xmlparser-xpp3')
testCompile "org.jxmpp:jxmpp-jid:$jxmppVersion:tests" testCompile "org.jxmpp:jxmpp-jid:$jxmppVersion:tests"
testCompile "org.xmlunit:xmlunit-core:$xmlUnitVersion" testCompile "org.xmlunit:xmlunit-core:$xmlUnitVersion"
testCompile "org.xmlunit:xmlunit-legacy:$xmlUnitVersion" // Explictily add assertj-core which is a dependency of
// xmlunit-assertj, but gradle fails to resolves it with:
// Execution failed for task ':smack-core:compileTestJava'.
// > Could not resolve all files for configuration ':smack-core:testCompileClasspath'.
// > Could not find org.assertj:assertj-core:.
// Required by:
// project :smack-core > org.xmlunit:xmlunit-assertj:2.6.2
testCompile "org.assertj:assertj-core:3.11.1"
testCompile "org.xmlunit:xmlunit-assertj:$xmlUnitVersion"
testCompile 'com.jamesmurty.utils:java-xmlbuilder:1.2' testCompile 'com.jamesmurty.utils:java-xmlbuilder:1.2'
} }

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smack.compress.packet; package org.jivesoftware.smack.compress.packet;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import java.io.IOException; import java.io.IOException;
@ -35,7 +35,7 @@ public class FailureTest {
final String expectedXml = "<failure xmlns='http://jabber.org/protocol/compress'><processing-failed/></failure>"; final String expectedXml = "<failure xmlns='http://jabber.org/protocol/compress'><processing-failed/></failure>";
assertXMLEqual(expectedXml, xml.toString()); assertXmlSimilar(expectedXml, xml.toString());
} }
@Test @Test
@ -53,6 +53,6 @@ public class FailureTest {
+ "</error>" + "</error>"
+ "</failure>"; + "</failure>";
assertXMLEqual(expectedXml, xml.toString()); assertXmlSimilar(expectedXml, xml.toString());
} }
} }

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smack.packet; package org.jivesoftware.smack.packet;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
@ -26,8 +26,6 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import org.jivesoftware.smack.test.util.XmlUnitUtils;
import org.junit.Test; import org.junit.Test;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
@ -49,7 +47,7 @@ public class MessageTest {
Message messageTypeInConstructor = new Message(null, Message.Type.chat); Message messageTypeInConstructor = new Message(null, Message.Type.chat);
messageTypeInConstructor.setStanzaId(null); messageTypeInConstructor.setStanzaId(null);
assertEquals(type, messageTypeInConstructor.getType()); assertEquals(type, messageTypeInConstructor.getType());
assertXMLEqual(control, messageTypeInConstructor.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, messageTypeInConstructor.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
controlBuilder = new StringBuilder(); controlBuilder = new StringBuilder();
controlBuilder.append("<message") controlBuilder.append("<message")
@ -62,7 +60,7 @@ public class MessageTest {
Message messageTypeSet = getNewMessage(); Message messageTypeSet = getNewMessage();
messageTypeSet.setType(type2); messageTypeSet.setType(type2);
assertEquals(type2, messageTypeSet.getType()); assertEquals(type2, messageTypeSet.getType());
assertXMLEqual(control, messageTypeSet.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, messageTypeSet.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
} }
@Test(expected = NullPointerException.class) @Test(expected = NullPointerException.class)
@ -87,7 +85,7 @@ public class MessageTest {
message.setSubject(messageSubject); message.setSubject(messageSubject);
assertEquals(messageSubject, message.getSubject()); assertEquals(messageSubject, message.getSubject());
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
} }
@Test @Test
@ -106,7 +104,7 @@ public class MessageTest {
message.setBody(messageBody); message.setBody(messageBody);
assertEquals(messageBody, message.getBody()); assertEquals(messageBody, message.getBody());
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
} }
@Test @Test
@ -139,7 +137,7 @@ public class MessageTest {
message.addBody(null, messageBody1); message.addBody(null, messageBody1);
message.addBody(lang2, messageBody2); message.addBody(lang2, messageBody2);
message.addBody(lang3, messageBody3); message.addBody(lang3, messageBody3);
XmlUnitUtils.assertSimilar(control, message.toXML(StreamOpen.CLIENT_NAMESPACE)); assertXmlSimilar(control, message.toXML(StreamOpen.CLIENT_NAMESPACE));
Collection<String> languages = message.getBodyLanguages(); Collection<String> languages = message.getBodyLanguages();
List<String> controlLanguages = new ArrayList<>(); List<String> controlLanguages = new ArrayList<>();
@ -183,7 +181,7 @@ public class MessageTest {
message.setThread(messageThread); message.setThread(messageThread);
assertEquals(messageThread, message.getThread()); assertEquals(messageThread, message.getThread());
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
} }
@Test @Test
@ -201,7 +199,7 @@ public class MessageTest {
Message message = getNewMessage(); Message message = getNewMessage();
message.setLanguage(lang); message.setLanguage(lang);
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
} }
private static Message getNewMessage() { private static Message getNewMessage() {

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smack.packet; package org.jivesoftware.smack.packet;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
@ -43,7 +43,7 @@ public class PresenceTest {
Presence presenceTypeInConstructor = new Presence(type); Presence presenceTypeInConstructor = new Presence(type);
presenceTypeInConstructor.setStanzaId(null); presenceTypeInConstructor.setStanzaId(null);
assertEquals(type, presenceTypeInConstructor.getType()); assertEquals(type, presenceTypeInConstructor.getType());
assertXMLEqual(control, presenceTypeInConstructor.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, presenceTypeInConstructor.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
controlBuilder = new StringBuilder(); controlBuilder = new StringBuilder();
controlBuilder.append("<presence") controlBuilder.append("<presence")
@ -56,7 +56,7 @@ public class PresenceTest {
Presence presenceTypeSet = getNewPresence(); Presence presenceTypeSet = getNewPresence();
presenceTypeSet.setType(type2); presenceTypeSet.setType(type2);
assertEquals(type2, presenceTypeSet.getType()); assertEquals(type2, presenceTypeSet.getType());
assertXMLEqual(control, presenceTypeSet.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, presenceTypeSet.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
} }
@Test(expected = NullPointerException.class) @Test(expected = NullPointerException.class)
@ -90,7 +90,7 @@ public class PresenceTest {
presence.setStatus(status); presence.setStatus(status);
assertEquals(status, presence.getStatus()); assertEquals(status, presence.getStatus());
assertXMLEqual(control, presence.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, presence.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
} }
@Test @Test
@ -109,7 +109,7 @@ public class PresenceTest {
presence.setPriority(priority); presence.setPriority(priority);
assertEquals(priority, presence.getPriority()); assertEquals(priority, presence.getPriority());
assertXMLEqual(control, presence.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, presence.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
} }
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
@ -142,7 +142,7 @@ public class PresenceTest {
mode1); mode1);
presenceModeInConstructor.setStanzaId(null); presenceModeInConstructor.setStanzaId(null);
assertEquals(mode1, presenceModeInConstructor.getMode()); assertEquals(mode1, presenceModeInConstructor.getMode());
assertXMLEqual(control, presenceModeInConstructor.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, presenceModeInConstructor.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
controlBuilder = new StringBuilder(); controlBuilder = new StringBuilder();
controlBuilder.append("<presence>") controlBuilder.append("<presence>")
@ -155,7 +155,7 @@ public class PresenceTest {
Presence presenceModeSet = getNewPresence(); Presence presenceModeSet = getNewPresence();
presenceModeSet.setMode(mode2); presenceModeSet.setMode(mode2);
assertEquals(mode2, presenceModeSet.getMode()); assertEquals(mode2, presenceModeSet.getMode());
assertXMLEqual(control, presenceModeSet.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, presenceModeSet.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
} }
@Test @Test
@ -183,7 +183,7 @@ public class PresenceTest {
Presence presence = getNewPresence(); Presence presence = getNewPresence();
presence.setLanguage(lang); presence.setLanguage(lang);
assertXMLEqual(control, presence.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, presence.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
} }
private static Presence getNewPresence() { private static Presence getNewPresence() {

View file

@ -1,6 +1,6 @@
/** /**
* *
* Copyright 2014-2018 Florian Schmaus * Copyright 2014-2019 Florian Schmaus
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,24 +16,36 @@
*/ */
package org.jivesoftware.smack.test.util; package org.jivesoftware.smack.test.util;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import java.io.StringReader;
import java.io.IOException; import javax.xml.transform.stream.StreamSource;
import org.custommonkey.xmlunit.Diff; import org.xmlunit.assertj.CompareAssert;
import org.custommonkey.xmlunit.examples.RecursiveElementNameAndTextQualifier; import org.xmlunit.assertj.XmlAssert;
import org.xml.sax.SAXException; import org.xmlunit.diff.DefaultNodeMatcher;
import org.xmlunit.diff.ElementSelectors;
import org.xmlunit.input.NormalizedSource;
// TODO: Rename this class to XmlAssertUtil
public class XmlUnitUtils { public class XmlUnitUtils {
// TOOD: Remove this method. public static void assertXmlNotSimilar(CharSequence xmlOne, CharSequence xmlTwo) {
public static void assertSimilar(CharSequence expected, CharSequence actual) throws SAXException, IOException { normalizedCompare(xmlOne, xmlTwo).areNotSimilar();
assertXmlSimilar(expected, actual);
} }
public static void assertXmlSimilar(CharSequence expected, CharSequence actual) throws SAXException, IOException { public static void assertXmlSimilar(CharSequence expected, CharSequence actual) {
Diff diff = new Diff(expected.toString(), actual.toString()); normalizedCompare(expected, actual).areSimilar();
diff.overrideElementQualifier(new RecursiveElementNameAndTextQualifier()); }
assertXMLEqual(diff, true);
private static CompareAssert normalizedCompare(CharSequence expectedCharSequence, CharSequence actualCharSequence) {
String expectedString = expectedCharSequence.toString();
String actualString = actualCharSequence.toString();
NormalizedSource expected = new NormalizedSource(new StreamSource(new StringReader(expectedString)));
NormalizedSource actual = new NormalizedSource(new StreamSource(new StringReader(actualString)));
return XmlAssert.assertThat(expected).and(actual)
.ignoreChildNodesOrder()
.withNodeMatcher(new DefaultNodeMatcher(ElementSelectors.byNameAndAllAttributes, ElementSelectors.byNameAndText))
.normalizeWhitespace();
} }
} }

View file

@ -16,8 +16,8 @@
*/ */
package org.jivesoftware.smack.util; package org.jivesoftware.smack.util;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlNotSimilar;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLNotEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
@ -46,7 +46,6 @@ import org.jivesoftware.smack.sasl.packet.SaslStreamElements;
import org.jivesoftware.smack.sasl.packet.SaslStreamElements.SASLFailure; import org.jivesoftware.smack.sasl.packet.SaslStreamElements.SASLFailure;
import org.jivesoftware.smack.test.util.SmackTestUtil; import org.jivesoftware.smack.test.util.SmackTestUtil;
import org.jivesoftware.smack.test.util.TestUtils; import org.jivesoftware.smack.test.util.TestUtils;
import org.jivesoftware.smack.test.util.XmlUnitUtils;
import org.jivesoftware.smack.xml.XmlPullParser; import org.jivesoftware.smack.xml.XmlPullParser;
import org.jivesoftware.smack.xml.XmlPullParserException; import org.jivesoftware.smack.xml.XmlPullParserException;
@ -91,7 +90,7 @@ public class PacketParserUtilsTest {
assertTrue(message.getBodyLanguages().isEmpty()); assertTrue(message.getBodyLanguages().isEmpty());
assertEquals(defaultLanguage, message.getBody(defaultLanguage)); assertEquals(defaultLanguage, message.getBody(defaultLanguage));
assertNull(message.getBody(otherLanguage)); assertNull(message.getBody(otherLanguage));
assertXMLEqual(control, message.toXML().toString()); assertXmlSimilar(control, message.toXML().toString());
// message has non-default language, body has no language // message has non-default language, body has no language
control = XMLBuilder.create("message") control = XMLBuilder.create("message")
@ -111,7 +110,7 @@ public class PacketParserUtilsTest {
assertTrue(message.getBodyLanguages().isEmpty()); assertTrue(message.getBodyLanguages().isEmpty());
assertEquals(otherLanguage, message.getBody(otherLanguage)); assertEquals(otherLanguage, message.getBody(otherLanguage));
assertNull(message.getBody(defaultLanguage)); assertNull(message.getBody(defaultLanguage));
assertXMLEqual(control, message.toXML().toString()); assertXmlSimilar(control, message.toXML().toString());
// message has no language, body has no language // message has no language, body has no language
control = XMLBuilder.create("message") control = XMLBuilder.create("message")
@ -130,7 +129,7 @@ public class PacketParserUtilsTest {
assertTrue(message.getBodyLanguages().isEmpty()); assertTrue(message.getBodyLanguages().isEmpty());
assertEquals(defaultLanguage, message.getBody(null)); assertEquals(defaultLanguage, message.getBody(null));
assertNull(message.getBody(otherLanguage)); assertNull(message.getBody(otherLanguage));
assertXMLEqual(control, message.toXML().toString()); assertXmlSimilar(control, message.toXML().toString());
// message has no language, body has default language // message has no language, body has default language
control = XMLBuilder.create("message") control = XMLBuilder.create("message")
@ -151,7 +150,7 @@ public class PacketParserUtilsTest {
assertEquals(defaultLanguage, message.getBody(defaultLanguage)); assertEquals(defaultLanguage, message.getBody(defaultLanguage));
assertNull(message.getBody(otherLanguage)); assertNull(message.getBody(otherLanguage));
assertXMLEqual(control, message.toXML().toString()); assertXmlSimilar(control, message.toXML().toString());
// message has no language, body has non-default language // message has no language, body has non-default language
control = XMLBuilder.create("message") control = XMLBuilder.create("message")
@ -172,7 +171,7 @@ public class PacketParserUtilsTest {
assertTrue(message.getBodyLanguages().contains(otherLanguage)); assertTrue(message.getBodyLanguages().contains(otherLanguage));
assertEquals(otherLanguage, message.getBody(otherLanguage)); assertEquals(otherLanguage, message.getBody(otherLanguage));
assertNull(message.getBody(defaultLanguage)); assertNull(message.getBody(defaultLanguage));
assertXMLEqual(control, message.toXML().toString()); assertXmlSimilar(control, message.toXML().toString());
// message has default language, body has non-default language // message has default language, body has non-default language
control = XMLBuilder.create("message") control = XMLBuilder.create("message")
@ -194,7 +193,7 @@ public class PacketParserUtilsTest {
assertTrue(message.getBodyLanguages().contains(otherLanguage)); assertTrue(message.getBodyLanguages().contains(otherLanguage));
assertEquals(otherLanguage, message.getBody(otherLanguage)); assertEquals(otherLanguage, message.getBody(otherLanguage));
assertNull(message.getBody(defaultLanguage)); assertNull(message.getBody(defaultLanguage));
assertXMLEqual(control, message.toXML().toString()); assertXmlSimilar(control, message.toXML().toString());
// message has non-default language, body has default language // message has non-default language, body has default language
control = XMLBuilder.create("message") control = XMLBuilder.create("message")
@ -216,7 +215,7 @@ public class PacketParserUtilsTest {
assertTrue(message.getBodyLanguages().contains(defaultLanguage)); assertTrue(message.getBodyLanguages().contains(defaultLanguage));
assertEquals(defaultLanguage, message.getBody(defaultLanguage)); assertEquals(defaultLanguage, message.getBody(defaultLanguage));
assertNull(message.getBody(otherLanguage)); assertNull(message.getBody(otherLanguage));
assertXMLEqual(control, message.toXML().toString()); assertXmlSimilar(control, message.toXML().toString());
} }
@ -245,7 +244,7 @@ public class PacketParserUtilsTest {
assertTrue(message.getSubjectLanguages().isEmpty()); assertTrue(message.getSubjectLanguages().isEmpty());
assertEquals(defaultLanguage, message.getSubject(defaultLanguage)); assertEquals(defaultLanguage, message.getSubject(defaultLanguage));
assertNull(message.getSubject(otherLanguage)); assertNull(message.getSubject(otherLanguage));
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
// message has non-default language, subject has no language // message has non-default language, subject has no language
control = XMLBuilder.create("message") control = XMLBuilder.create("message")
@ -264,7 +263,7 @@ public class PacketParserUtilsTest {
assertTrue(message.getSubjectLanguages().isEmpty()); assertTrue(message.getSubjectLanguages().isEmpty());
assertEquals(otherLanguage, message.getSubject(otherLanguage)); assertEquals(otherLanguage, message.getSubject(otherLanguage));
assertNull(message.getSubject(defaultLanguage)); assertNull(message.getSubject(defaultLanguage));
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
// message has no language, subject has no language // message has no language, subject has no language
control = XMLBuilder.create("message") control = XMLBuilder.create("message")
@ -282,7 +281,7 @@ public class PacketParserUtilsTest {
assertTrue(message.getSubjectLanguages().isEmpty()); assertTrue(message.getSubjectLanguages().isEmpty());
assertEquals(defaultLanguage, message.getSubject(null)); assertEquals(defaultLanguage, message.getSubject(null));
assertNull(message.getSubject(otherLanguage)); assertNull(message.getSubject(otherLanguage));
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
// message has no language, subject has default language // message has no language, subject has default language
control = XMLBuilder.create("message") control = XMLBuilder.create("message")
@ -301,7 +300,7 @@ public class PacketParserUtilsTest {
assertEquals(defaultLanguage, message.getSubject(defaultLanguage)); assertEquals(defaultLanguage, message.getSubject(defaultLanguage));
assertNull(message.getSubject(otherLanguage)); assertNull(message.getSubject(otherLanguage));
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
// message has no language, subject has non-default language // message has no language, subject has non-default language
control = XMLBuilder.create("message") control = XMLBuilder.create("message")
@ -321,7 +320,7 @@ public class PacketParserUtilsTest {
assertTrue(message.getSubjectLanguages().contains(otherLanguage)); assertTrue(message.getSubjectLanguages().contains(otherLanguage));
assertEquals(otherLanguage, message.getSubject(otherLanguage)); assertEquals(otherLanguage, message.getSubject(otherLanguage));
assertNull(message.getSubject(defaultLanguage)); assertNull(message.getSubject(defaultLanguage));
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
// message has default language, subject has non-default language // message has default language, subject has non-default language
control = XMLBuilder.create("message") control = XMLBuilder.create("message")
@ -342,7 +341,7 @@ public class PacketParserUtilsTest {
assertTrue(message.getSubjectLanguages().contains(otherLanguage)); assertTrue(message.getSubjectLanguages().contains(otherLanguage));
assertEquals(otherLanguage, message.getSubject(otherLanguage)); assertEquals(otherLanguage, message.getSubject(otherLanguage));
assertNull(message.getSubject(defaultLanguage)); assertNull(message.getSubject(defaultLanguage));
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
// message has non-default language, subject has default language // message has non-default language, subject has default language
control = XMLBuilder.create("message") control = XMLBuilder.create("message")
@ -363,7 +362,7 @@ public class PacketParserUtilsTest {
assertTrue(message.getSubjectLanguages().contains(defaultLanguage)); assertTrue(message.getSubjectLanguages().contains(defaultLanguage));
assertEquals(defaultLanguage, message.getSubject(defaultLanguage)); assertEquals(defaultLanguage, message.getSubject(defaultLanguage));
assertNull(message.getSubject(otherLanguage)); assertNull(message.getSubject(otherLanguage));
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
} }
@ -399,7 +398,7 @@ public class PacketParserUtilsTest {
assertEquals(2, message.getBodies().size()); assertEquals(2, message.getBodies().size());
assertEquals(1, message.getBodyLanguages().size()); assertEquals(1, message.getBodyLanguages().size());
assertTrue(message.getBodyLanguages().contains(otherLanguage)); assertTrue(message.getBodyLanguages().contains(otherLanguage));
assertXMLEqual(control, message.toXML().toString()); assertXmlSimilar(control, message.toXML().toString());
// message has non-default language, first body no language, second body default language // message has non-default language, first body no language, second body default language
control = XMLBuilder.create("message") control = XMLBuilder.create("message")
@ -425,7 +424,7 @@ public class PacketParserUtilsTest {
assertEquals(2, message.getBodies().size()); assertEquals(2, message.getBodies().size());
assertEquals(1, message.getBodyLanguages().size()); assertEquals(1, message.getBodyLanguages().size());
assertTrue(message.getBodyLanguages().contains(defaultLanguage)); assertTrue(message.getBodyLanguages().contains(defaultLanguage));
assertXMLEqual(control, message.toXML().toString()); assertXmlSimilar(control, message.toXML().toString());
} }
// TODO: Re-enable once we throw an exception on duplicate body elements. // TODO: Re-enable once we throw an exception on duplicate body elements.
@ -458,7 +457,7 @@ public class PacketParserUtilsTest {
assertEquals(defaultLanguage, message.getBody(defaultLanguage)); assertEquals(defaultLanguage, message.getBody(defaultLanguage));
assertEquals(1, message.getBodies().size()); assertEquals(1, message.getBodies().size());
assertEquals(0, message.getBodyLanguages().size()); assertEquals(0, message.getBodyLanguages().size());
assertXMLNotEqual(control, message.toXML().toString()); assertXmlNotSimilar(control, message.toXML().toString());
} }
@Ignore @Ignore
@ -516,7 +515,7 @@ public class PacketParserUtilsTest {
assertEquals(otherLanguage, message.getBody(otherLanguage)); assertEquals(otherLanguage, message.getBody(otherLanguage));
assertEquals(2, message.getBodies().size()); assertEquals(2, message.getBodies().size());
assertEquals(1, message.getBodyLanguages().size()); assertEquals(1, message.getBodyLanguages().size());
assertXMLEqual(control, message.toXML().toString()); assertXmlSimilar(control, message.toXML().toString());
} }
@Test @Test
@ -550,7 +549,7 @@ public class PacketParserUtilsTest {
assertEquals(2, message.getSubjects().size()); assertEquals(2, message.getSubjects().size());
assertEquals(1, message.getSubjectLanguages().size()); assertEquals(1, message.getSubjectLanguages().size());
assertTrue(message.getSubjectLanguages().contains(otherLanguage)); assertTrue(message.getSubjectLanguages().contains(otherLanguage));
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
// message has default language, first subject no language, second subject default language // message has default language, first subject no language, second subject default language
control = XMLBuilder.create("message") control = XMLBuilder.create("message")
@ -574,7 +573,7 @@ public class PacketParserUtilsTest {
assertEquals(defaultLanguage, message.getSubject(defaultLanguage)); assertEquals(defaultLanguage, message.getSubject(defaultLanguage));
assertEquals(1, message.getSubjects().size()); assertEquals(1, message.getSubjects().size());
assertEquals(0, message.getSubjectLanguages().size()); assertEquals(0, message.getSubjectLanguages().size());
assertXMLNotEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlNotSimilar(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
// message has non-default language, first subject no language, second subject default language // message has non-default language, first subject no language, second subject default language
control = XMLBuilder.create("message") control = XMLBuilder.create("message")
@ -599,7 +598,7 @@ public class PacketParserUtilsTest {
assertEquals(2, message.getSubjects().size()); assertEquals(2, message.getSubjects().size());
assertEquals(1, message.getSubjectLanguages().size()); assertEquals(1, message.getSubjectLanguages().size());
assertTrue(message.getSubjectLanguages().contains(defaultLanguage)); assertTrue(message.getSubjectLanguages().contains(defaultLanguage));
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
/* /*
// message has no language, first subject no language, second subject default language // message has no language, first subject no language, second subject default language
@ -647,7 +646,7 @@ public class PacketParserUtilsTest {
assertEquals(otherLanguage, message.getSubject(otherLanguage)); assertEquals(otherLanguage, message.getSubject(otherLanguage));
assertEquals(2, message.getSubjects().size()); assertEquals(2, message.getSubjects().size());
assertEquals(1, message.getSubjectLanguages().size()); assertEquals(1, message.getSubjectLanguages().size());
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
// message has no language, first subject no language, second subject no language // message has no language, first subject no language, second subject no language
control = XMLBuilder.create("message") control = XMLBuilder.create("message")
@ -777,7 +776,7 @@ public class PacketParserUtilsTest {
.asString(outputProperties); .asString(outputProperties);
Stanza message = PacketParserUtils.parseStanza(control); Stanza message = PacketParserUtils.parseStanza(control);
XmlUnitUtils.assertSimilar(control, message.toXML()); assertXmlSimilar(control, message.toXML());
} }
@Test @Test
@ -787,7 +786,7 @@ public class PacketParserUtilsTest {
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza)); Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
assertXMLEqual(stanza, presence.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(stanza, presence.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
// CHECKSTYLE:ON // CHECKSTYLE:ON
} }
@ -798,7 +797,7 @@ public class PacketParserUtilsTest {
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza)); Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
assertXMLEqual(stanza, presence.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(stanza, presence.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
assertEquals(Presence.Type.unsubscribed, presence.getType()); assertEquals(Presence.Type.unsubscribed, presence.getType());
// CHECKSTYLE:ON // CHECKSTYLE:ON
} }
@ -813,7 +812,7 @@ public class PacketParserUtilsTest {
+ "</presence>"; + "</presence>";
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza)); Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
assertXMLEqual(stanza, presence.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(stanza, presence.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
assertEquals(Presence.Type.unsubscribed, presence.getType()); assertEquals(Presence.Type.unsubscribed, presence.getType());
assertEquals("dnd", presence.getMode().name()); assertEquals("dnd", presence.getMode().name());
assertEquals("en", presence.getLanguage()); assertEquals("en", presence.getLanguage());
@ -844,7 +843,7 @@ public class PacketParserUtilsTest {
// @formatter:on // @formatter:on
XmlPullParser parser = TestUtils.getParser(stanza, "outer"); XmlPullParser parser = TestUtils.getParser(stanza, "outer");
CharSequence result = PacketParserUtils.parseElement(parser, true); CharSequence result = PacketParserUtils.parseElement(parser, true);
assertXMLEqual(stanza, result.toString()); assertXmlSimilar(stanza, result.toString());
} }
@Test @Test
@ -857,7 +856,7 @@ public class PacketParserUtilsTest {
// @formatter:on // @formatter:on
XmlPullParser parser = TestUtils.getParser(saslFailureString, SASLFailure.ELEMENT); XmlPullParser parser = TestUtils.getParser(saslFailureString, SASLFailure.ELEMENT);
SASLFailure saslFailure = PacketParserUtils.parseSASLFailure(parser); SASLFailure saslFailure = PacketParserUtils.parseSASLFailure(parser);
assertXMLEqual(saslFailureString, saslFailure.toString()); assertXmlSimilar(saslFailureString, saslFailure.toString());
} }
@Test @Test
@ -879,7 +878,7 @@ public class PacketParserUtilsTest {
// @formatter:on // @formatter:on
XmlPullParser parser = TestUtils.getParser(saslFailureString, SASLFailure.ELEMENT); XmlPullParser parser = TestUtils.getParser(saslFailureString, SASLFailure.ELEMENT);
SASLFailure saslFailure = PacketParserUtils.parseSASLFailure(parser); SASLFailure saslFailure = PacketParserUtils.parseSASLFailure(parser);
XmlUnitUtils.assertSimilar(saslFailureString, saslFailure.toXML(StreamOpen.CLIENT_NAMESPACE)); assertXmlSimilar(saslFailureString, saslFailure.toXML(StreamOpen.CLIENT_NAMESPACE));
} }
@SuppressWarnings("ReferenceEquality") @SuppressWarnings("ReferenceEquality")
@ -923,7 +922,7 @@ public class PacketParserUtilsTest {
.element("internal-server-error", StanzaError.ERROR_CONDITION_AND_TEXT_NAMESPACE).up() .element("internal-server-error", StanzaError.ERROR_CONDITION_AND_TEXT_NAMESPACE).up()
.element("text", StanzaError.ERROR_CONDITION_AND_TEXT_NAMESPACE).t(text).up() .element("text", StanzaError.ERROR_CONDITION_AND_TEXT_NAMESPACE).t(text).up()
.asString(); .asString();
XmlUnitUtils.assertSimilar(errorXml, error.toXML(StreamOpen.CLIENT_NAMESPACE)); assertXmlSimilar(errorXml, error.toXML(StreamOpen.CLIENT_NAMESPACE));
} }
@Test @Test

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.httpfileupload; package org.jivesoftware.smackx.httpfileupload;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException; import java.io.IOException;
@ -44,6 +44,6 @@ public class SlotCreateTest {
assertEquals(new URL("https://download.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my_juliet.png"), assertEquals(new URL("https://download.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my_juliet.png"),
slot.getGetUrl()); slot.getGetUrl());
assertXMLEqual(testSlot, slot.getChildElementXML().toString()); assertXmlSimilar(testSlot, slot.getChildElementXML().toString());
} }
} }

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.httpfileupload; package org.jivesoftware.smackx.httpfileupload;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;
@ -51,7 +51,7 @@ public class SlotRequestCreateTest {
assertEquals(23456, slotRequest.getSize()); assertEquals(23456, slotRequest.getSize());
assertEquals("image/jpeg", slotRequest.getContentType()); assertEquals("image/jpeg", slotRequest.getContentType());
assertXMLEqual(testRequest, slotRequest.getChildElementXML().toString()); assertXmlSimilar(testRequest, slotRequest.getChildElementXML().toString());
} }
@Test @Test
@ -62,7 +62,7 @@ public class SlotRequestCreateTest {
assertEquals(52523, slotRequest.getSize()); assertEquals(52523, slotRequest.getSize());
assertEquals(null, slotRequest.getContentType()); assertEquals(null, slotRequest.getContentType());
assertXMLEqual(testRequestWithoutContentType, slotRequest.getChildElementXML().toString()); assertXmlSimilar(testRequestWithoutContentType, slotRequest.getChildElementXML().toString());
} }
@Test @Test

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.httpfileupload.provider; package org.jivesoftware.smackx.httpfileupload.provider;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import java.net.MalformedURLException; import java.net.MalformedURLException;
@ -69,7 +69,7 @@ public class SlotProviderTest {
checkUrls(slot); checkUrls(slot);
assertXMLEqual(SLOT_IQ, slot.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(SLOT_IQ, slot.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
} }
private static final String SLOT_V0_2_IQ = private static final String SLOT_V0_2_IQ =
@ -90,7 +90,7 @@ public class SlotProviderTest {
checkUrls(slot); checkUrls(slot);
String slotXml = slot.toXML(StreamOpen.CLIENT_NAMESPACE).toString(); String slotXml = slot.toXML(StreamOpen.CLIENT_NAMESPACE).toString();
assertXMLEqual(SLOT_V0_2_IQ, slotXml); assertXmlSimilar(SLOT_V0_2_IQ, slotXml);
} }
private static final String SLOT_WITH_HEADERS_IQ = private static final String SLOT_WITH_HEADERS_IQ =
@ -114,7 +114,7 @@ public class SlotProviderTest {
checkUrls(slot); checkUrls(slot);
String slotXml = slot.toXML(StreamOpen.CLIENT_NAMESPACE).toString(); String slotXml = slot.toXML(StreamOpen.CLIENT_NAMESPACE).toString();
assertXMLEqual(SLOT_WITH_HEADERS_IQ, slotXml); assertXmlSimilar(SLOT_WITH_HEADERS_IQ, slotXml);
} }
private static void checkUrls(Slot slot) { private static void checkUrls(Slot slot) {

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.message_markup; package org.jivesoftware.smackx.message_markup;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;
@ -47,7 +47,7 @@ public class MessageMarkupTest extends SmackTestSuite {
"</markup>"; "</markup>";
MarkupElement.Builder m = MarkupElement.getBuilder(); MarkupElement.Builder m = MarkupElement.getBuilder();
m.setEmphasis(9, 15); m.setEmphasis(9, 15);
assertXMLEqual(xml, m.build().toXML().toString()); assertXmlSimilar(xml, m.build().toXML().toString());
XmlPullParser parser = TestUtils.getParser(xml); XmlPullParser parser = TestUtils.getParser(xml);
MarkupElement parsed = new MarkupElementProvider().parse(parser); MarkupElement parsed = new MarkupElementProvider().parse(parser);
@ -71,7 +71,7 @@ public class MessageMarkupTest extends SmackTestSuite {
"</markup>"; "</markup>";
MarkupElement.Builder m = MarkupElement.getBuilder(); MarkupElement.Builder m = MarkupElement.getBuilder();
m.setCode(9, 15); m.setCode(9, 15);
assertXMLEqual(xml, m.build().toXML().toString()); assertXmlSimilar(xml, m.build().toXML().toString());
XmlPullParser parser = TestUtils.getParser(xml); XmlPullParser parser = TestUtils.getParser(xml);
MarkupElement parsed = new MarkupElementProvider().parse(parser); MarkupElement parsed = new MarkupElementProvider().parse(parser);
@ -95,7 +95,7 @@ public class MessageMarkupTest extends SmackTestSuite {
"</markup>"; "</markup>";
MarkupElement.Builder m = MarkupElement.getBuilder(); MarkupElement.Builder m = MarkupElement.getBuilder();
m.setDeleted(9, 15); m.setDeleted(9, 15);
assertXMLEqual(xml, m.build().toXML().toString()); assertXmlSimilar(xml, m.build().toXML().toString());
XmlPullParser parser = TestUtils.getParser(xml); XmlPullParser parser = TestUtils.getParser(xml);
MarkupElement parsed = new MarkupElementProvider().parse(parser); MarkupElement parsed = new MarkupElementProvider().parse(parser);
@ -131,7 +131,7 @@ public class MessageMarkupTest extends SmackTestSuite {
"</markup>"; "</markup>";
MarkupElement.Builder m = MarkupElement.getBuilder(); MarkupElement.Builder m = MarkupElement.getBuilder();
m.setCodeBlock(23, 48); m.setCodeBlock(23, 48);
assertXMLEqual(xml, m.build().toXML().toString()); assertXmlSimilar(xml, m.build().toXML().toString());
XmlPullParser parser = TestUtils.getParser(xml); XmlPullParser parser = TestUtils.getParser(xml);
MarkupElement parsed = new MarkupElementProvider().parse(parser); MarkupElement parsed = new MarkupElementProvider().parse(parser);
@ -161,7 +161,7 @@ public class MessageMarkupTest extends SmackTestSuite {
.addEntry(61, 69) .addEntry(61, 69)
.addEntry(69, 89) .addEntry(69, 89)
.endList(); .endList();
assertXMLEqual(xml, m.build().toXML().toString()); assertXmlSimilar(xml, m.build().toXML().toString());
XmlPullParser parser = TestUtils.getParser(xml); XmlPullParser parser = TestUtils.getParser(xml);
MarkupElement parsed = new MarkupElementProvider().parse(parser); MarkupElement parsed = new MarkupElementProvider().parse(parser);
@ -191,7 +191,7 @@ public class MessageMarkupTest extends SmackTestSuite {
"</markup>"; "</markup>";
MarkupElement.Builder m = MarkupElement.getBuilder(); MarkupElement.Builder m = MarkupElement.getBuilder();
m.setBlockQuote(9 ,32); m.setBlockQuote(9 ,32);
assertXMLEqual(xml, m.build().toXML().toString()); assertXmlSimilar(xml, m.build().toXML().toString());
XmlPullParser parser = TestUtils.getParser(xml); XmlPullParser parser = TestUtils.getParser(xml);
MarkupElement parsed = new MarkupElementProvider().parse(parser); MarkupElement parsed = new MarkupElementProvider().parse(parser);
@ -213,7 +213,7 @@ public class MessageMarkupTest extends SmackTestSuite {
MarkupElement.Builder m = MarkupElement.getBuilder(); MarkupElement.Builder m = MarkupElement.getBuilder();
m.setBlockQuote(0, 57); m.setBlockQuote(0, 57);
m.setBlockQuote(11, 34); m.setBlockQuote(11, 34);
assertXMLEqual(xml, m.build().toXML().toString()); assertXmlSimilar(xml, m.build().toXML().toString());
XmlPullParser parser = TestUtils.getParser(xml); XmlPullParser parser = TestUtils.getParser(xml);
MarkupElement parsed = new MarkupElementProvider().parse(parser); MarkupElement parsed = new MarkupElementProvider().parse(parser);

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.reference; package org.jivesoftware.smackx.reference;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;
@ -43,7 +43,7 @@ public class ReferenceTest extends SmackTestSuite {
"uri='xmpp:juliet@capulet.lit' />"; "uri='xmpp:juliet@capulet.lit' />";
URI uri = new URI("xmpp:juliet@capulet.lit"); URI uri = new URI("xmpp:juliet@capulet.lit");
ReferenceElement element = new ReferenceElement(72, 78, ReferenceElement.Type.mention, null, uri); ReferenceElement element = new ReferenceElement(72, 78, ReferenceElement.Type.mention, null, uri);
assertXMLEqual(xml, element.toXML().toString()); assertXmlSimilar(xml, element.toXML().toString());
assertEquals(72, (int) element.getBegin()); assertEquals(72, (int) element.getBegin());
assertEquals(78, (int) element.getEnd()); assertEquals(78, (int) element.getEnd());
assertEquals(ReferenceElement.Type.mention, element.getType()); assertEquals(ReferenceElement.Type.mention, element.getType());
@ -51,7 +51,7 @@ public class ReferenceTest extends SmackTestSuite {
assertEquals(uri, element.getUri()); assertEquals(uri, element.getUri());
ReferenceElement parsed = ReferenceProvider.TEST_PROVIDER.parse(TestUtils.getParser(xml)); ReferenceElement parsed = ReferenceProvider.TEST_PROVIDER.parse(TestUtils.getParser(xml));
assertXMLEqual(xml, parsed.toXML().toString()); assertXmlSimilar(xml, parsed.toXML().toString());
} }
/** /**
@ -66,7 +66,7 @@ public class ReferenceTest extends SmackTestSuite {
"uri='xmpp:fdp.shakespeare.lit?;node=fdp/submitted/stan.isode.net/accidentreport;item=ndina872be' />"; "uri='xmpp:fdp.shakespeare.lit?;node=fdp/submitted/stan.isode.net/accidentreport;item=ndina872be' />";
URI uri = new URI("xmpp:fdp.shakespeare.lit?;node=fdp/submitted/stan.isode.net/accidentreport;item=ndina872be"); URI uri = new URI("xmpp:fdp.shakespeare.lit?;node=fdp/submitted/stan.isode.net/accidentreport;item=ndina872be");
ReferenceElement element = new ReferenceElement(null, null, ReferenceElement.Type.data, null, uri); ReferenceElement element = new ReferenceElement(null, null, ReferenceElement.Type.data, null, uri);
assertXMLEqual(xml, element.toXML().toString()); assertXmlSimilar(xml, element.toXML().toString());
assertNull(element.getBegin()); assertNull(element.getBegin());
assertNull(element.getEnd()); assertNull(element.getEnd());
@ -75,7 +75,7 @@ public class ReferenceTest extends SmackTestSuite {
assertEquals(uri, element.getUri()); assertEquals(uri, element.getUri());
ReferenceElement parsed = ReferenceProvider.TEST_PROVIDER.parse(TestUtils.getParser(xml)); ReferenceElement parsed = ReferenceProvider.TEST_PROVIDER.parse(TestUtils.getParser(xml));
assertXMLEqual(xml, parsed.toXML().toString()); assertXmlSimilar(xml, parsed.toXML().toString());
} }
@Test @Test

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.sid; package org.jivesoftware.smackx.sid;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotNull;
@ -42,7 +42,7 @@ public class StableUniqueStanzaIdTest extends SmackTestSuite {
StanzaIdElement element = new StanzaIdElement("de305d54-75b4-431b-adb2-eb6b9e546013", "alice@wonderland.lit"); StanzaIdElement element = new StanzaIdElement("de305d54-75b4-431b-adb2-eb6b9e546013", "alice@wonderland.lit");
assertEquals("de305d54-75b4-431b-adb2-eb6b9e546013", element.getId()); assertEquals("de305d54-75b4-431b-adb2-eb6b9e546013", element.getId());
assertEquals("alice@wonderland.lit", element.getBy()); assertEquals("alice@wonderland.lit", element.getBy());
assertXMLEqual(xml, element.toXML().toString()); assertXmlSimilar(xml, element.toXML().toString());
StanzaIdElement parsed = StanzaIdProvider.INSTANCE.parse(TestUtils.getParser(xml)); StanzaIdElement parsed = StanzaIdProvider.INSTANCE.parse(TestUtils.getParser(xml));
assertEquals(element.getId(), parsed.getId()); assertEquals(element.getId(), parsed.getId());
@ -54,7 +54,7 @@ public class StableUniqueStanzaIdTest extends SmackTestSuite {
String xml = "<origin-id xmlns='urn:xmpp:sid:0' id='de305d54-75b4-431b-adb2-eb6b9e546013' />"; String xml = "<origin-id xmlns='urn:xmpp:sid:0' id='de305d54-75b4-431b-adb2-eb6b9e546013' />";
OriginIdElement element = new OriginIdElement("de305d54-75b4-431b-adb2-eb6b9e546013"); OriginIdElement element = new OriginIdElement("de305d54-75b4-431b-adb2-eb6b9e546013");
assertEquals("de305d54-75b4-431b-adb2-eb6b9e546013", element.getId()); assertEquals("de305d54-75b4-431b-adb2-eb6b9e546013", element.getId());
assertXMLEqual(xml, element.toXML().toString()); assertXmlSimilar(xml, element.toXML().toString());
OriginIdElement parsed = OriginIdProvider.INSTANCE.parse(TestUtils.getParser(xml)); OriginIdElement parsed = OriginIdProvider.INSTANCE.parse(TestUtils.getParser(xml));
assertEquals(element.getId(), parsed.getId()); assertEquals(element.getId(), parsed.getId());

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.spoiler; package org.jivesoftware.smackx.spoiler;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;
@ -48,11 +48,11 @@ public class SpoilerTest extends SmackTestSuite {
assertNull(empty.getHint()); assertNull(empty.getHint());
assertNull(empty.getLanguage()); assertNull(empty.getLanguage());
assertXMLEqual(xml, empty.toXML().toString()); assertXmlSimilar(xml, empty.toXML().toString());
XmlPullParser parser = TestUtils.getParser(xml); XmlPullParser parser = TestUtils.getParser(xml);
SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser); SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser);
assertXMLEqual(xml, parsed.toXML().toString()); assertXmlSimilar(xml, parsed.toXML().toString());
} }
@Test @Test
@ -67,12 +67,12 @@ public class SpoilerTest extends SmackTestSuite {
assertEquals("Love story end", withHint.getHint()); assertEquals("Love story end", withHint.getHint());
assertNull(withHint.getLanguage()); assertNull(withHint.getLanguage());
assertXMLEqual(xml, withHint.toXML().toString()); assertXmlSimilar(xml, withHint.toXML().toString());
XmlPullParser parser = TestUtils.getParser(xml); XmlPullParser parser = TestUtils.getParser(xml);
SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser); SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser);
assertXMLEqual(xml, parsed.toXML().toString()); assertXmlSimilar(xml, parsed.toXML().toString());
} }
@Test @Test
@ -87,13 +87,13 @@ public class SpoilerTest extends SmackTestSuite {
assertEquals("Der Kuchen ist eine Lüge!", i18nHint.getHint()); assertEquals("Der Kuchen ist eine Lüge!", i18nHint.getHint());
assertEquals("de", i18nHint.getLanguage()); assertEquals("de", i18nHint.getLanguage());
assertXMLEqual(xml, i18nHint.toXML().toString()); assertXmlSimilar(xml, i18nHint.toXML().toString());
XmlPullParser parser = TestUtils.getParser(xml); XmlPullParser parser = TestUtils.getParser(xml);
SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser); SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser);
assertEquals(i18nHint.getLanguage(), parsed.getLanguage()); assertEquals(i18nHint.getLanguage(), parsed.getLanguage());
assertXMLEqual(xml, parsed.toXML().toString()); assertXmlSimilar(xml, parsed.toXML().toString());
} }
@Test @Test

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.pubsub; package org.jivesoftware.smackx.pubsub;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
@ -206,19 +206,19 @@ public class SubscriberUseCases extends SingleUserTestCase
PayloadItem<SimplePayload> testItem = idMap.get("6-" + curTime); PayloadItem<SimplePayload> testItem = idMap.get("6-" + curTime);
assertNotNull(testItem); assertNotNull(testItem);
assertXMLEqual("<a xmlns='pubsub:test'/>", testItem.getPayload().toXML()); assertXmlSimilar("<a xmlns='pubsub:test'/>", testItem.getPayload().toXML());
testItem = idMap.get("7-" + curTime); testItem = idMap.get("7-" + curTime);
assertNotNull(testItem); assertNotNull(testItem);
assertXMLEqual("<a xmlns='pubsub:test' href=\'/up/here\'/>", testItem.getPayload().toXML()); assertXmlSimilar("<a xmlns='pubsub:test' href=\'/up/here\'/>", testItem.getPayload().toXML());
testItem = idMap.get("8-" + curTime); testItem = idMap.get("8-" + curTime);
assertNotNull(testItem); assertNotNull(testItem);
assertXMLEqual("<entity xmlns='pubsub:test'>text<inner>a</inner></entity>", testItem.getPayload().toXML()); assertXmlSimilar("<entity xmlns='pubsub:test'>text<inner>a</inner></entity>", testItem.getPayload().toXML());
testItem = idMap.get("9-" + curTime); testItem = idMap.get("9-" + curTime);
assertNotNull(testItem); assertNotNull(testItem);
assertXMLEqual("<entity xmlns='pubsub:test'><inner><text>b</text></inner></entity>", testItem.getPayload().toXML()); assertXmlSimilar("<entity xmlns='pubsub:test'><inner><text>b</text></inner></entity>", testItem.getPayload().toXML());
} }
public void testGetSpecifiedItems() throws Exception public void testGetSpecifiedItems() throws Exception
@ -239,11 +239,11 @@ public class SubscriberUseCases extends SingleUserTestCase
List<PayloadItem<SimplePayload>> items = node.getItems(ids); List<PayloadItem<SimplePayload>> items = node.getItems(ids);
assertEquals(3, items.size()); assertEquals(3, items.size());
assertEquals("1", items.get(0).getId()); assertEquals("1", items.get(0).getId());
assertXMLEqual("<a xmlns='pubsub:test' href='1'/>", items.get(0).getPayload().toXML()); assertXmlSimilar("<a xmlns='pubsub:test' href='1'/>", items.get(0).getPayload().toXML());
assertEquals( "3", items.get(1).getId()); assertEquals( "3", items.get(1).getId());
assertXMLEqual("<a xmlns='pubsub:test' href='3'/>", items.get(1).getPayload().toXML()); assertXmlSimilar("<a xmlns='pubsub:test' href='3'/>", items.get(1).getPayload().toXML());
assertEquals("4", items.get(2).getId()); assertEquals("4", items.get(2).getId());
assertXMLEqual("<a xmlns='pubsub:test' href='4'/>", items.get(2).getPayload().toXML()); assertXmlSimilar("<a xmlns='pubsub:test' href='4'/>", items.get(2).getPayload().toXML());
} }
public void testGetLastNItems() throws XMPPException public void testGetLastNItems() throws XMPPException

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.bytestreams.ibb.packet; package org.jivesoftware.smackx.bytestreams.ibb.packet;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import java.util.Properties; import java.util.Properties;
@ -81,7 +81,7 @@ public class CloseTest extends InitExtensions {
close.setTo(JidCreate.from("juliet@capulet.lit/balcony")); close.setTo(JidCreate.from("juliet@capulet.lit/balcony"));
close.setStanzaId("us71g45j"); close.setStanzaId("us71g45j");
assertXMLEqual(control, close.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, close.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
} }
} }

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.bytestreams.ibb.packet; package org.jivesoftware.smackx.bytestreams.ibb.packet;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
@ -96,7 +96,7 @@ public class DataPacketExtensionTest extends InitExtensions {
.asString(outputProperties); .asString(outputProperties);
DataPacketExtension data = new DataPacketExtension("i781hf64", 0, "DATA"); DataPacketExtension data = new DataPacketExtension("i781hf64", 0, "DATA");
assertXMLEqual(control, data.toXML().toString()); assertXmlSimilar(control, data.toXML().toString());
} }
} }

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.bytestreams.ibb.packet; package org.jivesoftware.smackx.bytestreams.ibb.packet;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
@ -78,7 +78,7 @@ public class DataTest extends InitExtensions {
data.setTo(JidCreate.from("juliet@capulet.lit/balcony")); data.setTo(JidCreate.from("juliet@capulet.lit/balcony"));
data.setStanzaId("kr91n475"); data.setStanzaId("kr91n475");
assertXMLEqual(control, data.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, data.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
} }
} }

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.bytestreams.ibb.packet; package org.jivesoftware.smackx.bytestreams.ibb.packet;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import java.util.Properties; import java.util.Properties;
@ -103,7 +103,7 @@ public class OpenTest extends InitExtensions {
open.setTo(JidCreate.from("juliet@capulet.lit/balcony")); open.setTo(JidCreate.from("juliet@capulet.lit/balcony"));
open.setStanzaId("jn3h8g65"); open.setStanzaId("jn3h8g65");
assertXMLEqual(control, open.toXML(StreamOpen.CLIENT_NAMESPACE).toString()); assertXmlSimilar(control, open.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
} }

View file

@ -18,7 +18,7 @@ package org.jivesoftware.smackx.last_interaction;
import static junit.framework.TestCase.assertEquals; import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull; import static junit.framework.TestCase.assertNotNull;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import java.util.Date; import java.util.Date;
@ -45,7 +45,7 @@ public class IdleTest extends SmackTestSuite {
assertEquals(date, parsed.getSince()); assertEquals(date, parsed.getSince());
IdleElement element = new IdleElement(date); IdleElement element = new IdleElement(date);
assertXMLEqual("<idle xmlns='urn:xmpp:idle:1' since='1969-07-21T02:56:15.000+00:00'/>", element.toXML().toString()); assertXmlSimilar("<idle xmlns='urn:xmpp:idle:1' since='1969-07-21T02:56:15.000+00:00'/>", element.toXML().toString());
} }
@Test @Test

View file

@ -19,7 +19,7 @@ package org.jivesoftware.smackx.mood;
import static junit.framework.TestCase.assertEquals; import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertFalse; import static junit.framework.TestCase.assertFalse;
import static junit.framework.TestCase.assertTrue; import static junit.framework.TestCase.assertTrue;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import org.jivesoftware.smack.provider.ProviderManager; import org.jivesoftware.smack.provider.ProviderManager;
import org.jivesoftware.smack.test.util.SmackTestSuite; import org.jivesoftware.smack.test.util.SmackTestSuite;
@ -61,11 +61,11 @@ public class MoodConcretisationTest extends SmackTestSuite {
new EcstaticMoodConcretisation()), new EcstaticMoodConcretisation()),
"Yay, the mood spec has been approved!"); "Yay, the mood spec has been approved!");
assertXMLEqual(xml, element.toXML().toString()); assertXmlSimilar(xml, element.toXML().toString());
XmlPullParser parser = TestUtils.getParser(xml); XmlPullParser parser = TestUtils.getParser(xml);
MoodElement parsed = MoodProvider.INSTANCE.parse(parser); MoodElement parsed = MoodProvider.INSTANCE.parse(parser);
assertXMLEqual(xml, parsed.toXML().toString()); assertXmlSimilar(xml, parsed.toXML().toString());
assertTrue(parsed.hasConcretisation()); assertTrue(parsed.hasConcretisation());
assertTrue(parsed.hasText()); assertTrue(parsed.hasText());

View file

@ -19,7 +19,7 @@ package org.jivesoftware.smackx.mood;
import static junit.framework.TestCase.assertEquals; import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertFalse; import static junit.framework.TestCase.assertFalse;
import static junit.framework.TestCase.assertNull; import static junit.framework.TestCase.assertNull;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import org.jivesoftware.smack.test.util.SmackTestSuite; import org.jivesoftware.smack.test.util.SmackTestSuite;
import org.jivesoftware.smack.test.util.TestUtils; import org.jivesoftware.smack.test.util.TestUtils;
@ -42,7 +42,7 @@ public class MoodElementTest extends SmackTestSuite {
"</mood>"; "</mood>";
MoodElement moodElement = new MoodElement(new MoodElement.MoodSubjectElement(Mood.happy, null), "Yay, the mood spec has been approved!"); MoodElement moodElement = new MoodElement(new MoodElement.MoodSubjectElement(Mood.happy, null), "Yay, the mood spec has been approved!");
assertXMLEqual(xml, moodElement.toXML().toString()); assertXmlSimilar(xml, moodElement.toXML().toString());
assertFalse(moodElement.hasConcretisation()); assertFalse(moodElement.hasConcretisation());
assertEquals(Mood.happy, moodElement.getMood()); assertEquals(Mood.happy, moodElement.getMood());

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.pubsub; package org.jivesoftware.smackx.pubsub;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -42,7 +42,7 @@ public class AffiliationsExtensionTest {
CharSequence xml = affiliationsExtension.toXML(); CharSequence xml = affiliationsExtension.toXML();
assertXMLEqual("<affiliations node='testNode'><affiliation xmlns='http://jabber.org/protocol/pubsub#owner' jid='one@exampleone.org' affiliation='member'/></affiliations>", assertXmlSimilar("<affiliations node='testNode'><affiliation xmlns='http://jabber.org/protocol/pubsub#owner' jid='one@exampleone.org' affiliation='member'/></affiliations>",
xml.toString()); xml.toString());
} }

View file

@ -16,7 +16,7 @@
*/ */
package org.jivesoftware.smackx.pubsub; package org.jivesoftware.smackx.pubsub;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
@ -62,15 +62,15 @@ public class ItemValidationTest extends InitExtensions {
public void verifyBasicItem() throws Exception { public void verifyBasicItem() throws Exception {
Item simpleItem = new Item(); Item simpleItem = new Item();
String simpleCtrl = "<item xmlns='http://jabber.org/protocol/pubsub' />"; String simpleCtrl = "<item xmlns='http://jabber.org/protocol/pubsub' />";
assertXMLEqual(simpleCtrl, simpleItem.toXML().toString()); assertXmlSimilar(simpleCtrl, simpleItem.toXML().toString());
Item idItem = new Item("uniqueid"); Item idItem = new Item("uniqueid");
String idCtrl = "<item xmlns='http://jabber.org/protocol/pubsub' id='uniqueid'/>"; String idCtrl = "<item xmlns='http://jabber.org/protocol/pubsub' id='uniqueid'/>";
assertXMLEqual(idCtrl, idItem.toXML().toString()); assertXmlSimilar(idCtrl, idItem.toXML().toString());
Item itemWithNodeId = new Item("testId", "testNode"); Item itemWithNodeId = new Item("testId", "testNode");
String nodeIdCtrl = "<item xmlns='http://jabber.org/protocol/pubsub' id='testId' node='testNode' />"; String nodeIdCtrl = "<item xmlns='http://jabber.org/protocol/pubsub' id='testId' node='testNode' />";
assertXMLEqual(nodeIdCtrl, itemWithNodeId.toXML().toString()); assertXmlSimilar(nodeIdCtrl, itemWithNodeId.toXML().toString());
} }
@Test @Test
@ -79,15 +79,15 @@ public class ItemValidationTest extends InitExtensions {
PayloadItem<SimplePayload> simpleItem = new PayloadItem<>(payload); PayloadItem<SimplePayload> simpleItem = new PayloadItem<>(payload);
String simpleCtrl = "<item xmlns='http://jabber.org/protocol/pubsub'>" + payload.toXML() + "</item>"; String simpleCtrl = "<item xmlns='http://jabber.org/protocol/pubsub'>" + payload.toXML() + "</item>";
assertXMLEqual(simpleCtrl, simpleItem.toXML().toString()); assertXmlSimilar(simpleCtrl, simpleItem.toXML().toString());
PayloadItem<SimplePayload> idItem = new PayloadItem<>("uniqueid", payload); PayloadItem<SimplePayload> idItem = new PayloadItem<>("uniqueid", payload);
String idCtrl = "<item xmlns='http://jabber.org/protocol/pubsub' id='uniqueid'>" + payload.toXML() + "</item>"; String idCtrl = "<item xmlns='http://jabber.org/protocol/pubsub' id='uniqueid'>" + payload.toXML() + "</item>";
assertXMLEqual(idCtrl, idItem.toXML().toString()); assertXmlSimilar(idCtrl, idItem.toXML().toString());
PayloadItem<SimplePayload> itemWithNodeId = new PayloadItem<>("testId", "testNode", payload); PayloadItem<SimplePayload> itemWithNodeId = new PayloadItem<>("testId", "testNode", payload);
String nodeIdCtrl = "<item xmlns='http://jabber.org/protocol/pubsub' id='testId' node='testNode'>" + payload.toXML() + "</item>"; String nodeIdCtrl = "<item xmlns='http://jabber.org/protocol/pubsub' id='testId' node='testNode'>" + payload.toXML() + "</item>";
assertXMLEqual(nodeIdCtrl, itemWithNodeId.toXML().toString()); assertXmlSimilar(nodeIdCtrl, itemWithNodeId.toXML().toString());
} }
@Test @Test
@ -145,7 +145,7 @@ public class ItemValidationTest extends InitExtensions {
SimplePayload payload = (SimplePayload) item.getPayload(); SimplePayload payload = (SimplePayload) item.getPayload();
assertEquals("foo", payload.getElementName()); assertEquals("foo", payload.getElementName());
assertEquals("smack:test", payload.getNamespace()); assertEquals("smack:test", payload.getNamespace());
assertXMLEqual(itemContent, payload.toXML().toString()); assertXmlSimilar(itemContent, payload.toXML().toString());
} }
@Test @Test
@ -191,7 +191,7 @@ public class ItemValidationTest extends InitExtensions {
SimplePayload payload = (SimplePayload) item.getPayload(); SimplePayload payload = (SimplePayload) item.getPayload();
assertEquals("entry", payload.getElementName()); assertEquals("entry", payload.getElementName());
assertEquals("http://www.w3.org/2005/Atom", payload.getNamespace()); assertEquals("http://www.w3.org/2005/Atom", payload.getNamespace());
assertXMLEqual(itemContent, payload.toXML().toString()); assertXmlSimilar(itemContent, payload.toXML().toString());
} }
@Test @Test
@ -226,6 +226,6 @@ public class ItemValidationTest extends InitExtensions {
assertEquals("testid1", item.getId()); assertEquals("testid1", item.getId());
assertTrue(item.getPayload() instanceof SimplePayload); assertTrue(item.getPayload() instanceof SimplePayload);
assertXMLEqual(itemContent, item.getPayload().toXML().toString()); assertXmlSimilar(itemContent, item.getPayload().toXML().toString());
} }
} }

View file

@ -18,7 +18,7 @@ package org.jivesoftware.smackx.ox;
import static junit.framework.TestCase.assertEquals; import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertNotNull; import static junit.framework.TestCase.assertNotNull;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.IOException; import java.io.IOException;
@ -72,7 +72,7 @@ public class OpenPgpElementTest extends SmackTestSuite {
OpenPgpElement element = new OpenPgpElement("BASE64_OPENPGP_MESSAGE"); OpenPgpElement element = new OpenPgpElement("BASE64_OPENPGP_MESSAGE");
assertXMLEqual(expected, element.toXML().toString()); assertXmlSimilar(expected, element.toXML().toString());
XmlPullParser parser = TestUtils.getParser(expected); XmlPullParser parser = TestUtils.getParser(expected);
OpenPgpElement parsed = OpenPgpElementProvider.TEST_INSTANCE.parse(parser); OpenPgpElement parsed = OpenPgpElementProvider.TEST_INSTANCE.parse(parser);
@ -104,7 +104,7 @@ public class OpenPgpElementTest extends SmackTestSuite {
payload.add(new Message.Body("en", "Hello World!")); payload.add(new Message.Body("en", "Hello World!"));
SignElement element = new SignElement(recipients, testDate, payload); SignElement element = new SignElement(recipients, testDate, payload);
assertXMLEqual(expected, element.toXML().toString()); assertXmlSimilar(expected, element.toXML().toString());
XmlPullParser parser = TestUtils.getParser(expected); XmlPullParser parser = TestUtils.getParser(expected);
SignElement parsed = (SignElement) OpenPgpContentElementProvider.parseOpenPgpContentElement(parser); SignElement parsed = (SignElement) OpenPgpContentElementProvider.parseOpenPgpContentElement(parser);
@ -134,7 +134,7 @@ public class OpenPgpElementTest extends SmackTestSuite {
testDate, testDate,
payload); payload);
assertXMLEqual(expected, element.toXML().toString()); assertXmlSimilar(expected, element.toXML().toString());
XmlPullParser parser = TestUtils.getParser(expected); XmlPullParser parser = TestUtils.getParser(expected);
CryptElement parsed = (CryptElement) OpenPgpContentElementProvider.parseOpenPgpContentElement(parser); CryptElement parsed = (CryptElement) OpenPgpContentElementProvider.parseOpenPgpContentElement(parser);
@ -164,7 +164,7 @@ public class OpenPgpElementTest extends SmackTestSuite {
"f0rm1l4n4-mT8y33j!Y%fRSrcd^ZE4Q7VDt1L%WEgR!kv", "f0rm1l4n4-mT8y33j!Y%fRSrcd^ZE4Q7VDt1L%WEgR!kv",
testDate, payload); testDate, payload);
assertXMLEqual(expected, element.toXML().toString()); assertXmlSimilar(expected, element.toXML().toString());
XmlPullParser parser = TestUtils.getParser(expected); XmlPullParser parser = TestUtils.getParser(expected);
SigncryptElement parsed = (SigncryptElement) OpenPgpContentElementProvider.parseOpenPgpContentElement(parser); SigncryptElement parsed = (SigncryptElement) OpenPgpContentElementProvider.parseOpenPgpContentElement(parser);

View file

@ -18,7 +18,7 @@ package org.jivesoftware.smackx.ox;
import static junit.framework.TestCase.assertEquals; import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertTrue; import static junit.framework.TestCase.assertTrue;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.Arrays; import java.util.Arrays;
@ -49,7 +49,7 @@ public class PubkeyElementTest extends SmackTestSuite {
byte[] key = "BASE64_OPENPGP_PUBLIC_KEY".getBytes(Charset.forName("UTF-8")); byte[] key = "BASE64_OPENPGP_PUBLIC_KEY".getBytes(Charset.forName("UTF-8"));
PubkeyElement element = new PubkeyElement(new PubkeyElement.PubkeyDataElement(key), date); PubkeyElement element = new PubkeyElement(new PubkeyElement.PubkeyDataElement(key), date);
assertXMLEqual(expected, element.toXML().toString()); assertXmlSimilar(expected, element.toXML().toString());
XmlPullParser parser = TestUtils.getParser(expected); XmlPullParser parser = TestUtils.getParser(expected);
PubkeyElement parsed = PubkeyElementProvider.TEST_INSTANCE.parse(parser); PubkeyElement parsed = PubkeyElementProvider.TEST_INSTANCE.parse(parser);

View file

@ -17,7 +17,7 @@
package org.jivesoftware.smackx.ox; package org.jivesoftware.smackx.ox;
import static junit.framework.TestCase.assertEquals; import static junit.framework.TestCase.assertEquals;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import java.util.Date; import java.util.Date;
@ -63,7 +63,7 @@ public class PublicKeysListElementTest extends SmackTestSuite {
.addMetadata(child2) .addMetadata(child2)
.build(); .build();
assertXMLEqual(expected, element.toXML().toString()); assertXmlSimilar(expected, element.toXML().toString());
XmlPullParser parser = TestUtils.getParser(expected); XmlPullParser parser = TestUtils.getParser(expected);
PublicKeysListElement parsed = PublicKeysListElementProvider.TEST_INSTANCE.parse(parser); PublicKeysListElement parsed = PublicKeysListElementProvider.TEST_INSTANCE.parse(parser);

View file

@ -17,7 +17,7 @@
package org.jivesoftware.smackx.ox; package org.jivesoftware.smackx.ox;
import static junit.framework.TestCase.assertTrue; import static junit.framework.TestCase.assertTrue;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual; import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.Arrays; import java.util.Arrays;
@ -43,7 +43,7 @@ public class SecretkeyElementTest extends SmackTestSuite {
SecretkeyElement element = new SecretkeyElement(key); SecretkeyElement element = new SecretkeyElement(key);
assertXMLEqual(expected, element.toXML().toString()); assertXmlSimilar(expected, element.toXML().toString());
XmlPullParser parser = TestUtils.getParser(expected); XmlPullParser parser = TestUtils.getParser(expected);
SecretkeyElement parsed = SecretkeyElementProvider.TEST_INSTANCE.parse(parser); SecretkeyElement parsed = SecretkeyElementProvider.TEST_INSTANCE.parse(parser);