1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package ch.qos.logback.core.util;
16
17 import ch.qos.logback.core.Context;
18 import ch.qos.logback.core.ContextBase;
19 import ch.qos.logback.core.hook.ShutdownHookBase;
20 import org.junit.jupiter.api.Disabled;
21 import org.junit.jupiter.api.Test;
22
23
24
25
26
27
28
29
30 @Disabled
31 class ContextUtilAddOrReplaceShutdownHookTest {
32
33 Context context = new ContextBase();
34 ContextUtil contextUtil = new ContextUtil(context);
35
36 @Test
37 public void smoke() {
38
39 contextUtil.addOrReplaceShutdownHook(new HelloShutdownHookHook(2));
40 contextUtil.addOrReplaceShutdownHook(new HelloShutdownHookHook(3));
41 contextUtil.addOrReplaceShutdownHook(new HelloShutdownHookHook(5));
42
43
44 }
45
46 static class HelloShutdownHookHook extends ShutdownHookBase {
47
48 int number;
49
50
51 public HelloShutdownHookHook(int number) {
52 this.number = number;
53
54 }
55
56 @Override
57 public void run() {
58 System.out.println(this);
59 }
60
61 @Override
62 public String toString() {
63 return "HelloShutdownHookHook{" + "number=" + number + '}';
64 }
65 }
66
67 }