summaryrefslogtreecommitdiffstats
path: root/server/tests
diff options
context:
space:
mode:
authorJonni Nakari <jonni@vaadin.com>2012-12-13 14:58:18 +0200
committerVaadin Code Review <review@vaadin.com>2012-12-17 11:47:31 +0000
commit5c8d4c1f5dfa4f6fb2e73728e2c0512d3e5c7446 (patch)
treed25b563dab029a28e89279ea24a1be2277f3950f /server/tests
parentc7070fc5754213b5d55c3db2d0fa52917f3bb544 (diff)
downloadvaadin-framework-5c8d4c1f5dfa4f6fb2e73728e2c0512d3e5c7446.tar.gz
vaadin-framework-5c8d4c1f5dfa4f6fb2e73728e2c0512d3e5c7446.zip
Search fields from superclasses #10504
Modified buildAndBindMemberFields method to use a new getFieldsInDeclareOrder method that searches fields also from superclasses. Added a unit test to verify the new logic. Fixes the issue in ticket #10504 Change-Id: Ic855e274c5b4d1c83760d6c2c53c67413a1da42c
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/src/com/vaadin/data/util/ReflectToolsGetSuperField.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/server/tests/src/com/vaadin/data/util/ReflectToolsGetSuperField.java b/server/tests/src/com/vaadin/data/util/ReflectToolsGetSuperField.java
new file mode 100644
index 0000000000..efba6085ac
--- /dev/null
+++ b/server/tests/src/com/vaadin/data/util/ReflectToolsGetSuperField.java
@@ -0,0 +1,34 @@
+package com.vaadin.data.util;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.vaadin.data.fieldgroup.FieldGroup;
+import com.vaadin.data.fieldgroup.PropertyId;
+import com.vaadin.ui.TextField;
+
+public class ReflectToolsGetSuperField {
+
+ @Test
+ public void getFieldFromSuperClass() {
+ class MyClass {
+ @PropertyId("testProperty")
+ TextField test = new TextField("This is a test");
+ }
+ class MySubClass extends MyClass {
+ // no fields here
+ }
+
+ PropertysetItem item = new PropertysetItem();
+ item.addItemProperty("testProperty", new ObjectProperty<String>("Value of testProperty"));
+
+ MySubClass form = new MySubClass();
+
+ FieldGroup binder = new FieldGroup(item);
+ binder.bindMemberFields(form);
+
+ assertTrue("Value of testProperty".equals(form.test.getValue()));
+ }
+
+}