diff options
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 |