From: Matt B. <br...@op...> - 2006-05-29 13:37:14
|
On May 29, 2006, at 1:01 AM, DJ Gregor wrote: > For the record, throwing exceptions in the tearDown() method of JUnit > test cases is bad, as it masks any failures that were encountered > during the test*() method that actually performed the test. I want > to make sure that everyone is aware of this problem and I would like > to fix cases where it happens (a big one that I know if is in > OpenNMSTestCase). Though I can see your point on this, a very large number of JUnit extensions work automated in some way without having to explicitly call 'verifyAnticipated' in every single test. Maybe a more appropriate solution would be to override the 'runTest' method and have it do verification automattically. The AbstractDaoTest overrides this to ensure that each test gets run in a Transaction. This would give us the following benefits: 1. Verification code is duplictated in every test 2. Exceptions are not thrown from tearDown Would that meet your needs? Matt |