Author: jharting
Date: 2010-02-09 04:44:08 -0500 (Tue, 09 Feb 2010)
New Revision: 5828
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dynamic/DynamicLookupTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dynamic/ObtainsNewInstanceBean.java
Log:
Added test for TypeLiteral
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dynamic/DynamicLookupTest.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dynamic/DynamicLookupTest.java 2010-02-09
09:40:13 UTC (rev 5827)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dynamic/DynamicLookupTest.java 2010-02-09
09:44:08 UTC (rev 5828)
@@ -17,12 +17,15 @@
package org.jboss.jsr299.tck.tests.lookup.dynamic;
+import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
import javax.enterprise.inject.AmbiguousResolutionException;
import javax.enterprise.inject.Instance;
import javax.enterprise.inject.UnsatisfiedResolutionException;
import javax.enterprise.util.AnnotationLiteral;
+import javax.enterprise.util.TypeLiteral;
import org.jboss.jsr299.tck.AbstractJSR299Test;
import org.jboss.jsr299.tck.literals.AnyLiteral;
@@ -106,7 +109,8 @@
@SpecAssertion(section="5.6.1", id="aa"),
@SpecAssertion(section="5.6.1", id="ba"),
@SpecAssertion(section="5.6.1", id="ja"),
- @SpecAssertion(section="5.6.1", id="ka")
+ @SpecAssertion(section="5.6.1", id="ka"),
+ @SpecAssertion(section="5.6.3", id="a")
})
public void testIteratorMethod()
{
@@ -178,10 +182,15 @@
}
@Test
- @SpecAssertion(section = "5.6", id = "e")
+ @SpecAssertions({
+ @SpecAssertion(section = "5.6", id = "e"),
+ @SpecAssertion(section = "5.6.3", id = "b")
+ })
+ @SuppressWarnings("serial")
public void testNewBean()
{
- assert getInstanceByType(ObtainsNewInstanceBean.class).getNpe().get() != null;
+ Instance<List<String>> instance =
getInstanceByType(ObtainsNewInstanceBean.class).getStrings();
+ assert instance.select(new TypeLiteral<ArrayList<String>>(){}).get()
instanceof ArrayList<?>;
}
@Test
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dynamic/ObtainsNewInstanceBean.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dynamic/ObtainsNewInstanceBean.java 2010-02-09
09:40:13 UTC (rev 5827)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/dynamic/ObtainsNewInstanceBean.java 2010-02-09
09:44:08 UTC (rev 5828)
@@ -16,6 +16,9 @@
*/
package org.jboss.jsr299.tck.tests.lookup.dynamic;
+import java.util.ArrayList;
+import java.util.List;
+
import javax.enterprise.inject.Instance;
import javax.enterprise.inject.New;
import javax.inject.Inject;
@@ -24,12 +27,12 @@
public class ObtainsNewInstanceBean
{
- @Inject @New(NullPointerException.class) Instance<NullPointerException> npe;
+ @Inject @New(ArrayList.class) Instance<List<String>> strings;
@Inject Instance<IllegalArgumentException> iae;
- public Instance<NullPointerException> getNpe()
+ public Instance<List<String>> getStrings()
{
- return npe;
+ return strings;
}
public Instance<IllegalArgumentException> getIae()
Show replies by date