My
unit test code is as follows -
@Test(expected=InvalidOperationException.class)
pubic void testLogin()
{
int sessionId = startSession();
mLoginBean.login("TEST");
fail();
}
The login bean throws an InvalidOperationException that whwich I see on the
Jboss console, but when I run the thejunit test case I get an assertion error from the fail() statement.\
I tried making of a variant of the test case as follows -
@Test
pubic void testLogin()
{
int sessionId = startSession();
try
{
mLoginBean.login("TEST");
fail();
}
catch(InvalidOperationException e)
{
e.printStackTrace();
}
}
I still get an asserstion error even though the exception is thrown from the bean.
Any ideas?