Fix some generics warnings in test classes.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1475940 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas Neidhart 2013-04-25 20:09:15 +00:00
parent cb3b31ed23
commit b591dacd5c
2 changed files with 5 additions and 6 deletions

View File

@ -81,10 +81,9 @@ public class ReverseComparatorTest extends AbstractComparatorTest<Integer> {
* already "canonized" the comparator returned by makeComparator. * already "canonized" the comparator returned by makeComparator.
*/ */
@Override @Override
@SuppressWarnings("unchecked")
@Test @Test
public void testSerializeDeserializeThenCompare() throws Exception { public void testSerializeDeserializeThenCompare() throws Exception {
final Comparator comp = new ReverseComparator(new ComparableComparator()); final Comparator<?> comp = new ReverseComparator<String>(new ComparableComparator<String>());
final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
final ObjectOutputStream out = new ObjectOutputStream(buffer); final ObjectOutputStream out = new ObjectOutputStream(buffer);

View File

@ -237,8 +237,8 @@ public class MultiKeyTest extends TestCase {
public void testEqualsAfterSerialization() throws IOException, ClassNotFoundException public void testEqualsAfterSerialization() throws IOException, ClassNotFoundException
{ {
SystemHashCodeSimulatingKey sysKey = new SystemHashCodeSimulatingKey("test"); SystemHashCodeSimulatingKey sysKey = new SystemHashCodeSimulatingKey("test");
final MultiKey mk = new MultiKey(ONE, sysKey); final MultiKey<?> mk = new MultiKey<Object>(ONE, sysKey);
final Map map = new HashMap(); final Map<MultiKey<?>, Integer> map = new HashMap<MultiKey<?>, Integer>();
map.put(mk, TWO); map.put(mk, TWO);
// serialize // serialize
@ -252,12 +252,12 @@ public class MultiKeyTest extends TestCase {
final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
final ObjectInputStream in = new ObjectInputStream(bais); final ObjectInputStream in = new ObjectInputStream(bais);
sysKey = (SystemHashCodeSimulatingKey)in.readObject(); // simulate deserialization in another process sysKey = (SystemHashCodeSimulatingKey)in.readObject(); // simulate deserialization in another process
final Map map2 = (Map) in.readObject(); final Map<?, ?> map2 = (Map<?, ?>) in.readObject();
in.close(); in.close();
assertEquals(2, sysKey.hashCode()); // different hashCode now assertEquals(2, sysKey.hashCode()); // different hashCode now
final MultiKey mk2 = new MultiKey(ONE, sysKey); final MultiKey<?> mk2 = new MultiKey<Object>(ONE, sysKey);
assertEquals(TWO, map2.get(mk2)); assertEquals(TWO, map2.get(mk2));
} }
} }