1
2
3
4
5
6
7
8
9
10
11
12
13
14 package ch.qos.logback.classic.util;
15
16 import ch.qos.logback.classic.ClassicConstants;
17 import ch.qos.logback.classic.Logger;
18 import ch.qos.logback.classic.LoggerContext;
19 import ch.qos.logback.classic.spi.ILoggingEvent;
20 import ch.qos.logback.core.Appender;
21 import ch.qos.logback.core.ConsoleAppender;
22 import ch.qos.logback.core.CoreConstants;
23 import org.junit.jupiter.api.AfterEach;
24 import org.junit.jupiter.api.BeforeEach;
25 import org.junit.jupiter.api.Disabled;
26 import org.junit.jupiter.api.Test;
27 import org.slf4j.LoggerFactory;
28
29 import static org.junit.jupiter.api.Assertions.assertNotNull;
30 import static org.junit.jupiter.api.Assertions.assertTrue;
31
32 public class ContextInitializerAutoConfigTest {
33
34 org.slf4j.Logger logger = LoggerFactory.getLogger(this.getClass());
35 Logger root = (Logger) LoggerFactory.getLogger("root");
36
37 @BeforeEach
38 public void setUp() throws Exception {
39 logger.debug("Hello-didily-odily");
40 }
41
42 @AfterEach
43 public void tearDown() throws Exception {
44 System.clearProperty(ClassicConstants.CONFIG_FILE_PROPERTY);
45 System.clearProperty(CoreConstants.STATUS_LISTENER_CLASS_KEY);
46 }
47
48 @Test
49 @Disabled
50
51
52
53
54 public void autoconfig() {
55 LoggerContext iLoggerFactory = (LoggerContext) LoggerFactory.getILoggerFactory();
56 iLoggerFactory.reset();
57 Appender<ILoggingEvent> appender = root.getAppender("STDOUT");
58 assertNotNull(appender);
59 assertTrue(appender instanceof ConsoleAppender);
60 }
61 }