I am writing a few test cases that depend on the database being available, so on the @Before and @After I open and close the session (Hibernate), as well as start and finish the transaction.
Now in the process of development sometimes I get exceptions in the test cases, so the @After is never called and I can't clean up (or rollback the transaction which is what I'd like to do).
I've (briefly) checked the documentation and could not find how to catch these unexpected exceptions so I can rollback and let the rest of the tests work ok.
Any pointers ?