From 750cfa64b0eaa4d0fdec8658c656425d7bba1592 Mon Sep 17 00:00:00 2001 From: rcollier Date: Wed, 30 Mar 2011 02:34:21 +0000 Subject: [PATCH] Fixed bug with setting the form value in ConfigureForm.setChildrenAssociationPolicy. It was trying to set a single string value instead of a list. git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@12213 b35dd754-fafc-0310-a699-88a17e54d16e --- .../smackx/pubsub/ConfigureForm.java | 4 +++- .../smackx/pubsub/ConfigureFormTest.java | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 test-unit/org/jivesoftware/smackx/pubsub/ConfigureFormTest.java diff --git a/source/org/jivesoftware/smackx/pubsub/ConfigureForm.java b/source/org/jivesoftware/smackx/pubsub/ConfigureForm.java index 2962c9bee..7f1005e87 100644 --- a/source/org/jivesoftware/smackx/pubsub/ConfigureForm.java +++ b/source/org/jivesoftware/smackx/pubsub/ConfigureForm.java @@ -161,7 +161,9 @@ public class ConfigureForm extends Form public void setChildrenAssociationPolicy(ChildrenAssociationPolicy policy) { addField(ConfigureNodeFields.children_association_policy, FormField.TYPE_LIST_SINGLE); - setAnswer(ConfigureNodeFields.children_association_policy.getFieldName(), policy.toString()); + List values = new ArrayList(1); + values.add(policy.toString()); + setAnswer(ConfigureNodeFields.children_association_policy.getFieldName(), values); } /** diff --git a/test-unit/org/jivesoftware/smackx/pubsub/ConfigureFormTest.java b/test-unit/org/jivesoftware/smackx/pubsub/ConfigureFormTest.java new file mode 100644 index 000000000..291d16019 --- /dev/null +++ b/test-unit/org/jivesoftware/smackx/pubsub/ConfigureFormTest.java @@ -0,0 +1,16 @@ +package org.jivesoftware.smackx.pubsub; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class ConfigureFormTest +{ + @Test + public void checkChildrenAssocPolicy() + { + ConfigureForm form = new ConfigureForm(FormType.submit); + form.setChildrenAssociationPolicy(ChildrenAssociationPolicy.owners); + assertEquals(ChildrenAssociationPolicy.owners, form.getChildrenAssociationPolicy()); + } +}