Junit @AfterClass (non static)
问题 Junit's @BeforeClass and @AfterClass must be declared static. There is a nice workaround here for @BeforeClass . I have a number of unit tests in my class and only want to initialize and clean up once. Any help on how to get a workaround for @AfterClass ? I'd like to use Junit without introducing additional dependencies. Thanks! 回答1: If you want something similar to the workaround mentioned for @BeforeClass , you could keep track of how many tests have been ran, then once all tests have been