JUnit assertFalse (true) & # 8594; successful test case?
How can this test succeed (i.e. green in my JUnit window):
@Test public void caseForXFiles(){
Assert.assertFalse(true);
}
Also, all other types of cases are successful, although they shouldn't. My guess is that I don't need to explicitly include assertions when using this feature, as I am not using assert
(even if enabled no matter what). Even throwing an unexpected (even incorrectly compiled) exception will not color the test screen red. On my second console, I get
Okt 23, 2014 5:18:43 PM org.jboss.arquillian.drone.webdriver.factory.remote.reusable.ReusedSessionPernamentFileStorage readStore
Information: Reused session store is not available at C:\Users\xx\.drone-webdriver-session-store, a new one will be created.
Okt 23, 2014 5:18:54 PM org.jboss.arquillian.protocol.jmx.JMXMethodExecutor invoke
Schwerwiegend: Failed: de.xx.MyTest.caseForXFiles
What the hell is going on here? I am using JBoss 6.2.4 and Arquillian.
edit . After some further research I found that this line, as unlikely, is causing the problem. My test file will show in green in JUnit until it is NOT executed (tried with System.out.print
but didn't show):
@Before public void setUp() throws Exception {
rBean.getUserId(); // a simple getter on a String field, no side effects
}
It seems that in @PostConstruct
my rBean it cannot be properly populated. But this leads to the described behavior, it seems like a bug to me.
additional information :
rBean:
@Inject @CurrentUser private MyCurrentUser currentUser;
@PostConstruct private void postConstruct() {
userId = currentUser.getUserId();
}
The currentUser object is injected by some company structure that I don't have access to. However, I have access to the MyCurrentUser class implementing IUser (no access). Ultimately, I want to run test tags in my Bean methods, which contain their own annotations. I could work around this by creating test functions that call these annotated functions, in which case the annotation will not be considered.
The problem is, since currentUser can not login()
, something in some dark corner is going terribly wrong.
source to share