summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'test/com/isode/stroke/serializer/AuthResponseSerializerTest.java')
-rw-r--r--test/com/isode/stroke/serializer/AuthResponseSerializerTest.java62
1 files changed, 62 insertions, 0 deletions
diff --git a/test/com/isode/stroke/serializer/AuthResponseSerializerTest.java b/test/com/isode/stroke/serializer/AuthResponseSerializerTest.java
new file mode 100644
index 0000000..9b0fe71
--- /dev/null
+++ b/test/com/isode/stroke/serializer/AuthResponseSerializerTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+import com.isode.stroke.serializer.AuthResponseSerializer;
+import com.isode.stroke.elements.AuthResponse;
+import com.isode.stroke.base.ByteArray;
+
+public class AuthResponseSerializerTest {
+
+ /**
+ * Default Constructor.
+ */
+ public AuthResponseSerializerTest() {
+
+ }
+
+ @Test
+ public void testSerialize() {
+ AuthResponseSerializer testling = new AuthResponseSerializer();
+ AuthResponse authResponse = new AuthResponse();
+ authResponse.setValue(new ByteArray("foo"));
+
+ assertEquals(
+ "<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">" +
+ "Zm9v" +
+ "</response>", testling.serialize(authResponse));
+ }
+
+ @Test
+ public void testSerialize_NoMessage() {
+ AuthResponseSerializer testling = new AuthResponseSerializer();
+ AuthResponse authResponse = new AuthResponse();
+
+ assertEquals(
+ "<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">" +
+ "</response>", testling.serialize(authResponse));
+ }
+
+ @Test
+ public void testSerialize_EmptyMessage() {
+ AuthResponseSerializer testling = new AuthResponseSerializer();
+ AuthResponse authResponse = new AuthResponse();
+ authResponse.setValue(new ByteArray());
+
+ assertEquals(
+ "<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">" +
+ "" +
+ "</response>", testling.serialize(authResponse));
+ }
+} \ No newline at end of file