diff options
author | Tarun Gupta <tarun1995gupta@gmail.com> | 2015-06-21 12:33:44 (GMT) |
---|---|---|
committer | Tarun Gupta <tarun1995gupta@gmail.com> | 2015-06-30 13:24:34 (GMT) |
commit | 25fade1995f559c8937b57585f462aaa2ae01c6a (patch) | |
tree | 008b432b08decc871f07bece2bc4307c033a6651 /test/com/isode/stroke/parser/payloadparsers/DeliveryReceiptParserTest.java | |
parent | b830f64de47271777d8e45ddb0a18dc2ac740dd9 (diff) | |
download | stroke-25fade1995f559c8937b57585f462aaa2ae01c6a.zip stroke-25fade1995f559c8937b57585f462aaa2ae01c6a.tar.bz2 |
Add tests for Payloads Parsers and Payloads Serializers.
Updates DiscoInfoParser, DiscoItemsParser and VCard Element.
License:
This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Test-Information:
Test are added for:
DeliveryReceipt Parser and Serializer.
DiscoInfo Parser and Serializer, DiscoItemsParser.
Replace Parser and Serializer.
ResourceBind Parser and Serializer.
SecurityLabel Parser and Serializer.
SecurityLabelsCatalog Parser and Serializer.
Status Parser and Serializer.
StatusShow Parser and Serializer.
SoftwareVersion Parser and Serializer.
VCard Parser and Serializer.
All tests passes.
Change-Id: I8023372273e63813e1c8fe708fa6cdf39614e1f7
Diffstat (limited to 'test/com/isode/stroke/parser/payloadparsers/DeliveryReceiptParserTest.java')
-rw-r--r-- | test/com/isode/stroke/parser/payloadparsers/DeliveryReceiptParserTest.java | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/test/com/isode/stroke/parser/payloadparsers/DeliveryReceiptParserTest.java b/test/com/isode/stroke/parser/payloadparsers/DeliveryReceiptParserTest.java new file mode 100644 index 0000000..fc74067 --- /dev/null +++ b/test/com/isode/stroke/parser/payloadparsers/DeliveryReceiptParserTest.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2011 Tobias Markmann + * Licensed under the BSD license. + * See http://www.opensource.org/licenses/bsd-license.php for more information. + */ +/* + * Copyright (c) 2015 Tarun Gupta. + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +package com.isode.stroke.parser.payloadparsers; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import org.junit.Test; +import com.isode.stroke.elements.DeliveryReceiptRequest; +import com.isode.stroke.elements.DeliveryReceipt; +import com.isode.stroke.parser.payloadparsers.DeliveryReceiptParser; +import com.isode.stroke.parser.payloadparsers.DeliveryReceiptRequestParser; +import com.isode.stroke.parser.payloadparsers.PayloadsParserTester; +import com.isode.stroke.eventloop.DummyEventLoop; + +public class DeliveryReceiptParserTest { + + public DeliveryReceiptParserTest() { + + } + + @Test + public void testParseXEP0184Example3() { + DummyEventLoop eventLoop = new DummyEventLoop(); + PayloadsParserTester parser = new PayloadsParserTester(eventLoop); + assertNotNull(parser.parse("<request xmlns='urn:xmpp:receipts'/>")); + + DeliveryReceiptRequest request = (DeliveryReceiptRequest)(parser.getPayload()); + + assertNotNull(request); + } + + @Test + public void testParseXEP0184Example4() { + DummyEventLoop eventLoop = new DummyEventLoop(); + PayloadsParserTester parser = new PayloadsParserTester(eventLoop); + assertNotNull(parser.parse("<received xmlns='urn:xmpp:receipts' id='richard2-4.1.247'/>")); + + DeliveryReceipt receipt = (DeliveryReceipt)(parser.getPayload()); + + assertEquals("richard2-4.1.247", receipt.getReceivedID()); + } +}
\ No newline at end of file |