diff options
author | Tarun Gupta <tarun1995gupta@gmail.com> | 2015-06-03 12:17:53 (GMT) |
---|---|---|
committer | Tarun Gupta <tarun1995gupta@gmail.com> | 2015-06-14 13:30:22 (GMT) |
commit | afaf2c8e7a9276bc4a61337357092c49e6817159 (patch) | |
tree | 143b1551c29c4158403c956e175861de71bbf0d8 /test/com | |
parent | cae0635287b9ccf0d846dffd550440b347bd6721 (diff) | |
download | stroke-afaf2c8e7a9276bc4a61337357092c49e6817159.zip stroke-afaf2c8e7a9276bc4a61337357092c49e6817159.tar.bz2 |
Add VCardUpdate Element.
Adds the VCardUpdate Element, VCardUpdate Parser, VCardUpdateSerializer.
License:
This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Test-Information:
Tests ported for VCardUpdateParser and VCardUpdateSerializer, which passes.
Change-Id: I9baf8f6787567c8766b52dbe70105e8870c02b2d
Diffstat (limited to 'test/com')
-rw-r--r-- | test/com/isode/stroke/parser/payloadparsers/VCardUpdateParserTest.java | 35 | ||||
-rw-r--r-- | test/com/isode/stroke/serializer/payloadserializers/VCardUpdateSerializerTest.java | 30 |
2 files changed, 65 insertions, 0 deletions
diff --git a/test/com/isode/stroke/parser/payloadparsers/VCardUpdateParserTest.java b/test/com/isode/stroke/parser/payloadparsers/VCardUpdateParserTest.java new file mode 100644 index 0000000..d8ee2a5 --- /dev/null +++ b/test/com/isode/stroke/parser/payloadparsers/VCardUpdateParserTest.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2010 Isode Limited. + * All rights reserved. + * See the COPYING file 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.assertTrue; +import static org.junit.Assert.assertEquals; + +import org.junit.BeforeClass; +import org.junit.Test; +import com.isode.stroke.elements.VCardUpdate; +import com.isode.stroke.elements.Payload; +import com.isode.stroke.parser.payloadparsers.VCardUpdateParser; +import com.isode.stroke.parser.payloadparsers.PayloadsParserTester; +import com.isode.stroke.eventloop.DummyEventLoop; + +public class VCardUpdateParserTest { + + @Test + public void testParse() { + DummyEventLoop eventLoop = new DummyEventLoop(); + PayloadsParserTester parser = new PayloadsParserTester(eventLoop); + assertTrue(parser.parse("<x xmlns='vcard-temp:x:update'><photo>sha1-hash-of-image</photo></x>")); + VCardUpdate payload = (VCardUpdate)parser.getPayload(); + assertEquals("sha1-hash-of-image", payload.getPhotoHash()); + } +}
\ No newline at end of file diff --git a/test/com/isode/stroke/serializer/payloadserializers/VCardUpdateSerializerTest.java b/test/com/isode/stroke/serializer/payloadserializers/VCardUpdateSerializerTest.java new file mode 100644 index 0000000..e6573bb --- /dev/null +++ b/test/com/isode/stroke/serializer/payloadserializers/VCardUpdateSerializerTest.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2010 Isode Limited. + * All rights reserved. + * See the COPYING file 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.serializer.payloadserializers; + +import static org.junit.Assert.assertEquals; +import org.junit.BeforeClass; +import org.junit.Test; +import com.isode.stroke.elements.VCardUpdate; +import com.isode.stroke.serializer.payloadserializers.VCardUpdateSerializer; + +public class VCardUpdateSerializerTest { + + @Test + public void testSerialize() { + VCardUpdateSerializer testling = new VCardUpdateSerializer(); + VCardUpdate update = new VCardUpdate(); + update.setPhotoHash("sha1-hash-of-image"); + String expectedResult = "<x xmlns=\"vcard-temp:x:update\"><photo>sha1-hash-of-image</photo></x>"; + assertEquals(expectedResult, testling.serialize(update)); + } +}
\ No newline at end of file |