1 package integrationTests;
2
3 import org.junit.jupiter.api.Test;
4
5 class ShutdownTest {
6 @Test
7 void addShutdownHookToExerciseSUTAfterTestRunHasFinished() {
8 Runtime.getRuntime().addShutdownHook(new Thread() {
9 @Override
10 public void run() {
11 exerciseSUT();
12 }
13 });
14 }
15
16 void exerciseSUT() {
17 new ClassNotExercised().doSomething(123, "not to be counted");
18 ClassWithNestedClasses.doSomething();
19 }
20 }