When unit testing with JUnit, there are two similar methods, setUp()
and setUpBeforeClass()
. What is the difference between these methods? Also, what is the difference between tearDown()
and tearDownAfterClass()
?
Here are the signatures:
@BeforeClass
public static void setUpBeforeClass() throws Exception {
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
}
@Before
public void setUp() throws Exception {
}
@After
public void tearDown() throws Exception {
}
See Question&Answers more detail:os