1
2
3
4
5
6
7
8
9
10
11
12
13
14 package ch.qos.logback.classic.control;
15
16 import org.junit.jupiter.api.Assertions;
17 import org.junit.jupiter.api.BeforeEach;
18 import org.junit.jupiter.api.Test;
19
20 import ch.qos.logback.classic.Level;
21
22
23
24
25
26 public class ControlLoggerContextTest {
27 ControlLoggerContext clc;
28
29 @BeforeEach
30 public void setUp() throws Exception {
31 clc = new ControlLoggerContext();
32 }
33
34 @Test
35 public void smoke() {
36 ControlLogger x = clc.getLogger("x");
37 Assertions.assertEquals("x", x.getName());
38 Assertions.assertEquals(clc.getRootLogger(), x.parent);
39
40 ControlLogger abc = clc.getLogger("a.b.c");
41 Assertions.assertEquals("a.b.c", abc.getName());
42 Assertions.assertEquals(Level.DEBUG, abc.getEffectiveLevel());
43 }
44
45 @Test
46 public void testCreation() {
47 ControlLogger xyz = clc.getLogger("x.y.z");
48 Assertions.assertEquals("x.y.z", xyz.getName());
49 Assertions.assertEquals("x.y", xyz.parent.getName());
50 Assertions.assertEquals("x", xyz.parent.parent.getName());
51 Assertions.assertEquals("root", xyz.parent.parent.parent.getName());
52
53 ControlLogger xyz_ = clc.exists("x.y.z");
54 Assertions.assertEquals("x.y.z", xyz_.getName());
55
56 }
57 }