Closed
Description
The following three test fail:
@ApplicationScoped
public class MapProducer {
@Produces
@Dependent
public <T> Map<String,T> produceMap(InjectionPoint ip) {
Map<String, T> map = new HashMap<>();
map.put(ip.getType().getTypeName(), null);
return map;
}
}
@EnableWeld
class TestParameterInjectionWithParametrizedTypes {
@Test
public void testparamInjectionWithEvent(Event<String> stringEvent) {
Assertions.assertNotNull(stringEvent);
}
@Test
public void testparamInjectionWithInstance(Instance<String> stringInstance) {
Assertions.assertNotNull(stringInstance);
}
@Test
public void testparamInjectionWithOtherParametrizedType(Map<String, Integer> map) {
Assertions.assertNotNull(map);
Assertions.assertTrue(map.containsKey("java.util.Map<java.lang.String, java.lang.Integer>"));
}
}
The reason is that WeldJunit5Extension
uses
getContainerFromStore(extensionContext).select(parameterContext.getParameter().getType(), ...
instead of
getContainerFromStore(extensionContext).select(parameterContext.getParameter().getParametrizedType(), ...
Metadata
Metadata
Assignees
Labels
No labels