In-Depth Understanding JUnit Tests
Source code on GitHub public class ExampleTest { private static final Logger LOG = LoggerFactory.getLogger(ExampleTest.class); /** * This method won't be executed if the unit test will be (externally) terminated (e.g. from within the IDE). * You have to act **really** fast in this case. */ @BeforeClass public static void beforeClass() throws Exception { LOG.info("@BeforeClass"); // will be always executed, even if a test fails throwing any Exception } /** * This method won't be executed if the unit test will be (externally) terminated (e.g. from within the IDE). */ @AfterClass public static void afterClass() throws Exception { LOG.info("@AfterClass"); // will be always executed, even if a test fails throwing any Exception } /** * This method won't be executed if the unit test will be (externally) terminated (e.g. from within the IDE). * You hav