summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorTarun Gupta <tarun1995gupta@gmail.com>2015-03-18 10:36:41 (GMT)
committerKevin Smith <git@kismith.co.uk>2015-03-19 18:28:55 (GMT)
commitd62c9ba2dad0d9833c76452b5aa780a215548a5e (patch)
treeff0ad21e1394dc2202c1d1e14d169c577a313b96 /test
parent07117577091cee230bb0da8245856e19a9c7da8c (diff)
downloadstroke-d62c9ba2dad0d9833c76452b5aa780a215548a5e.zip
stroke-d62c9ba2dad0d9833c76452b5aa780a215548a5e.tar.bz2
Add functionality for ChatState.
Adds the Element, Parser, Serializer, ChatStateTracker and ChatStateSerializerTest. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Ported serializer test from Swiften, which passes. Change-Id: I314eda2db0f2be0499f8aa74d043319fb5cf57a8
Diffstat (limited to 'test')
-rw-r--r--test/com/isode/stroke/serializer/payloadserializers/ChatStateSerializerTest.java53
1 files changed, 53 insertions, 0 deletions
diff --git a/test/com/isode/stroke/serializer/payloadserializers/ChatStateSerializerTest.java b/test/com/isode/stroke/serializer/payloadserializers/ChatStateSerializerTest.java
new file mode 100644
index 0000000..50ee188
--- /dev/null
+++ b/test/com/isode/stroke/serializer/payloadserializers/ChatStateSerializerTest.java
@@ -0,0 +1,53 @@
+/*
+ * 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.ChatState;
+import com.isode.stroke.serializer.payloadserializers.ChatStateSerializer;
+
+public class ChatStateSerializerTest {
+
+ ChatStateSerializer testling = new ChatStateSerializer();
+
+ @Test
+ public void testSerialize_ActiveState() {
+ ChatState priority = new ChatState(ChatState.ChatStateType.Active);
+ String expected = "<active xmlns=\"http://jabber.org/protocol/chatstates\"/>";
+ assertEquals(expected, testling.serialize(priority));
+ }
+
+ @Test
+ public void testSerialize_GoneState() {
+ ChatState priority = new ChatState(ChatState.ChatStateType.Gone);
+ String expected = "<gone xmlns=\"http://jabber.org/protocol/chatstates\"/>";
+ assertEquals(expected, testling.serialize(priority));
+ }
+
+ @Test
+ public void testSerialize_ComposingState() {
+ ChatState priority = new ChatState(ChatState.ChatStateType.Composing);
+ String expected = "<composing xmlns=\"http://jabber.org/protocol/chatstates\"/>";
+ assertEquals(expected, testling.serialize(priority));
+ }
+
+ @Test
+ public void testSerialize_PausedState() {
+ ChatState priority = new ChatState(ChatState.ChatStateType.Paused);
+ String expected = "<paused xmlns=\"http://jabber.org/protocol/chatstates\"/>";
+ assertEquals(expected, testling.serialize(priority));
+ }
+
+ @Test
+ public void testSerialize_InactiveState() {
+ ChatState priority = new ChatState(ChatState.ChatStateType.Inactive);
+ String expected = "<inactive xmlns=\"http://jabber.org/protocol/chatstates\"/>";
+ assertEquals(expected, testling.serialize(priority));
+ }
+} \ No newline at end of file