2828import static io .microsphere .logging .LoggingUtils .load ;
2929import static io .microsphere .logging .jdk .JavaLogging .ALL_LEVELS ;
3030import static io .microsphere .logging .jdk .JavaLogging .PRIORITY ;
31+ import static io .microsphere .logging .jdk .JavaLogging .ROOT_LOGGER_NAME ;
3132import static io .microsphere .logging .jdk .JavaLogging .loggingMXBean ;
3233import static io .microsphere .util .StringUtils .isBlank ;
3334import static org .junit .jupiter .api .Assertions .assertEquals ;
@@ -46,66 +47,72 @@ class JavaLoggingTest {
4647 */
4748 public static final Set <String > JAVA_LOGGING_LEVELS = ofSet ("OFF" , "SEVERE" , "WARNING" , "INFO" , "CONFIG" , "FINE" , "FINER" , "FINEST" , "ALL" );
4849
49- private JavaLogging JavaLogging ;
50+ private JavaLogging logging ;
5051
5152 @ BeforeEach
5253 void setUp () {
53- this .JavaLogging = (JavaLogging ) load ();
54+ this .logging = (JavaLogging ) load ();
5455 }
5556
5657 @ Test
5758 void testConstants () {
59+ assertEquals ("" , ROOT_LOGGER_NAME );
5860 assertEquals (10 , PRIORITY );
5961 assertEquals (JAVA_LOGGING_LEVELS , ALL_LEVELS );
6062 }
6163
64+ @ Test
65+ void testGetRootLoggerName () {
66+ assertEquals (ROOT_LOGGER_NAME , this .logging .getRootLoggerName ());
67+ }
68+
6269 @ Test
6370 void testGetLoggerNames () {
64- assertEquals (this .JavaLogging .getLoggerNames (), loggingMXBean .getLoggerNames ());
71+ assertEquals (this .logging .getLoggerNames (), loggingMXBean .getLoggerNames ());
6572 }
6673
6774 @ Test
6875 void testGetSupportedLoggingLevels () {
69- assertEquals (JAVA_LOGGING_LEVELS , this .JavaLogging .getSupportedLoggingLevels ());
76+ assertEquals (JAVA_LOGGING_LEVELS , this .logging .getSupportedLoggingLevels ());
7077 }
7178
7279 @ Test
7380 void testGetLoggerLevel () {
74- List <String > loggerNames = this .JavaLogging .getLoggerNames ();
75- loggerNames .forEach (loggerName -> assertEquals (this .JavaLogging .getLoggerLevel (loggerName ), loggingMXBean .getLoggerLevel (loggerName )));
81+ List <String > loggerNames = this .logging .getLoggerNames ();
82+ loggerNames .forEach (loggerName -> assertEquals (this .logging .getLoggerLevel (loggerName ), loggingMXBean .getLoggerLevel (loggerName )));
7683 }
7784
7885 @ Test
7986 void testSetLoggerLevel () {
80- List <String > loggerNames = this .JavaLogging .getLoggerNames ();
87+ List <String > loggerNames = this .logging .getLoggerNames ();
8188 for (String loggerName : loggerNames ) {
82- String level = this .JavaLogging .getLoggerLevel (loggerName );
89+ String level = this .logging .getLoggerLevel (loggerName );
8390 if (isBlank (level )) {
8491 continue ;
8592 }
8693 for (String newLevel : ALL_LEVELS ) {
87- this .JavaLogging .setLoggerLevel (loggerName , newLevel );
88- assertEquals (newLevel , this .JavaLogging .getLoggerLevel (loggerName ));
94+ this .logging .setLoggerLevel (loggerName , newLevel );
95+ assertEquals (newLevel , this .logging .getLoggerLevel (loggerName ));
8996 }
90- this .JavaLogging .setLoggerLevel (loggerName , level );
97+ this .logging .setLoggerLevel (loggerName , level );
9198 }
9299 }
93100
94101 @ Test
95102 void testGetParentLoggerName () {
96- List <String > loggerNames = this .JavaLogging .getLoggerNames ();
103+ List <String > loggerNames = this .logging .getLoggerNames ();
97104 for (String loggerName : loggerNames ) {
98- assertEquals (this .JavaLogging .getParentLoggerName (loggerName ), loggingMXBean .getParentLoggerName (loggerName ));
105+ assertEquals (this .logging .getParentLoggerName (loggerName ), loggingMXBean .getParentLoggerName (loggerName ));
99106 }
100107 }
101108
102109 @ Test
103110 void testGetName () {
104- assertEquals ("Java Logging" , this .JavaLogging .getName ());
111+ assertEquals ("Java Logging" , this .logging .getName ());
105112 }
106113
107114 @ Test
108115 void testGetPriority () {
109- assertEquals (PRIORITY , this .JavaLogging .getPriority ());
116+ assertEquals (PRIORITY , this .logging .getPriority ());
110117 }
111118}
0 commit comments