summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMili Verma <mili.verma@isode.com>2012-01-06 15:00:55 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-01-09 15:54:52 (GMT)
commitcc760bfd15caadb56bfef477cb54dc94c25f7fa7 (patch)
tree05f5918b97488b05ca1266c0644a3874adb98129 /test/com/isode/stroke/elements
parent12b1d667965556002ea0fd300a71bcdf57634e90 (diff)
downloadstroke-cc760bfd15caadb56bfef477cb54dc94c25f7fa7.zip
stroke-cc760bfd15caadb56bfef477cb54dc94c25f7fa7.tar.bz2
Port Adhoc commands to Stroke
This patch ports the Adhoc commands from Swiften to Stroke. It also ports their unit tests. Test-information: Unit tests pass. MLC able to use the ad-hoc command fine.
Diffstat (limited to 'test/com/isode/stroke/elements')
-rw-r--r--test/com/isode/stroke/elements/FormTest.java59
1 files changed, 59 insertions, 0 deletions
diff --git a/test/com/isode/stroke/elements/FormTest.java b/test/com/isode/stroke/elements/FormTest.java
new file mode 100644
index 0000000..1d37c86
--- /dev/null
+++ b/test/com/isode/stroke/elements/FormTest.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2012 Isode Limited, London, England.
+ * All rights reserved.
+ */
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * All rights reserved.
+ */
+
+package com.isode.stroke.elements;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.isode.stroke.elements.FormField.FixedFormField;
+import com.isode.stroke.elements.FormField.HiddenFormField;
+
+public class FormTest {
+ @BeforeClass
+ public static void init() throws Exception {
+ }
+
+ @Test
+ public void testGetFormType() {
+ Form form = new Form();
+
+ form.addField(FixedFormField.create("Foo"));
+
+ FormField field = HiddenFormField.create("jabber:bot");
+ field.setName("FORM_TYPE");
+ form.addField(field);
+
+ form.addField(FixedFormField.create("Bar"));
+
+ assertEquals("jabber:bot", form.getFormType());
+ }
+
+ @Test
+ public void testGetFormType_InvalidFormType() {
+ Form form = new Form();
+
+ FormField field = FixedFormField.create("jabber:bot");
+ field.setName("FORM_TYPE");
+ form.addField(field);
+
+ assertEquals("", form.getFormType());
+ }
+
+ @Test
+ public void testGetFormType_NoFormType() {
+ Form form = new Form();
+
+ form.addField(FixedFormField.create("Foo"));
+
+ assertEquals("", form.getFormType());
+ }
+}