diff options
author | Tim Robbings <tim.robbings@isode.com> | 2014-11-27 17:22:23 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2014-12-14 15:02:38 (GMT) |
commit | e327b17aa54430284e67af3accf90f45430f74d6 (patch) | |
tree | 552ada79ce95c85e020d2c7437e29e772500814a /test/com | |
parent | 62faa5c8f718399e7e947be04ee04bc942251ea3 (diff) | |
download | stroke-e327b17aa54430284e67af3accf90f45430f74d6.zip stroke-e327b17aa54430284e67af3accf90f45430f74d6.tar.bz2 |
Changes to improve handling of unknown field types
Change to mirror Swiften code. This change removes some unnecessary code from
the FormSerializer class. It also includes changes to the FormField class to
improve the handling of 'unknown' form fields.
Test-information:
Tested using updatedJUnit tests, all tests complete successfully.
Change-Id: Ie28ed40be976704170525f7be20b8e08661536b6
Diffstat (limited to 'test/com')
-rw-r--r-- | test/com/isode/stroke/serializer/payloadserializers/FormSerializerTest.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/test/com/isode/stroke/serializer/payloadserializers/FormSerializerTest.java b/test/com/isode/stroke/serializer/payloadserializers/FormSerializerTest.java index 7b16aa4..d7347cb 100644 --- a/test/com/isode/stroke/serializer/payloadserializers/FormSerializerTest.java +++ b/test/com/isode/stroke/serializer/payloadserializers/FormSerializerTest.java @@ -51,6 +51,11 @@ public class FormSerializerTest { field.addValue("someText"); form.addReportedField(field); + field = new FormField(FormField.Type.TEXT_MULTI_TYPE); + field.setLabel("text-multi-field"); + field.setTextMultiValue("This is some text\nthis is some more"); + form.addField(field); + FormItem item = new FormItem(); field = new FormField(FormField.Type.UNKNOWN_TYPE); field.setName("itemField"); @@ -69,8 +74,8 @@ public class FormSerializerTest { field.setLabel("The name of your bot"); form.addField(field); - field = new FormField(FormField.Type.TEXT_MULTI_TYPE, - "This is a bot.\nA quite good one actually"); + field = new FormField(FormField.Type.TEXT_MULTI_TYPE); + field.setTextMultiValue("This is a bot.\nA quite good one actually"); field.setName("description"); field.setLabel("Helpful description of your bot"); form.addField(field); @@ -129,7 +134,7 @@ public class FormSerializerTest { assertEquals( "<x type=\"form\" xmlns=\"jabber:x:data\">" + "<reported>" - + "<field label=\"description\" type=\"unknown\" var=\"field name\">" + + "<field label=\"description\" var=\"field name\">" + "<value>someText</value>" + "</field>" + "</reported>" @@ -138,17 +143,20 @@ public class FormSerializerTest { + "<value>itemValue</value>" + "</field>" + "</item>" + + "<field label=\"text-multi-field\" type=\"text-multi\">" + + "<value>This is some text</value><value>this is some more</value>" + + "</field>" + "<field type=\"hidden\" var=\"FORM_TYPE\">" + "<value>jabber:bot</value>" + "</field>" + "<field type=\"fixed\"><value>Section 1: Bot Info</value></field>" - + "<field label=\"The name of your bot\" type=\"text-single\" var=\"botname\"><value></value></field>" + + "<field label=\"The name of your bot\" type=\"text-single\" var=\"botname\"/>" + "<field label=\"Helpful description of your bot\" type=\"text-multi\" var=\"description\"><value>This is a bot.</value><value>A quite good one actually</value></field>" + "<field label=\"Public bot?\" type=\"boolean\" var=\"public\">" + "<required/>" + "<value>1</value>" + "</field>" - + "<field label=\"Password for special access\" type=\"text-private\" var=\"password\"><value></value></field>" + + "<field label=\"Password for special access\" type=\"text-private\" var=\"password\"/>" + "<field label=\"What features will the bot support?\" type=\"list-multi\" var=\"features\">" + "<value>news</value>" + "<value>search</value>" |