Tests called twice
------------------
Key: ARQ-327
URL:
https://jira.jboss.org/browse/ARQ-327
Project: Arquillian
Issue Type: Bug
Components: Base Implementation
Affects Versions: 1.0.0.Alpha4
Reporter: Stan Silvert
Attachments: aqbug.jar
I have a simple bean and test class. testFoo will always be called an extra time with
every test. When it wants to do testFoo it will call testFoo twice. When it wants to do
testBar it will call testFoo and then testBar. Both result with failure in
assertEquals(0, myFieldBean.getCounter())
Full Maven project attached as a jar.
public class MyBean {
private int counter = 0;
public int getCounter() { return counter++; }
}
@RunWith(Arquillian.class)
public class FooBarTest
{
@Inject MyBean myFieldBean;
public FooBarTest()
{
System.out.println("Called FooBarTest constructor");
}
@Test @Inject
public void testFoo(MyBean myBean)
{
System.out.println("Called testFoo");
System.out.println("myBean=" + myBean.toString());
System.out.println("myFieldBean=" + myFieldBean.toString());
Assert.assertEquals(0, myBean.getCounter());
Assert.assertEquals(0, myFieldBean.getCounter());
}
@Test
public void testBar()
{
System.out.println("Called testBar");
System.out.println("myFieldBean=" + myFieldBean.toString());
Assert.assertEquals(0, myFieldBean.getCounter());
}
}
Output is:
16:42:44,892 INFO [STDOUT] Called FooBarTest constructor
16:42:44,904 INFO [STDOUT] Called testFoo
16:42:44,905 INFO [STDOUT] myBean=org.jboss.aqbug.MyBean@2a5772
16:42:44,907 INFO [STDOUT] myFieldBean=org.jboss.aqbug.MyBean@1d3018e
16:42:44,915 INFO [STDOUT] Called testFoo
16:42:44,917 INFO [STDOUT] myBean=org.jboss.aqbug.MyBean@11821
16:42:44,918 INFO [STDOUT] myFieldBean=org.jboss.aqbug.MyBean@1d3018e
16:42:44,965 INFO [STDOUT] Called FooBarTest constructor
16:42:44,974 INFO [STDOUT] Called testFoo
16:42:44,977 INFO [STDOUT] myBean=org.jboss.aqbug.MyBean@12b4d3
16:42:44,978 INFO [STDOUT] myFieldBean=org.jboss.aqbug.MyBean@1d9604
16:42:45,036 INFO [STDOUT] Called testBar
16:42:45,037 INFO [STDOUT] myFieldBean=org.jboss.aqbug.MyBean@1d9604
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira