Re: How do i test a method which returns NullPointerException to my JUnit testCase below:
Posted By:
Peter_Craddock
Posted On:
Wednesday, April 30, 2003 07:56 AM
From this I assum you want a null pointerexception to be thrown. If this is true I would test as follows.
boolean result = false;
try
{
test methods ..
}
catch(NullPointerException npe)
{
result = true;
}
catch(Exception e)
{
//dump stack
fail();
}
assertTrue(result);
hope this helps pete.