Finally in Java Junit 4

Viewed 2744

In my tests I'm using a connection to a DB, I open the connection in @Before and close it in @After.

My question is what happens if an exception was thrown during the test?

How would I be able to close the connection?

I'm looking for something that is equivalent to finally that comes after try and catch block.

1 Answers
Related