unit testing - JUnit Exception Catching -


I am writing some test cases which are dependent upon availability on the database, so @ east and @fore I Open and close the session (hibernate), as well as start and end transactions.

Now in the process of development, sometimes I get an exception in test cases, so @ is never called after and I can not do it clean (or rollback back to the transaction which I I want to do it).

I have examined the document (in essence) and can not find a way to catch these unexpected exceptions, so I can rollback the rest of the trials is fine.

Any hint?

Resources according to:

@After Guaranteed to run the method, even if an exception is thrown. You are not calling that method explicitly, are you?


Comments