1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-26 05:52:06 +01:00

Use assertXMLEqual() in SlotRequestCreateTest

This commit is contained in:
Florian Schmaus 2017-07-05 19:09:30 +02:00
parent 858ba3f82a
commit 9d63baf55a

View file

@ -16,13 +16,16 @@
*/ */
package org.jivesoftware.smackx.httpfileupload; package org.jivesoftware.smackx.httpfileupload;
import static org.custommonkey.xmlunit.XMLAssert.assertXMLEqual;
import java.io.IOException;
import org.jivesoftware.smackx.httpfileupload.element.SlotRequest; import org.jivesoftware.smackx.httpfileupload.element.SlotRequest;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.jxmpp.jid.JidTestUtil; import org.jxmpp.jid.JidTestUtil;
import org.jxmpp.stringprep.XmppStringprepException; import org.xml.sax.SAXException;
public class SlotRequestCreateTest { public class SlotRequestCreateTest {
@ -40,25 +43,25 @@ public class SlotRequestCreateTest {
+ "/>"; + "/>";
@Test @Test
public void checkSlotRequestCreation() throws XmppStringprepException { public void checkSlotRequestCreation() throws SAXException, IOException {
SlotRequest slotRequest = new SlotRequest(JidTestUtil.DOMAIN_BARE_JID_1, "my_juliet.png", 23456, "image/jpeg"); SlotRequest slotRequest = new SlotRequest(JidTestUtil.DOMAIN_BARE_JID_1, "my_juliet.png", 23456, "image/jpeg");
Assert.assertEquals("my_juliet.png", slotRequest.getFilename()); Assert.assertEquals("my_juliet.png", slotRequest.getFilename());
Assert.assertEquals(23456, slotRequest.getSize()); Assert.assertEquals(23456, slotRequest.getSize());
Assert.assertEquals("image/jpeg", slotRequest.getContentType()); Assert.assertEquals("image/jpeg", slotRequest.getContentType());
Assert.assertEquals(testRequest, slotRequest.getChildElementXML().toString()); assertXMLEqual(testRequest, slotRequest.getChildElementXML().toString());
} }
@Test @Test
public void checkSlotRequestCreationWithoutContentType() throws XmppStringprepException { public void checkSlotRequestCreationWithoutContentType() throws SAXException, IOException {
SlotRequest slotRequest = new SlotRequest(JidTestUtil.DOMAIN_BARE_JID_1, "my_romeo.png", 52523); SlotRequest slotRequest = new SlotRequest(JidTestUtil.DOMAIN_BARE_JID_1, "my_romeo.png", 52523);
Assert.assertEquals("my_romeo.png", slotRequest.getFilename()); Assert.assertEquals("my_romeo.png", slotRequest.getFilename());
Assert.assertEquals(52523, slotRequest.getSize()); Assert.assertEquals(52523, slotRequest.getSize());
Assert.assertEquals(null, slotRequest.getContentType()); Assert.assertEquals(null, slotRequest.getContentType());
Assert.assertEquals(testRequestWithoutContentType, slotRequest.getChildElementXML().toString()); assertXMLEqual(testRequestWithoutContentType, slotRequest.getChildElementXML().toString());
} }
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)