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