From issues at jboss.org Tue Jul 3 08:04:00 2018 From: issues at jboss.org (Vlastislav Ramik (JIRA)) Date: Tue, 3 Jul 2018 08:04:00 -0400 (EDT) Subject: [arquillian-issues] [JBoss JIRA] (ARQ-2186) Consider stopping manual mode containers within @AfterSuite event, not @AfterClass In-Reply-To: References: Message-ID: Vlastislav Ramik created ARQ-2186: ------------------------------------- Summary: Consider stopping manual mode containers within @AfterSuite event, not @AfterClass Key: ARQ-2186 URL: https://issues.jboss.org/browse/ARQ-2186 Project: Arquillian Issue Type: Enhancement Affects Versions: 1.4.0.Final Reporter: Vlastislav Ramik IMO it would be good to stop all manual containers within @AfterSuite event here: https://github.com/arquillian/arquillian-core/blob/master/container/test-impl-base/src/main/java/org/jboss/arquillian/container/test/impl/client/ContainerEventController.java#L86-L88 not here: https://github.com/arquillian/arquillian-core/blob/master/container/test-impl-base/src/main/java/org/jboss/arquillian/container/test/impl/client/ContainerEventController.java#L103 As a workaround I use {noformat} !org.jboss.arquillian.container.test.impl.ContainerTestExtension org.jboss.my.custom.CustomContainerTestExtension {noformat} CustomContainerTestExtension registers * everything what's in ContainerTestExtension except ContainerEventController. * CustomContainerEventController (where described functionality is implemented) -- This message was sent by Atlassian JIRA (v7.5.0#75005) From issues at jboss.org Tue Jul 3 08:05:00 2018 From: issues at jboss.org (Vlastislav Ramik (JIRA)) Date: Tue, 3 Jul 2018 08:05:00 -0400 (EDT) Subject: [arquillian-issues] [JBoss JIRA] (ARQ-2186) Consider stopping manual mode containers within @AfterSuite event, not @AfterClass In-Reply-To: References: Message-ID: [ https://issues.jboss.org/browse/ARQ-2186?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Vlastislav Ramik updated ARQ-2186: ---------------------------------- Description: IMO it would be good to stop all manual containers within @AfterSuite event here: https://github.com/arquillian/arquillian-core/blob/master/container/test-impl-base/src/main/java/org/jboss/arquillian/container/test/impl/client/ContainerEventController.java#L86-L88 not here: https://github.com/arquillian/arquillian-core/blob/master/container/test-impl-base/src/main/java/org/jboss/arquillian/container/test/impl/client/ContainerEventController.java#L103 As a workaround I use {noformat} !org.jboss.arquillian.container.test.impl.ContainerTestExtension org.jboss.my.custom.CustomContainerTestExtension {noformat} in org.jboss.arquillian.core.spi.LoadableExtension CustomContainerTestExtension registers * everything what's in ContainerTestExtension except ContainerEventController. * CustomContainerEventController (where described functionality is implemented) was: IMO it would be good to stop all manual containers within @AfterSuite event here: https://github.com/arquillian/arquillian-core/blob/master/container/test-impl-base/src/main/java/org/jboss/arquillian/container/test/impl/client/ContainerEventController.java#L86-L88 not here: https://github.com/arquillian/arquillian-core/blob/master/container/test-impl-base/src/main/java/org/jboss/arquillian/container/test/impl/client/ContainerEventController.java#L103 As a workaround I use {noformat} !org.jboss.arquillian.container.test.impl.ContainerTestExtension org.jboss.my.custom.CustomContainerTestExtension {noformat} CustomContainerTestExtension registers * everything what's in ContainerTestExtension except ContainerEventController. * CustomContainerEventController (where described functionality is implemented) > Consider stopping manual mode containers within @AfterSuite event, not @AfterClass > ---------------------------------------------------------------------------------- > > Key: ARQ-2186 > URL: https://issues.jboss.org/browse/ARQ-2186 > Project: Arquillian > Issue Type: Enhancement > Affects Versions: 1.4.0.Final > Reporter: Vlastislav Ramik > > IMO it would be good to stop all manual containers within @AfterSuite event here: https://github.com/arquillian/arquillian-core/blob/master/container/test-impl-base/src/main/java/org/jboss/arquillian/container/test/impl/client/ContainerEventController.java#L86-L88 > not here: https://github.com/arquillian/arquillian-core/blob/master/container/test-impl-base/src/main/java/org/jboss/arquillian/container/test/impl/client/ContainerEventController.java#L103 > As a workaround I use > {noformat} > !org.jboss.arquillian.container.test.impl.ContainerTestExtension > org.jboss.my.custom.CustomContainerTestExtension > {noformat} > in org.jboss.arquillian.core.spi.LoadableExtension > CustomContainerTestExtension registers > * everything what's in ContainerTestExtension except ContainerEventController. > * CustomContainerEventController (where described functionality is implemented) -- This message was sent by Atlassian JIRA (v7.5.0#75005) From issues at jboss.org Thu Jul 5 08:27:01 2018 From: issues at jboss.org (Bartosz Majsak (JIRA)) Date: Thu, 5 Jul 2018 08:27:01 -0400 (EDT) Subject: [arquillian-issues] [JBoss JIRA] (ARQ-2187) Updating WAS container to latest core results in injection failures In-Reply-To: References: Message-ID: Bartosz Majsak created ARQ-2187: ----------------------------------- Summary: Updating WAS container to latest core results in injection failures Key: ARQ-2187 URL: https://issues.jboss.org/browse/ARQ-2187 Project: Arquillian Issue Type: Bug Components: WebSphere Containers Affects Versions: 1.0.0.CR1 Reporter: Bartosz Majsak Assignee: Gerhard Poul Updating to Arquillian Core 1.4.0.Final results in build failure https://gist.github.com/bartoszmajsak/2887a67d855260e8290470119fe781a8 -- This message was sent by Atlassian JIRA (v7.5.0#75005) From issues at jboss.org Fri Jul 13 01:38:00 2018 From: issues at jboss.org (James Roper (JIRA)) Date: Fri, 13 Jul 2018 01:38:00 -0400 (EDT) Subject: [arquillian-issues] [JBoss JIRA] (ARQ-2188) RemoteLoadableExtensions are not loaded by Weld embedded container In-Reply-To: References: Message-ID: James Roper created ARQ-2188: -------------------------------- Summary: RemoteLoadableExtensions are not loaded by Weld embedded container Key: ARQ-2188 URL: https://issues.jboss.org/browse/ARQ-2188 Project: Arquillian Issue Type: Enhancement Components: Weld Containers Reporter: James Roper Consider the autodiscover extension showcase: https://github.com/arquillian/arquillian-showcase/tree/master/extensions/autodiscover This provides things like mockito support for in a container. There's no reason that a feature like this shouldn't work on top of an embedded container like Weld, but it doesn't - it doesn't work if you add the {{RemoteLoadableExtension}} to the auxillery archive appender, nor does it work if you put the extension in your own {{META-INF/services}} directory, because the Weld container does not load remote loadable extensions. I think an embedded container should inspect auxiliary archives to locate any {{RemoteLoadableExtension}}'s that are registered, and load them. Supporting this would help TCK's to be able to, for example, supply {{@ArquillianResource}} resources that work both in embedded and remote containers. -- This message was sent by Atlassian JIRA (v7.5.0#75005) From issues at jboss.org Mon Jul 16 13:13:00 2018 From: issues at jboss.org (Alex Holmansky (JIRA)) Date: Mon, 16 Jul 2018 13:13:00 -0400 (EDT) Subject: [arquillian-issues] [JBoss JIRA] (ARQ-1282) TestNG @DataProvider is fully invoked for each record In-Reply-To: References: Message-ID: [ https://issues.jboss.org/browse/ARQ-1282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13605747#comment-13605747 ] Alex Holmansky commented on ARQ-1282: ------------------------------------- Is there any plan to get this fixed? This makes data providers next to impossible to use with Arquillian. > TestNG @DataProvider is fully invoked for each record > ----------------------------------------------------- > > Key: ARQ-1282 > URL: https://issues.jboss.org/browse/ARQ-1282 > Project: Arquillian > Issue Type: Bug > Components: JBoss AS Containers > Affects Versions: 1.0.3.Final > Reporter: Karel Cemus > Assignee: Bartosz Majsak > Attachments: ArquillianDataProvider.java, FlightServiceTest.java > > > h2. Expected behavior > TestNG defines @DataProvider annotation to allow single method to perform multiple test cases. Provider method annotated with @DataProvider returns an array of arrays, each containing one test case. These parameters are given to the target method as input parameters. By the definition, the total count of performed test by single method is equal to number of test cases in related data provider. > h2. Actual behavior > Using TestNG under Arquillian framework makes this functionality buggy. Although the client (maven, IDE, etc.) thinks, that the total number of invoked test is correct, it is not. When we take a look into server's log, we can see that for each single test case it invoked full set of all test cases. It means, that in the end the amount of performed tests is equal to expected count squared. Such behaviour is not only slow but also in some cases it doesn't work and it makes tests to fail. > h2. Example > {code:java} > @DataProvider > public Object[][] sumProvider() { > return new Object[][]{ > new Object[]{ 0, 0, 0 }, > new Object[]{ 1, 1, 2 }, > new Object[]{ 1, 5, 6 }, > new Object[]{ 5, 1, 6 } > }; > } > {code} > h3. Expected output in server log > {quote} > Execution of sum: 0 + 0 = 0 > Execution of sum: 1 + 1 = 2 > Execution of sum: 1 + 5 = 6 > Execution of sum: 5 + 1 = 6 > {quote} > h3. Actual output > {quote} > Execution of sum: 0 + 0 = 0 > Execution of sum: 1 + 1 = 2 > Execution of sum: 1 + 5 = 6 > Execution of sum: 5 + 1 = 6 > Execution of sum: 0 + 0 = 0 > Execution of sum: 1 + 1 = 2 > Execution of sum: 1 + 5 = 6 > Execution of sum: 5 + 1 = 6 > Execution of sum: 0 + 0 = 0 > Execution of sum: 1 + 1 = 2 > Execution of sum: 1 + 5 = 6 > Execution of sum: 5 + 1 = 6 > Execution of sum: 0 + 0 = 0 > Execution of sum: 1 + 1 = 2 > Execution of sum: 1 + 5 = 6 > Execution of sum: 5 + 1 = 6 > {quote} -- This message was sent by Atlassian JIRA (v7.5.0#75005) From issues at jboss.org Tue Jul 17 11:22:00 2018 From: issues at jboss.org (=?UTF-8?Q?Bj=C3=B6rn_Kautler_=28JIRA=29?=) Date: Tue, 17 Jul 2018 11:22:00 -0400 (EDT) Subject: [arquillian-issues] [JBoss JIRA] (ARQ-2189) Injection into JUnit rule does not work properly In-Reply-To: References: Message-ID: [ https://issues.jboss.org/browse/ARQ-2189?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Bj?rn Kautler updated ARQ-2189: ------------------------------- Description: We just upgraded our Arquillian version to 1.4.0.Final and now the JUnit rules do not work properly. We have a {{LoginRule}} like {code} public class LoginRule implements TestRule { @EJB private SecurityManagement securityManagement; private String username; private String password; public LoginRule(String username, String password) { this.username = username; this.password = password; } @Override public Statement apply(Statement base, Description description) { return new Statement() { public void evaluate() throws Throwable { login(); base.evaluate(); } }; } ... } {code} If we use it in a test like {code} @Rule public LoginRule login = new LoginRule("user", "pass"); @Test public void test() { // do something with login } {code} Unfortunately this does not work anymore, as {{securityManagement}} was not injected and so the {{login}} method in the rule fails which would have used it. With a subclass with default parameter like {code} public class CertainLoginRule extends LoginRule { public CertainLoginRule() { super("user", "pass"); } } {code} and the usage {code} @Rule public CertainLoginRule login = new CertainLoginRule(); @Test public void test() { // do something with login } {code} it works properly. We tested different variations with subclass, without, constructors with parameters, without and so on. The significant part seems to be the parameters to the constructor. If there are none injection works as expected, if there some, injection is not done. :-( was: We just upgraded our Arquillian version to 1.4.0.Final and now the JUnit rules do not work properly. We have a {{LoginRule}} like {code} public class LoginRule implements TestRule { @EJB private SecurityManagement securityManagement; private String username; private String password; public LoginRule(String username, String password) { this.username = username; this.password = password; } @Override public Statement apply(Statement base, Description description) { return new Statement() { public void evaluate() throws Throwable { login(); base.evaluate(); } }; } ... } If we use it in a test like {code} @Rule public LoginRule login = new LoginRule("user", "pass"); @Test public void test() { // do something with login } {code} Unfortunately this does not work anymore, as {{securityManagement}} was not injected and so the {{login}} method in the rule fails which would have used it. With a subclass with default parameter like {code} public class CertainLoginRule extends LoginRule { public CertainLoginRule() { super("user", "pass"); } } {code} and the usage {code} @Rule public CertainLoginRule login = new CertainLoginRule(); @Test public void test() { // do something with login } {code} it works properly. We tested different variations with subclass, without, constructors with parameters, without and so on. The significant part seems to be the parameters to the constructor. If there are none injection works as expected, if there some, injection is not done. :-( > Injection into JUnit rule does not work properly > ------------------------------------------------ > > Key: ARQ-2189 > URL: https://issues.jboss.org/browse/ARQ-2189 > Project: Arquillian > Issue Type: Bug > Affects Versions: 1.4.0.Final > Reporter: Bj?rn Kautler > > We just upgraded our Arquillian version to 1.4.0.Final and now the JUnit rules do not work properly. > We have a {{LoginRule}} like > {code} > public class LoginRule implements TestRule > { > @EJB > private SecurityManagement securityManagement; > private String username; > private String password; > public LoginRule(String username, String password) > { > this.username = username; > this.password = password; > } > @Override > public Statement apply(Statement base, Description description) > { > return new Statement() > { > public void evaluate() throws Throwable > { > login(); > base.evaluate(); > } > }; > } > ... > } > {code} > If we use it in a test like > {code} > @Rule > public LoginRule login = new LoginRule("user", "pass"); > @Test > public void test() > { > // do something with login > } > {code} > Unfortunately this does not work anymore, as {{securityManagement}} was not injected and so the {{login}} method in the rule fails which would have used it. > With a subclass with default parameter like > {code} > public class CertainLoginRule extends LoginRule > { > public CertainLoginRule() > { > super("user", "pass"); > } > } > {code} > and the usage > {code} > @Rule > public CertainLoginRule login = new CertainLoginRule(); > @Test > public void test() > { > // do something with login > } > {code} > it works properly. > We tested different variations with subclass, without, constructors with parameters, without and so on. > The significant part seems to be the parameters to the constructor. If there are none injection works as expected, if there some, injection is not done. :-( -- This message was sent by Atlassian JIRA (v7.5.0#75005) From issues at jboss.org Tue Jul 17 11:22:00 2018 From: issues at jboss.org (=?UTF-8?Q?Bj=C3=B6rn_Kautler_=28JIRA=29?=) Date: Tue, 17 Jul 2018 11:22:00 -0400 (EDT) Subject: [arquillian-issues] [JBoss JIRA] (ARQ-2189) Injection into JUnit rule does not work properly In-Reply-To: References: Message-ID: Bj?rn Kautler created ARQ-2189: ---------------------------------- Summary: Injection into JUnit rule does not work properly Key: ARQ-2189 URL: https://issues.jboss.org/browse/ARQ-2189 Project: Arquillian Issue Type: Bug Affects Versions: 1.4.0.Final Reporter: Bj?rn Kautler We just upgraded our Arquillian version to 1.4.0.Final and now the JUnit rules do not work properly. We have a {{LoginRule}} like {code} public class LoginRule implements TestRule { @EJB private SecurityManagement securityManagement; private String username; private String password; public LoginRule(String username, String password) { this.username = username; this.password = password; } @Override public Statement apply(Statement base, Description description) { return new Statement() { public void evaluate() throws Throwable { login(); base.evaluate(); } }; } ... } If we use it in a test like {code} @Rule public LoginRule login = new LoginRule("user", "pass"); @Test public void test() { // do something with login } {code} Unfortunately this does not work anymore, as {{securityManagement}} was not injected and so the {{login}} method in the rule fails which would have used it. With a subclass with default parameter like {code} public class CertainLoginRule extends LoginRule { public CertainLoginRule() { super("user", "pass"); } } {code} and the usage {code} @Rule public CertainLoginRule login = new CertainLoginRule(); @Test public void test() { // do something with login } {code} it works properly. We tested different variations with subclass, without, constructors with parameters, without and so on. The significant part seems to be the parameters to the constructor. If there are none injection works as expected, if there some, injection is not done. :-( -- This message was sent by Atlassian JIRA (v7.5.0#75005) From issues at jboss.org Tue Jul 17 11:23:00 2018 From: issues at jboss.org (=?UTF-8?Q?Bj=C3=B6rn_Kautler_=28JIRA=29?=) Date: Tue, 17 Jul 2018 11:23:00 -0400 (EDT) Subject: [arquillian-issues] [JBoss JIRA] (ARQ-2189) Injection into JUnit rule does not work properly In-Reply-To: References: Message-ID: [ https://issues.jboss.org/browse/ARQ-2189?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Bj?rn Kautler updated ARQ-2189: ------------------------------- Description: We just upgraded our Arquillian version to 1.4.0.Final and now the JUnit rules do not work properly. We have a {{LoginRule}} like {code} public class LoginRule implements TestRule { @EJB private SecurityManagement securityManagement; private String username; private String password; public LoginRule(String username, String password) { this.username = username; this.password = password; } @Override public Statement apply(Statement base, Description description) { return new Statement() { public void evaluate() throws Throwable { login(); base.evaluate(); } }; } ... } {code} If we use it in a test like {code} @Rule public LoginRule login = new LoginRule("user", "pass"); @Test public void test() { // do something with login } {code} Unfortunately this does not work anymore, as {{securityManagement}} was not injected and so the {{login}} method in the rule fails which would have used it. With a subclass with default constructor like {code} public class CertainLoginRule extends LoginRule { public CertainLoginRule() { super("user", "pass"); } } {code} and the usage {code} @Rule public CertainLoginRule login = new CertainLoginRule(); @Test public void test() { // do something with login } {code} it works properly. We tested different variations with subclass, without, constructors with parameters, without and so on. The significant part seems to be the parameters to the constructor. If there are none injection works as expected, if there some, injection is not done. :-( was: We just upgraded our Arquillian version to 1.4.0.Final and now the JUnit rules do not work properly. We have a {{LoginRule}} like {code} public class LoginRule implements TestRule { @EJB private SecurityManagement securityManagement; private String username; private String password; public LoginRule(String username, String password) { this.username = username; this.password = password; } @Override public Statement apply(Statement base, Description description) { return new Statement() { public void evaluate() throws Throwable { login(); base.evaluate(); } }; } ... } {code} If we use it in a test like {code} @Rule public LoginRule login = new LoginRule("user", "pass"); @Test public void test() { // do something with login } {code} Unfortunately this does not work anymore, as {{securityManagement}} was not injected and so the {{login}} method in the rule fails which would have used it. With a subclass with default parameter like {code} public class CertainLoginRule extends LoginRule { public CertainLoginRule() { super("user", "pass"); } } {code} and the usage {code} @Rule public CertainLoginRule login = new CertainLoginRule(); @Test public void test() { // do something with login } {code} it works properly. We tested different variations with subclass, without, constructors with parameters, without and so on. The significant part seems to be the parameters to the constructor. If there are none injection works as expected, if there some, injection is not done. :-( > Injection into JUnit rule does not work properly > ------------------------------------------------ > > Key: ARQ-2189 > URL: https://issues.jboss.org/browse/ARQ-2189 > Project: Arquillian > Issue Type: Bug > Affects Versions: 1.4.0.Final > Reporter: Bj?rn Kautler > > We just upgraded our Arquillian version to 1.4.0.Final and now the JUnit rules do not work properly. > We have a {{LoginRule}} like > {code} > public class LoginRule implements TestRule > { > @EJB > private SecurityManagement securityManagement; > private String username; > private String password; > public LoginRule(String username, String password) > { > this.username = username; > this.password = password; > } > @Override > public Statement apply(Statement base, Description description) > { > return new Statement() > { > public void evaluate() throws Throwable > { > login(); > base.evaluate(); > } > }; > } > ... > } > {code} > If we use it in a test like > {code} > @Rule > public LoginRule login = new LoginRule("user", "pass"); > @Test > public void test() > { > // do something with login > } > {code} > Unfortunately this does not work anymore, as {{securityManagement}} was not injected and so the {{login}} method in the rule fails which would have used it. > With a subclass with default constructor like > {code} > public class CertainLoginRule extends LoginRule > { > public CertainLoginRule() > { > super("user", "pass"); > } > } > {code} > and the usage > {code} > @Rule > public CertainLoginRule login = new CertainLoginRule(); > @Test > public void test() > { > // do something with login > } > {code} > it works properly. > We tested different variations with subclass, without, constructors with parameters, without and so on. > The significant part seems to be the parameters to the constructor. If there are none injection works as expected, if there some, injection is not done. :-( -- This message was sent by Atlassian JIRA (v7.5.0#75005) From issues at jboss.org Tue Jul 17 11:23:00 2018 From: issues at jboss.org (=?UTF-8?Q?Bj=C3=B6rn_Kautler_=28JIRA=29?=) Date: Tue, 17 Jul 2018 11:23:00 -0400 (EDT) Subject: [arquillian-issues] [JBoss JIRA] (ARQ-2189) Injection into JUnit rule does not work properly In-Reply-To: References: Message-ID: [ https://issues.jboss.org/browse/ARQ-2189?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Bj?rn Kautler updated ARQ-2189: ------------------------------- Description: We just upgraded our Arquillian version to 1.4.0.Final and now the JUnit rules do not work properly. We have a {{LoginRule}} like {code} public class LoginRule implements TestRule { @EJB private SecurityManagement securityManagement; private String username; private String password; public LoginRule(String username, String password) { this.username = username; this.password = password; } @Override public Statement apply(Statement base, Description description) { return new Statement() { public void evaluate() throws Throwable { login(); base.evaluate(); } }; } ... } {code} If we use it in a test like {code} @Rule public LoginRule login = new LoginRule("user", "pass"); @Test public void test() { // do something with login } {code} Unfortunately this does not work anymore, as {{securityManagement}} was not injected and so the {{login}} method in the rule fails which would have used it. With a subclass with default constructor like {code} public class CertainLoginRule extends LoginRule { public CertainLoginRule() { super("user", "pass"); } } {code} and the usage {code} @Rule public CertainLoginRule login = new CertainLoginRule(); @Test public void test() { // do something with login } {code} it works properly. We tested different variations with subclass, without, constructors with parameters, without and so on. The significant part seems to be the parameters to the constructor. If there are none injection works as expected, if there are some, injection is not done. :-( was: We just upgraded our Arquillian version to 1.4.0.Final and now the JUnit rules do not work properly. We have a {{LoginRule}} like {code} public class LoginRule implements TestRule { @EJB private SecurityManagement securityManagement; private String username; private String password; public LoginRule(String username, String password) { this.username = username; this.password = password; } @Override public Statement apply(Statement base, Description description) { return new Statement() { public void evaluate() throws Throwable { login(); base.evaluate(); } }; } ... } {code} If we use it in a test like {code} @Rule public LoginRule login = new LoginRule("user", "pass"); @Test public void test() { // do something with login } {code} Unfortunately this does not work anymore, as {{securityManagement}} was not injected and so the {{login}} method in the rule fails which would have used it. With a subclass with default constructor like {code} public class CertainLoginRule extends LoginRule { public CertainLoginRule() { super("user", "pass"); } } {code} and the usage {code} @Rule public CertainLoginRule login = new CertainLoginRule(); @Test public void test() { // do something with login } {code} it works properly. We tested different variations with subclass, without, constructors with parameters, without and so on. The significant part seems to be the parameters to the constructor. If there are none injection works as expected, if there some, injection is not done. :-( > Injection into JUnit rule does not work properly > ------------------------------------------------ > > Key: ARQ-2189 > URL: https://issues.jboss.org/browse/ARQ-2189 > Project: Arquillian > Issue Type: Bug > Affects Versions: 1.4.0.Final > Reporter: Bj?rn Kautler > > We just upgraded our Arquillian version to 1.4.0.Final and now the JUnit rules do not work properly. > We have a {{LoginRule}} like > {code} > public class LoginRule implements TestRule > { > @EJB > private SecurityManagement securityManagement; > private String username; > private String password; > public LoginRule(String username, String password) > { > this.username = username; > this.password = password; > } > @Override > public Statement apply(Statement base, Description description) > { > return new Statement() > { > public void evaluate() throws Throwable > { > login(); > base.evaluate(); > } > }; > } > ... > } > {code} > If we use it in a test like > {code} > @Rule > public LoginRule login = new LoginRule("user", "pass"); > @Test > public void test() > { > // do something with login > } > {code} > Unfortunately this does not work anymore, as {{securityManagement}} was not injected and so the {{login}} method in the rule fails which would have used it. > With a subclass with default constructor like > {code} > public class CertainLoginRule extends LoginRule > { > public CertainLoginRule() > { > super("user", "pass"); > } > } > {code} > and the usage > {code} > @Rule > public CertainLoginRule login = new CertainLoginRule(); > @Test > public void test() > { > // do something with login > } > {code} > it works properly. > We tested different variations with subclass, without, constructors with parameters, without and so on. > The significant part seems to be the parameters to the constructor. If there are none injection works as expected, if there are some, injection is not done. :-( -- This message was sent by Atlassian JIRA (v7.5.0#75005)