[jboss-cvs] JBossAS SVN: r68392 - projects/microcontainer/trunk/metatype/src/tests/org/jboss/test/metatype/values/factory/test.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Dec 18 19:11:36 EST 2007
Author: alesj
Date: 2007-12-18 19:11:36 -0500 (Tue, 18 Dec 2007)
New Revision: 68392
Modified:
projects/microcontainer/trunk/metatype/src/tests/org/jboss/test/metatype/values/factory/test/UnwrapValueUnitTestCase.java
Log:
Test generic collection types.
Modified: projects/microcontainer/trunk/metatype/src/tests/org/jboss/test/metatype/values/factory/test/UnwrapValueUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/metatype/src/tests/org/jboss/test/metatype/values/factory/test/UnwrapValueUnitTestCase.java 2007-12-18 23:54:19 UTC (rev 68391)
+++ projects/microcontainer/trunk/metatype/src/tests/org/jboss/test/metatype/values/factory/test/UnwrapValueUnitTestCase.java 2007-12-19 00:11:36 UTC (rev 68392)
@@ -107,30 +107,38 @@
Integer i2 = 123;
checkCollection(new ArrayList<Integer>(), i1, i2);
checkCollection(new ArrayList<Integer>(), List.class, i1, i2);
+ checkCollection(new ArrayList<Integer>(), getType("Integer", List.class), i1, i2);
checkCollection(new HashSet<Integer>(), i1, i2);
checkCollection(new HashSet<Integer>(), Set.class, i1, i2);
+ checkCollection(new HashSet<Integer>(), getType("Integer", Set.class), i1, i2);
TestEnum one = TestEnum.ONE;
TestEnum two = TestEnum.TWO;
TestEnum three = TestEnum.THREE;
checkCollection(new ArrayList<TestEnum>(), one, two, three, one);
checkCollection(new ArrayList<TestEnum>(), List.class, one, two, three, one);
+ checkCollection(new ArrayList<TestEnum>(), getType("Enum", List.class), one, two, three, one);
checkCollection(new HashSet<TestEnum>(), one, two, three, one);
checkCollection(new HashSet<TestEnum>(), Set.class, one, two, three, one);
+ checkCollection(new HashSet<TestEnum>(), getType("Enum", Set.class), one, two, three, one);
TestGeneric g1 = new TestGeneric("123");
TestGeneric g2 = new TestGeneric("123");
checkCollection(new ArrayList<TestGeneric>(), g1, g2);
checkCollection(new ArrayList<TestGeneric>(), List.class, g1, g2);
+ checkCollection(new ArrayList<TestGeneric>(), getType("Generic", List.class), g1, g2);
checkCollection(new HashSet<TestGeneric>(), g1, g2);
checkCollection(new HashSet<TestGeneric>(), Set.class, g1, g2);
+ checkCollection(new HashSet<TestGeneric>(), getType("Generic", Set.class), g1, g2);
TestSimpleComposite c1 = new TestSimpleComposite("123");
TestSimpleComposite c2 = new TestSimpleComposite("123");
checkCollection(new ArrayList<TestSimpleComposite>(), c1, c2);
checkCollection(new ArrayList<TestSimpleComposite>(), List.class, c1, c2);
+ checkCollection(new ArrayList<TestSimpleComposite>(), getType("Composite", List.class), c1, c2);
checkCollection(new HashSet<TestSimpleComposite>(), c1, c2);
checkCollection(new HashSet<TestSimpleComposite>(), Set.class, c1, c2);
+ checkCollection(new HashSet<TestSimpleComposite>(), getType("Composite", Set.class), c1, c2);
}
public void testArrayUnwrap() throws Exception
@@ -285,10 +293,10 @@
checkSingle(collection, false);
}
- protected <T> void checkCollection(Collection<T> collection, Class<? extends Collection> clazz, T... params) throws Exception
+ protected <T> void checkCollection(Collection<T> collection, Type type, T... params) throws Exception
{
collection.addAll(Arrays.asList(params));
- checkSingle(collection, clazz);
+ checkSingle(collection, type);
}
protected void checkArray(Object object, boolean typeInfoFromObject, Asserter asserter)
@@ -307,4 +315,50 @@
{
boolean assertArray(final Object original, final Object unwrapped);
}
+
+ protected Type getType(String type, Class<? extends Collection> clazz) throws Exception
+ {
+ Method method = getClass().getDeclaredMethod("get" + type + "s" + clazz.getSimpleName());
+ return method.getGenericReturnType();
+ }
+
+ public List<Integer> getIntegersList()
+ {
+ return null;
+ }
+
+ public List<TestEnum> getEnumsList()
+ {
+ return null;
+ }
+
+ public List<TestGeneric> getGenericsList()
+ {
+ return null;
+ }
+
+ public List<TestSimpleComposite> getCompositesList()
+ {
+ return null;
+ }
+
+ public Set<Integer> getIntegersSet()
+ {
+ return null;
+ }
+
+ public Set<TestEnum> getEnumsSet()
+ {
+ return null;
+ }
+
+ public Set<TestGeneric> getGenericsSet()
+ {
+ return null;
+ }
+
+ public Set<TestSimpleComposite> getCompositesSet()
+ {
+ return null;
+ }
}
More information about the jboss-cvs-commits
mailing list