summaryrefslogtreecommitdiffstats
path: root/tests/server-side
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2011-11-10 16:06:30 +0200
committerHenri Sara <hesara@vaadin.com>2011-11-10 16:06:30 +0200
commit63fc9d04820822e60f7ac5946344d32711a55e2c (patch)
tree18b26542948acfb19ddf252e59a064ab4c31aef8 /tests/server-side
parent72d6c3cfb822badcf0463a99fd9a6c761bd22525 (diff)
downloadvaadin-framework-63fc9d04820822e60f7ac5946344d32711a55e2c.tar.gz
vaadin-framework-63fc9d04820822e60f7ac5946344d32711a55e2c.zip
Eliminate many generics related warnings in tests.
Most of the warnings eliminated are related to generics for Property, Field or field factories. Not all such warnings are eliminated in this changeset.
Diffstat (limited to 'tests/server-side')
-rw-r--r--tests/server-side/com/vaadin/data/util/BeanItemTest.java7
-rw-r--r--tests/server-side/com/vaadin/data/util/NestedMethodPropertyTest.java89
-rw-r--r--tests/server-side/com/vaadin/data/util/PropertyDescriptorTest.java5
-rw-r--r--tests/server-side/com/vaadin/data/util/filter/AndOrFilterTest.java4
-rw-r--r--tests/server-side/com/vaadin/data/util/filter/CompareFilterTest.java2
-rw-r--r--tests/server-side/com/vaadin/data/util/filter/IsNullFilterTest.java4
-rw-r--r--tests/server-side/com/vaadin/data/util/filter/NotFilterTest.java4
-rw-r--r--tests/server-side/com/vaadin/data/util/filter/SimpleStringFilterTest.java5
-rw-r--r--tests/server-side/com/vaadin/tests/server/TestSerialization.java2
-rw-r--r--tests/server-side/com/vaadin/tests/server/component/textfield/TextFieldWithPropertyFormatter.java14
10 files changed, 62 insertions, 74 deletions
diff --git a/tests/server-side/com/vaadin/data/util/BeanItemTest.java b/tests/server-side/com/vaadin/data/util/BeanItemTest.java
index 044a410803..51e11260f5 100644
--- a/tests/server-side/com/vaadin/data/util/BeanItemTest.java
+++ b/tests/server-side/com/vaadin/data/util/BeanItemTest.java
@@ -12,11 +12,6 @@ import java.util.Map;
import junit.framework.Assert;
import junit.framework.TestCase;
-import com.vaadin.data.util.BeanItem;
-import com.vaadin.data.util.MethodProperty;
-import com.vaadin.data.util.MethodPropertyDescriptor;
-import com.vaadin.data.util.VaadinPropertyDescriptor;
-
/**
* Test BeanItem specific features.
*
@@ -322,7 +317,7 @@ public class BeanItemTest extends TestCase {
MyClass.class.getDeclaredMethod("getName"),
MyClass.class.getDeclaredMethod("setName", String.class));
- BeanItem<MyClass> item = new BeanItem(new MyClass("bean1"));
+ BeanItem<MyClass> item = new BeanItem<MyClass>(new MyClass("bean1"));
Assert.assertEquals(6, item.getItemPropertyIds().size());
Assert.assertEquals(null, item.getItemProperty("myname"));
diff --git a/tests/server-side/com/vaadin/data/util/NestedMethodPropertyTest.java b/tests/server-side/com/vaadin/data/util/NestedMethodPropertyTest.java
index b110ea1c6b..640ede8743 100644
--- a/tests/server-side/com/vaadin/data/util/NestedMethodPropertyTest.java
+++ b/tests/server-side/com/vaadin/data/util/NestedMethodPropertyTest.java
@@ -10,8 +10,6 @@ import java.io.Serializable;
import junit.framework.Assert;
import junit.framework.TestCase;
-import com.vaadin.data.util.NestedMethodProperty;
-
public class NestedMethodPropertyTest extends TestCase {
public static class Address implements Serializable {
@@ -126,34 +124,34 @@ public class NestedMethodPropertyTest extends TestCase {
}
public void testSingleLevelNestedSimpleProperty() {
- NestedMethodProperty nameProperty = new NestedMethodProperty(vaadin,
- "name");
+ NestedMethodProperty<String> nameProperty = new NestedMethodProperty<String>(
+ vaadin, "name");
Assert.assertEquals(String.class, nameProperty.getType());
Assert.assertEquals("Vaadin", nameProperty.getValue());
}
public void testSingleLevelNestedObjectProperty() {
- NestedMethodProperty managerProperty = new NestedMethodProperty(vaadin,
- "manager");
+ NestedMethodProperty<Person> managerProperty = new NestedMethodProperty<Person>(
+ vaadin, "manager");
Assert.assertEquals(Person.class, managerProperty.getType());
Assert.assertEquals(joonas, managerProperty.getValue());
}
public void testMultiLevelNestedProperty() {
- NestedMethodProperty managerNameProperty = new NestedMethodProperty(
+ NestedMethodProperty<String> managerNameProperty = new NestedMethodProperty<String>(
vaadin, "manager.name");
- NestedMethodProperty addressProperty = new NestedMethodProperty(vaadin,
- "manager.address");
- NestedMethodProperty streetProperty = new NestedMethodProperty(vaadin,
- "manager.address.street");
- NestedMethodProperty postalCodePrimitiveProperty = new NestedMethodProperty(
+ NestedMethodProperty<Address> addressProperty = new NestedMethodProperty<Address>(
+ vaadin, "manager.address");
+ NestedMethodProperty<String> streetProperty = new NestedMethodProperty<String>(
+ vaadin, "manager.address.street");
+ NestedMethodProperty<Integer> postalCodePrimitiveProperty = new NestedMethodProperty<Integer>(
vaadin, "manager.address.postalCodePrimitive");
- NestedMethodProperty postalCodeObjectProperty = new NestedMethodProperty(
+ NestedMethodProperty<Integer> postalCodeObjectProperty = new NestedMethodProperty<Integer>(
vaadin, "manager.address.postalCodeObject");
- NestedMethodProperty booleanProperty = new NestedMethodProperty(vaadin,
- "manager.address.boolean");
+ NestedMethodProperty<Boolean> booleanProperty = new NestedMethodProperty<Boolean>(
+ vaadin, "manager.address.boolean");
Assert.assertEquals(String.class, managerNameProperty.getType());
Assert.assertEquals("Joonas", managerNameProperty.getValue());
@@ -166,25 +164,27 @@ public class NestedMethodPropertyTest extends TestCase {
Assert.assertEquals(Integer.class,
postalCodePrimitiveProperty.getType());
- Assert.assertEquals(20540, postalCodePrimitiveProperty.getValue());
+ Assert.assertEquals(Integer.valueOf(20540),
+ postalCodePrimitiveProperty.getValue());
Assert.assertEquals(Integer.class, postalCodeObjectProperty.getType());
- Assert.assertEquals(20540, postalCodeObjectProperty.getValue());
+ Assert.assertEquals(Integer.valueOf(20540),
+ postalCodeObjectProperty.getValue());
Assert.assertEquals(Boolean.class, booleanProperty.getType());
- Assert.assertEquals(true, booleanProperty.getValue());
+ Assert.assertEquals(Boolean.TRUE, booleanProperty.getValue());
}
public void testEmptyPropertyName() {
try {
- new NestedMethodProperty(vaadin, "");
+ new NestedMethodProperty<Object>(vaadin, "");
fail();
} catch (IllegalArgumentException e) {
// should get exception
}
try {
- new NestedMethodProperty(vaadin, " ");
+ new NestedMethodProperty<Object>(vaadin, " ");
fail();
} catch (IllegalArgumentException e) {
// should get exception
@@ -193,25 +193,25 @@ public class NestedMethodPropertyTest extends TestCase {
public void testInvalidPropertyName() {
try {
- new NestedMethodProperty(vaadin, ".");
+ new NestedMethodProperty<Object>(vaadin, ".");
fail();
} catch (IllegalArgumentException e) {
// should get exception
}
try {
- new NestedMethodProperty(vaadin, ".manager");
+ new NestedMethodProperty<Object>(vaadin, ".manager");
fail();
} catch (IllegalArgumentException e) {
// should get exception
}
try {
- new NestedMethodProperty(vaadin, "manager.");
+ new NestedMethodProperty<Object>(vaadin, "manager.");
fail();
} catch (IllegalArgumentException e) {
// should get exception
}
try {
- new NestedMethodProperty(vaadin, "manager..name");
+ new NestedMethodProperty<Object>(vaadin, "manager..name");
fail();
} catch (IllegalArgumentException e) {
// should get exception
@@ -220,21 +220,21 @@ public class NestedMethodPropertyTest extends TestCase {
public void testInvalidNestedPropertyName() {
try {
- new NestedMethodProperty(vaadin, "member");
+ new NestedMethodProperty<Object>(vaadin, "member");
fail();
} catch (IllegalArgumentException e) {
// should get exception
}
try {
- new NestedMethodProperty(vaadin, "manager.pet");
+ new NestedMethodProperty<Object>(vaadin, "manager.pet");
fail();
} catch (IllegalArgumentException e) {
// should get exception
}
try {
- new NestedMethodProperty(vaadin, "manager.address.city");
+ new NestedMethodProperty<Object>(vaadin, "manager.address.city");
fail();
} catch (IllegalArgumentException e) {
// should get exception
@@ -242,10 +242,10 @@ public class NestedMethodPropertyTest extends TestCase {
}
public void testNullNestedProperty() {
- NestedMethodProperty managerNameProperty = new NestedMethodProperty(
+ NestedMethodProperty<String> managerNameProperty = new NestedMethodProperty<String>(
vaadin, "manager.name");
- NestedMethodProperty streetProperty = new NestedMethodProperty(vaadin,
- "manager.address.street");
+ NestedMethodProperty<String> streetProperty = new NestedMethodProperty<String>(
+ vaadin, "manager.address.street");
joonas.setAddress(null);
try {
@@ -274,15 +274,15 @@ public class NestedMethodPropertyTest extends TestCase {
}
public void testMultiLevelNestedPropertySetValue() {
- NestedMethodProperty managerNameProperty = new NestedMethodProperty(
+ NestedMethodProperty<String> managerNameProperty = new NestedMethodProperty<String>(
vaadin, "manager.name");
- NestedMethodProperty addressProperty = new NestedMethodProperty(vaadin,
- "manager.address");
- NestedMethodProperty streetProperty = new NestedMethodProperty(vaadin,
- "manager.address.street");
- NestedMethodProperty postalCodePrimitiveProperty = new NestedMethodProperty(
+ NestedMethodProperty<Address> addressProperty = new NestedMethodProperty<Address>(
+ vaadin, "manager.address");
+ NestedMethodProperty<String> streetProperty = new NestedMethodProperty<String>(
+ vaadin, "manager.address.street");
+ NestedMethodProperty<Integer> postalCodePrimitiveProperty = new NestedMethodProperty<Integer>(
vaadin, "manager.address.postalCodePrimitive");
- NestedMethodProperty postalCodeObjectProperty = new NestedMethodProperty(
+ NestedMethodProperty<Integer> postalCodeObjectProperty = new NestedMethodProperty<Integer>(
vaadin, "manager.address.postalCodeObject");
managerNameProperty.setValue("Joonas L");
@@ -303,21 +303,22 @@ public class NestedMethodPropertyTest extends TestCase {
}
public void testSerialization() throws IOException, ClassNotFoundException {
- NestedMethodProperty streetProperty = new NestedMethodProperty(vaadin,
- "manager.address.street");
+ NestedMethodProperty<String> streetProperty = new NestedMethodProperty<String>(
+ vaadin, "manager.address.street");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
new ObjectOutputStream(baos).writeObject(streetProperty);
- NestedMethodProperty property2 = (NestedMethodProperty) new ObjectInputStream(
+ @SuppressWarnings("unchecked")
+ NestedMethodProperty<String> property2 = (NestedMethodProperty<String>) new ObjectInputStream(
new ByteArrayInputStream(baos.toByteArray())).readObject();
Assert.assertEquals("Ruukinkatu 2-4", property2.getValue());
}
public void testIsReadOnly() {
- NestedMethodProperty streetProperty = new NestedMethodProperty(vaadin,
- "manager.address.street");
- NestedMethodProperty booleanProperty = new NestedMethodProperty(vaadin,
- "manager.address.boolean");
+ NestedMethodProperty<String> streetProperty = new NestedMethodProperty<String>(
+ vaadin, "manager.address.street");
+ NestedMethodProperty<Boolean> booleanProperty = new NestedMethodProperty<Boolean>(
+ vaadin, "manager.address.boolean");
Assert.assertFalse(streetProperty.isReadOnly());
Assert.assertTrue(booleanProperty.isReadOnly());
diff --git a/tests/server-side/com/vaadin/data/util/PropertyDescriptorTest.java b/tests/server-side/com/vaadin/data/util/PropertyDescriptorTest.java
index c3621fa99b..d722a9e23b 100644
--- a/tests/server-side/com/vaadin/data/util/PropertyDescriptorTest.java
+++ b/tests/server-side/com/vaadin/data/util/PropertyDescriptorTest.java
@@ -11,9 +11,6 @@ import junit.framework.Assert;
import junit.framework.TestCase;
import com.vaadin.data.Property;
-import com.vaadin.data.util.MethodPropertyDescriptor;
-import com.vaadin.data.util.NestedPropertyDescriptor;
-import com.vaadin.data.util.VaadinPropertyDescriptor;
import com.vaadin.data.util.NestedMethodPropertyTest.Person;
public class PropertyDescriptorTest extends TestCase {
@@ -33,6 +30,7 @@ public class PropertyDescriptorTest extends TestCase {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
new ObjectOutputStream(baos).writeObject(descriptor);
+ @SuppressWarnings("unchecked")
VaadinPropertyDescriptor<Person> descriptor2 = (VaadinPropertyDescriptor<Person>) new ObjectInputStream(
new ByteArrayInputStream(baos.toByteArray())).readObject();
@@ -47,6 +45,7 @@ public class PropertyDescriptorTest extends TestCase {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
new ObjectOutputStream(baos).writeObject(pd);
+ @SuppressWarnings("unchecked")
VaadinPropertyDescriptor<Person> pd2 = (VaadinPropertyDescriptor<Person>) new ObjectInputStream(
new ByteArrayInputStream(baos.toByteArray())).readObject();
diff --git a/tests/server-side/com/vaadin/data/util/filter/AndOrFilterTest.java b/tests/server-side/com/vaadin/data/util/filter/AndOrFilterTest.java
index bdd852bd41..fdd5b8a645 100644
--- a/tests/server-side/com/vaadin/data/util/filter/AndOrFilterTest.java
+++ b/tests/server-side/com/vaadin/data/util/filter/AndOrFilterTest.java
@@ -5,10 +5,8 @@ import junit.framework.Assert;
import com.vaadin.data.Container.Filter;
import com.vaadin.data.Item;
import com.vaadin.data.util.BeanItem;
-import com.vaadin.data.util.filter.And;
-import com.vaadin.data.util.filter.Or;
-public class AndOrFilterTest extends AbstractFilterTest {
+public class AndOrFilterTest extends AbstractFilterTest<AbstractJunctionFilter> {
protected Item item1 = new BeanItem<Integer>(1);
protected Item item2 = new BeanItem<Integer>(2);
diff --git a/tests/server-side/com/vaadin/data/util/filter/CompareFilterTest.java b/tests/server-side/com/vaadin/data/util/filter/CompareFilterTest.java
index 4cd683bfde..99e8429a51 100644
--- a/tests/server-side/com/vaadin/data/util/filter/CompareFilterTest.java
+++ b/tests/server-side/com/vaadin/data/util/filter/CompareFilterTest.java
@@ -14,7 +14,7 @@ import com.vaadin.data.util.filter.Compare.GreaterOrEqual;
import com.vaadin.data.util.filter.Compare.Less;
import com.vaadin.data.util.filter.Compare.LessOrEqual;
-public class CompareFilterTest extends AbstractFilterTest {
+public class CompareFilterTest extends AbstractFilterTest<Compare> {
protected Item itemNull;
protected Item itemEmpty;
diff --git a/tests/server-side/com/vaadin/data/util/filter/IsNullFilterTest.java b/tests/server-side/com/vaadin/data/util/filter/IsNullFilterTest.java
index 24d5152cf7..6f90273de1 100644
--- a/tests/server-side/com/vaadin/data/util/filter/IsNullFilterTest.java
+++ b/tests/server-side/com/vaadin/data/util/filter/IsNullFilterTest.java
@@ -6,10 +6,8 @@ import com.vaadin.data.Container.Filter;
import com.vaadin.data.Item;
import com.vaadin.data.util.ObjectProperty;
import com.vaadin.data.util.PropertysetItem;
-import com.vaadin.data.util.filter.And;
-import com.vaadin.data.util.filter.IsNull;
-public class IsNullFilterTest extends AbstractFilterTest {
+public class IsNullFilterTest extends AbstractFilterTest<IsNull> {
public void testIsNull() {
Item item1 = new PropertysetItem();
diff --git a/tests/server-side/com/vaadin/data/util/filter/NotFilterTest.java b/tests/server-side/com/vaadin/data/util/filter/NotFilterTest.java
index be6417ccdf..c3b666e6f7 100644
--- a/tests/server-side/com/vaadin/data/util/filter/NotFilterTest.java
+++ b/tests/server-side/com/vaadin/data/util/filter/NotFilterTest.java
@@ -5,10 +5,8 @@ import junit.framework.Assert;
import com.vaadin.data.Container.Filter;
import com.vaadin.data.Item;
import com.vaadin.data.util.BeanItem;
-import com.vaadin.data.util.filter.And;
-import com.vaadin.data.util.filter.Not;
-public class NotFilterTest extends AbstractFilterTest {
+public class NotFilterTest extends AbstractFilterTest<Not> {
protected Item item1 = new BeanItem<Integer>(1);
protected Item item2 = new BeanItem<Integer>(2);
diff --git a/tests/server-side/com/vaadin/data/util/filter/SimpleStringFilterTest.java b/tests/server-side/com/vaadin/data/util/filter/SimpleStringFilterTest.java
index c36a764a54..bc63d57752 100644
--- a/tests/server-side/com/vaadin/data/util/filter/SimpleStringFilterTest.java
+++ b/tests/server-side/com/vaadin/data/util/filter/SimpleStringFilterTest.java
@@ -2,9 +2,8 @@ package com.vaadin.data.util.filter;
import junit.framework.Assert;
-import com.vaadin.data.util.filter.SimpleStringFilter;
-
-public class SimpleStringFilterTest extends AbstractFilterTest {
+public class SimpleStringFilterTest extends
+ AbstractFilterTest<SimpleStringFilter> {
protected static TestItem<String, String> createTestItem() {
return new TestItem<String, String>("abcde", "TeSt");
diff --git a/tests/server-side/com/vaadin/tests/server/TestSerialization.java b/tests/server-side/com/vaadin/tests/server/TestSerialization.java
index e3b6a47855..bed109d99a 100644
--- a/tests/server-side/com/vaadin/tests/server/TestSerialization.java
+++ b/tests/server-side/com/vaadin/tests/server/TestSerialization.java
@@ -92,7 +92,7 @@ public class TestSerialization extends TestCase {
private static String toString(Object o) {
if (o instanceof Property) {
- return String.valueOf(((Property) o).getValue());
+ return String.valueOf(((Property<?>) o).getValue());
} else {
return String.valueOf(o);
}
diff --git a/tests/server-side/com/vaadin/tests/server/component/textfield/TextFieldWithPropertyFormatter.java b/tests/server-side/com/vaadin/tests/server/component/textfield/TextFieldWithPropertyFormatter.java
index 5a494b8ccd..d7b38cecfc 100644
--- a/tests/server-side/com/vaadin/tests/server/component/textfield/TextFieldWithPropertyFormatter.java
+++ b/tests/server-side/com/vaadin/tests/server/component/textfield/TextFieldWithPropertyFormatter.java
@@ -2,6 +2,8 @@ package com.vaadin.tests.server.component.textfield;
import java.util.Collections;
+import junit.framework.TestCase;
+
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
@@ -11,8 +13,6 @@ import com.vaadin.terminal.Paintable;
import com.vaadin.terminal.Paintable.RepaintRequestEvent;
import com.vaadin.ui.TextField;
-import junit.framework.TestCase;
-
public class TextFieldWithPropertyFormatter extends TestCase {
private static final String INPUT_VALUE = "foo";
@@ -20,7 +20,7 @@ public class TextFieldWithPropertyFormatter extends TestCase {
private static final String FORMATTED_VALUE = "FOOBAR";
private static final String ORIGINAL_VALUE = "Original";
private TextField field;
- private PropertyFormatter formatter;
+ private PropertyFormatter<String> formatter;
private ObjectProperty<String> property;
private ValueChangeListener listener;
private int listenerCalled;
@@ -32,16 +32,16 @@ public class TextFieldWithPropertyFormatter extends TestCase {
field = new TextField();
- formatter = new PropertyFormatter() {
+ formatter = new PropertyFormatter<String>() {
@Override
- public Object parse(String formattedValue) throws Exception {
+ public String parse(String formattedValue) throws Exception {
assertEquals(INPUT_VALUE, formattedValue);
return PARSED_VALUE;
}
@Override
- public String format(Object value) {
+ public String format(String value) {
return FORMATTED_VALUE;
}
};
@@ -59,7 +59,7 @@ public class TextFieldWithPropertyFormatter extends TestCase {
assertEquals(FORMATTED_VALUE, event.getProperty().getValue());
}
};
-
+
field.addListener(listener);
field.addListener(new Paintable.RepaintRequestListener() {
public void repaintRequested(RepaintRequestEvent event) {