You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ReflectToolsGetSuperFieldTest.java 952B

1234567891011121314151617181920212223242526272829303132333435
  1. package com.vaadin.data.util;
  2. import static org.junit.Assert.assertTrue;
  3. import org.junit.Test;
  4. import com.vaadin.data.fieldgroup.FieldGroup;
  5. import com.vaadin.data.fieldgroup.PropertyId;
  6. import com.vaadin.v7.ui.LegacyTextField;
  7. public class ReflectToolsGetSuperFieldTest {
  8. @Test
  9. public void getFieldFromSuperClass() {
  10. class MyClass {
  11. @PropertyId("testProperty")
  12. LegacyTextField test = new LegacyTextField("This is a test");
  13. }
  14. class MySubClass extends MyClass {
  15. // no fields here
  16. }
  17. PropertysetItem item = new PropertysetItem();
  18. item.addItemProperty("testProperty",
  19. new ObjectProperty<String>("Value of testProperty"));
  20. MySubClass form = new MySubClass();
  21. FieldGroup binder = new FieldGroup(item);
  22. binder.bindMemberFields(form);
  23. assertTrue("Value of testProperty".equals(form.test.getValue()));
  24. }
  25. }