Falko Modler created DELTASPIKE-1116:
----------------------------------------
Summary: CdiTestRunner injects test class fields twice
Key: DELTASPIKE-1116
URL: https://issues.apache.org/jira/browse/DELTASPIKE-1116
Project: DeltaSpike
Issue Type: Bug
Components: TestControl
Affects Versions: 1.6.0, 1.5.4, 1.0.2
Environment: Apache Maven 3.2.5
(12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T18:29:23+01:00)
Maven home: C:\Program Files\apache-maven-3.2.5
Java version: 1.7.0_80, vendor: Oracle Corporation
Java home: C:\Develop\jdk1.7.0_80\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
Reporter: Falko Modler
{{CdiTestRunner}} first injects into {{@Inject}} fields of the test class in
{{CdiTestRunner.createTest()}}. I'm absolutely fine with that as this makes it
possible to use injected beans in a {{@Before}} method or even in a JUnit
{{TestRule}}.
But shortly before executing the actual test method,
{{CdiTestRunner.ContainerAwareMethodInvoker.evaluate()}} *injects again*,
overwriting any changes that have been made to the fields in a JUnit
{{TestRule}} or a {{@Before}} method in the test.
The second injection was introduced by DELTASPIKE-342:
https://git-wip-us.apache.org/repos/asf?p=deltaspike.git;a=commitdiff;h=2d44e7d2980f8ab0b0a2a388255c0f0944c85098
I don't know why there needs to be a second injection at all.
All tests pass when I remove the second {{BeanProvider.injectFields(...)}}.
PS: {{deltaspike.testcontrol.use_test_class_as_cdi_bean}} is {{false}}, which
is the default value.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)