Thanks for any help with this. What is the trick to getting the @Test(exception syntax to work correctly?
If I don't prefix the method name with "test", it gives me: No Tests Found in ..."
If I do prefix the method name with "test", it fails with an exception even though I am testing to ensure that I do get the exception. I am doing something wrong, but I don't know what it is
SCJP - 1.4
SCJD - (B&S) Used 1.5 And It Runs On Solaris10
SCWCD - Thanks to HFSJ!!
org.junit.runner.JUnitCore has a main class. If I change the method name so that it is prefixed with "test" (see below), it runs, but this one passes rather than fails, even though the exception is not thrown. I thought the purpose of the "exception=" parameter with the @Test tag is so that the test will pass when an expected exception is thrown and fail when it is not.
I always try to get something to work in the "bare" fashion, when I can't get it to work in the IDE - to eliminate hidden env settings, etc. I do not have too much experience with JUnit. This is the first time I have used the @Test tag and the first time with the (exception= parameter. Previously I was using the try/catch block way of ensuring that an exception was thrown when it should have been.
The bummer is that now, without extending Testcase, I can't use super.setUp() and super.TearDown() . I am able to just put the "setUp" stuff in a constructor. Thanks for a suggestion as to how to deal with that part.