1 /*
2 * MIT License
3 * Copyright (c) 2006-2025 JMockit developers
4 * See LICENSE file for full license text.
5 */
6 package integration.tests;
7
8 import org.junit.jupiter.api.Test;
9
10 class ShutdownTest {
11 @Test
12 void addShutdownHookToExerciseSUTAfterTestRunHasFinished() {
13 Runtime.getRuntime().addShutdownHook(new Thread() {
14 @Override
15 public void run() {
16 exerciseSUT();
17 }
18 });
19 }
20
21 void exerciseSUT() {
22 new ClassNotExercised().doSomething(123, "not to be counted");
23 ClassWithNestedClasses.doSomething();
24 }
25 }