[arquillian-issues] [JBoss JIRA] (ARQ-2046) CDI Injection in methods should only inject @Inject parameters

S Haster (JIRA) issues at jboss.org
Tue Sep 27 05:21:00 EDT 2016


S Haster created ARQ-2046:
-----------------------------

             Summary: CDI Injection in methods should only inject @Inject parameters
                 Key: ARQ-2046
                 URL: https://issues.jboss.org/browse/ARQ-2046
             Project: Arquillian
          Issue Type: Bug
          Components: Runtime Enricher SPI
    Affects Versions: 1.1.11.Final
         Environment: git bash (mingw64) or eclipse, on windows 10
            Reporter: S Haster
         Attachments: testcase.tar.gz

The CDIInjectionEnricher should only inject method parameters annotated with @Inject, as is the spec and as it does with instance variables.

The current implementation, which treats every method parameter as an injection point, conflicts with custom test enrichers. If my project is a beanarchive with bean-discovery-mode=all then every class is counted as a bean.

If I have a testmethod where a custom enricher supplies one of the parameters the CDIInjectionEnricher also provides that parameter but by calling it's default parameter and not setting any other configuration, resulting in faulty testdata.

Even worse, because the ordering of TestEnrichers as used in LocalTestExecutor#enrichArguments is not defined, sometimes the bean provided by the custom enricher will be used, and sometimes the one provided by CDIInjectionEnricher, leading to a testcase that will only fail *sometimes*.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the arquillian-issues mailing list