View Javadoc
1   /*
2    * Licensed under the GPL License. You may not use this file except in compliance with the License.
3    * You may obtain a copy of the License at
4    *
5    *   https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
6    *
7    * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
8    * WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
9    * PURPOSE.
10   */
11  package psiprobe.tools.logging.jdk;
12  
13  import static org.junit.jupiter.api.Assertions.assertNotNull;
14  
15  import java.util.List;
16  
17  import org.junit.jupiter.api.BeforeEach;
18  import org.junit.jupiter.api.Test;
19  
20  import psiprobe.tools.logging.LogDestination;
21  
22  /**
23   * The Class Jdk14ManagerAccessorTest.
24   */
25  class Jdk14ManagerAccessorTest {
26  
27    /** The class loader. */
28    private ClassLoader classLoader;
29  
30    /**
31     * Sets the up.
32     */
33    @BeforeEach
34    void setUp() {
35      classLoader = getClass().getClassLoader();
36    }
37  
38    /**
39     * Test constructor and get root logger.
40     *
41     * @throws Exception the exception
42     */
43    @Test
44    void testConstructorAndGetRootLogger() throws Exception {
45      Jdk14ManagerAccessor accessor = new Jdk14ManagerAccessor(classLoader);
46      assertNotNull(accessor.getRootLogger());
47    }
48  
49    /**
50     * Test get logger.
51     *
52     * @throws Exception the exception
53     */
54    @Test
55    void testGetLogger() throws Exception {
56      Jdk14ManagerAccessor accessor = new Jdk14ManagerAccessor(classLoader);
57      assertNotNull(accessor.getLogger(""));
58      assertNotNull(accessor.getLogger("global"));
59    }
60  
61    /**
62     * Test get handlers.
63     *
64     * @throws Exception the exception
65     */
66    @Test
67    void testGetHandlers() throws Exception {
68      Jdk14ManagerAccessor accessor = new Jdk14ManagerAccessor(classLoader);
69      List<LogDestination> handlers = accessor.getHandlers();
70      assertNotNull(handlers);
71    }
72  
73  }