summaryrefslogtreecommitdiffstats
path: root/tests/server-side/com/vaadin/data/util/ObjectPropertyTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/server-side/com/vaadin/data/util/ObjectPropertyTest.java')
-rw-r--r--tests/server-side/com/vaadin/data/util/ObjectPropertyTest.java198
1 files changed, 99 insertions, 99 deletions
diff --git a/tests/server-side/com/vaadin/data/util/ObjectPropertyTest.java b/tests/server-side/com/vaadin/data/util/ObjectPropertyTest.java
index a934b40dce..11676099e6 100644
--- a/tests/server-side/com/vaadin/data/util/ObjectPropertyTest.java
+++ b/tests/server-side/com/vaadin/data/util/ObjectPropertyTest.java
@@ -1,99 +1,99 @@
-package com.vaadin.data.util;
-
-import junit.framework.TestCase;
-
-import org.junit.Assert;
-
-import com.vaadin.data.util.ObjectProperty;
-
-public class ObjectPropertyTest extends TestCase {
-
- public static class TestSuperClass {
- private String name;
-
- public TestSuperClass(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- @Override
- public String toString() {
- return getName();
- }
- }
-
- public static class TestSubClass extends TestSuperClass {
- public TestSubClass(String name) {
- super("Subclass: " + name);
- }
- }
-
- private TestSuperClass super1 = new TestSuperClass("super1");
- private TestSubClass sub1 = new TestSubClass("sub1");
-
- public void testSimple() {
- ObjectProperty<TestSuperClass> prop1 = new ObjectProperty<TestSuperClass>(
- super1, TestSuperClass.class);
- Assert.assertEquals("super1", prop1.getValue().getName());
- prop1 = new ObjectProperty<TestSuperClass>(super1);
- Assert.assertEquals("super1", prop1.getValue().getName());
-
- ObjectProperty<TestSubClass> prop2 = new ObjectProperty<TestSubClass>(
- sub1, TestSubClass.class);
- Assert.assertEquals("Subclass: sub1", prop2.getValue().getName());
- prop2 = new ObjectProperty<TestSubClass>(sub1);
- Assert.assertEquals("Subclass: sub1", prop2.getValue().getName());
- }
-
- public void testSetValueObjectSuper() {
- ObjectProperty<TestSuperClass> prop = new ObjectProperty<TestSuperClass>(
- super1, TestSuperClass.class);
- Assert.assertEquals("super1", prop.getValue().getName());
- prop.setValue(new TestSuperClass("super2"));
- Assert.assertEquals("super1", super1.getName());
- Assert.assertEquals("super2", prop.getValue().getName());
- }
-
- public void testSetValueObjectSub() {
- ObjectProperty<TestSubClass> prop = new ObjectProperty<TestSubClass>(
- sub1, TestSubClass.class);
- Assert.assertEquals("Subclass: sub1", prop.getValue().getName());
- prop.setValue(new TestSubClass("sub2"));
- Assert.assertEquals("Subclass: sub1", sub1.getName());
- Assert.assertEquals("Subclass: sub2", prop.getValue().getName());
- }
-
- public void testSetValueStringSuper() {
- ObjectProperty<TestSuperClass> prop = new ObjectProperty<TestSuperClass>(
- super1, TestSuperClass.class);
- Assert.assertEquals("super1", prop.getValue().getName());
- prop.setValue("super2");
- Assert.assertEquals("super1", super1.getName());
- Assert.assertEquals("super2", prop.getValue().getName());
- }
-
- public void testSetValueStringSub() {
- ObjectProperty<TestSubClass> prop = new ObjectProperty<TestSubClass>(
- sub1, TestSubClass.class);
- Assert.assertEquals("Subclass: sub1", prop.getValue().getName());
- prop.setValue("sub2");
- Assert.assertEquals("Subclass: sub1", sub1.getName());
- Assert.assertEquals("Subclass: sub2", prop.getValue().getName());
- }
-
- public void testMixedGenerics() {
- ObjectProperty<TestSuperClass> prop = new ObjectProperty<TestSuperClass>(
- sub1);
- Assert.assertEquals("Subclass: sub1", prop.getValue().getName());
- Assert.assertEquals(prop.getType(), TestSubClass.class);
- // create correct subclass based on the runtime type of the instance
- // given to ObjectProperty constructor, which is a subclass of the type
- // parameter
- prop.setValue("sub2");
- Assert.assertEquals("Subclass: sub2", prop.getValue().getName());
- }
-
-}
+package com.vaadin.data.util;
+
+import junit.framework.TestCase;
+
+import org.junit.Assert;
+
+import com.vaadin.data.util.ObjectProperty;
+
+public class ObjectPropertyTest extends TestCase {
+
+ public static class TestSuperClass {
+ private String name;
+
+ public TestSuperClass(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String toString() {
+ return getName();
+ }
+ }
+
+ public static class TestSubClass extends TestSuperClass {
+ public TestSubClass(String name) {
+ super("Subclass: " + name);
+ }
+ }
+
+ private TestSuperClass super1 = new TestSuperClass("super1");
+ private TestSubClass sub1 = new TestSubClass("sub1");
+
+ public void testSimple() {
+ ObjectProperty<TestSuperClass> prop1 = new ObjectProperty<TestSuperClass>(
+ super1, TestSuperClass.class);
+ Assert.assertEquals("super1", prop1.getValue().getName());
+ prop1 = new ObjectProperty<TestSuperClass>(super1);
+ Assert.assertEquals("super1", prop1.getValue().getName());
+
+ ObjectProperty<TestSubClass> prop2 = new ObjectProperty<TestSubClass>(
+ sub1, TestSubClass.class);
+ Assert.assertEquals("Subclass: sub1", prop2.getValue().getName());
+ prop2 = new ObjectProperty<TestSubClass>(sub1);
+ Assert.assertEquals("Subclass: sub1", prop2.getValue().getName());
+ }
+
+ public void testSetValueObjectSuper() {
+ ObjectProperty<TestSuperClass> prop = new ObjectProperty<TestSuperClass>(
+ super1, TestSuperClass.class);
+ Assert.assertEquals("super1", prop.getValue().getName());
+ prop.setValue(new TestSuperClass("super2"));
+ Assert.assertEquals("super1", super1.getName());
+ Assert.assertEquals("super2", prop.getValue().getName());
+ }
+
+ public void testSetValueObjectSub() {
+ ObjectProperty<TestSubClass> prop = new ObjectProperty<TestSubClass>(
+ sub1, TestSubClass.class);
+ Assert.assertEquals("Subclass: sub1", prop.getValue().getName());
+ prop.setValue(new TestSubClass("sub2"));
+ Assert.assertEquals("Subclass: sub1", sub1.getName());
+ Assert.assertEquals("Subclass: sub2", prop.getValue().getName());
+ }
+
+ public void testSetValueStringSuper() {
+ ObjectProperty<TestSuperClass> prop = new ObjectProperty<TestSuperClass>(
+ super1, TestSuperClass.class);
+ Assert.assertEquals("super1", prop.getValue().getName());
+ prop.setValue("super2");
+ Assert.assertEquals("super1", super1.getName());
+ Assert.assertEquals("super2", prop.getValue().getName());
+ }
+
+ public void testSetValueStringSub() {
+ ObjectProperty<TestSubClass> prop = new ObjectProperty<TestSubClass>(
+ sub1, TestSubClass.class);
+ Assert.assertEquals("Subclass: sub1", prop.getValue().getName());
+ prop.setValue("sub2");
+ Assert.assertEquals("Subclass: sub1", sub1.getName());
+ Assert.assertEquals("Subclass: sub2", prop.getValue().getName());
+ }
+
+ public void testMixedGenerics() {
+ ObjectProperty<TestSuperClass> prop = new ObjectProperty<TestSuperClass>(
+ sub1);
+ Assert.assertEquals("Subclass: sub1", prop.getValue().getName());
+ Assert.assertEquals(prop.getType(), TestSubClass.class);
+ // create correct subclass based on the runtime type of the instance
+ // given to ObjectProperty constructor, which is a subclass of the type
+ // parameter
+ prop.setValue("sub2");
+ Assert.assertEquals("Subclass: sub2", prop.getValue().getName());
+ }
+
+}