I am reading one book about JUnit now and writer advises nulling resources in tearDown method. Why? Isn't this GC's job? Can it seriously make any harm?
Lets think of example like this:
public class SomeTest extends TestCase {
Vector vector;
List<Object> list;
protected void setUp() {
vector = new Vector();
list = new ArrayList<Object>();
}
// messing with resources
// adding, deleting, testing whatever
protected void tearDown() {
vector = null;
list = null;
}
}
What do you think? Is that code in tearDown necessary?