1
2
3
4
5
6
7
8
9
10 package ch.qos.logback.classic;
11
12 import static org.junit.Assert.assertEquals;
13 import static org.junit.Assert.assertNull;
14
15 import java.util.HashMap;
16
17 import org.junit.Test;
18 import org.slf4j.MDC;
19
20 public class MDCTest {
21
22 @Test
23 public void test() throws InterruptedException {
24 MDCTestThread threadA = new MDCTestThread("a");
25 threadA.start();
26
27 MDCTestThread threadB = new MDCTestThread("b");
28 threadB.start();
29
30 threadA.join();
31 threadB.join();
32
33 assertNull(threadA.x0);
34 assertEquals("a", threadA.x1);
35 assertNull(threadA.x2);
36
37 assertNull(threadB.x0);
38 assertEquals("b", threadB.x1);
39 assertNull(threadB.x2);
40
41 }
42
43 @Test
44 public void testLBCLASSIC_98() {
45 MDC.setContextMap(new HashMap<String, String>());
46 }
47
48 }