I have the object with static field:
class Project() {
private static id;
private int projectid;
public Project(fileds) {
this.id = id++;
}
//methods
}
Now I want to test this class with multiple tests. The problen is that my objects are not deleted from memory when one test is completed:
@Test
public test1(){
Project project1 = new Project();
Project project2 = new Project();
}
@Test
public test2(){
here the objects from previous tests are still exist since the static field is two times increased
}
Is there any way I can flush them after each test? Since the only way I can overcome it - using Ignoring...