Logger { public Level getLevel() { if (slf4jLogger.isErrorEnabled()) { return Level.SEVERE; } else if (slf4jLogger.isWarnEnabled()) { return Level.WARNING; } else if (slf4jLogger.isInfoEnabled()) { return Level.CONFIG; } else if (slf4jLogger.isDebugEnabled()) { return Level.FINE; } else if (slf4jLogger.isTraceEnabled()) { return Level.FINEST; } else { return Level.OFF; } } private  Logger(String name); @VisibleForTesting  Logger(org.slf4j.Logger logger); static Logger getLogger(String name); static Logger getLogger(String name,
            @SuppressWarnings("unused") String resourceBundleName); String getName(); void severe(String msg); void warning(String msg); void info(String msg); void config(String msg); void fine(String msg); void finer(String msg); void finest(String msg); void log(LogRecord record); void log(Level level, String msg); void log(Level level, String msg, @Nullable Object param1); void log(Level level, String msg, @Nullable Object[] params); void log(Level level, String msg, Throwable thrown); boolean isLoggable(Level level); Level getLevel(); @SuppressWarnings("unused") void logp(Level level, String sourceClass, String sourceMethod, String msg); @SuppressWarnings("unused") void logp(Level level, String sourceClass, String sourceMethod, String msg,
            Object param1); @SuppressWarnings("unused") void logp(Level level, String sourceClass, String sourceMethod, String msg,
            Object[] params); @SuppressWarnings("unused") void logp(Level level, String sourceClass, String sourceMethod, String msg,
            Throwable thrown); @SuppressWarnings("unused") void logrb(Level level, String sourceClass, String sourceMethod, String bundleName,
            String msg); @SuppressWarnings("unused") void logrb(Level level, String sourceClass, String sourceMethod, String bundleName,
            String msg, Object param1); @SuppressWarnings("unused") void logrb(Level level, String sourceClass, String sourceMethod, String bundleName,
            String msg, Object[] params); @SuppressWarnings("unused") void logrb(Level level, String sourceClass, String sourceMethod, ResourceBundle bundle,
            String msg, Object... params); @SuppressWarnings("unused") void logrb(Level level, ResourceBundle bundle, String msg, Object... params); @SuppressWarnings("unused") void logrb(Level level, String sourceClass, String sourceMethod, String bundleName,
            String msg, Throwable thrown); @SuppressWarnings("unused") void logrb(Level level, String sourceClass, String sourceMethod, ResourceBundle bundle,
            String msg, Throwable thrown); @SuppressWarnings("unused") void logrb(Level level, ResourceBundle bundle, String msg, Throwable thrown); @SuppressWarnings("unused") void entering(String sourceClass, String sourceMethod); @SuppressWarnings("unused") void entering(String sourceClass, String sourceMethod, Object param1); @SuppressWarnings("unused") void entering(String sourceClass, String sourceMethod, Object[] params); @SuppressWarnings("unused") void exiting(String sourceClass, String sourceMethod); @SuppressWarnings("unused") void exiting(String sourceClass, String sourceMethod, Object result); @SuppressWarnings("unused") void throwing(String sourceClass, String sourceMethod, Throwable thrown); @Nullable ResourceBundle getResourceBundle(); void setResourceBundle(ResourceBundle resourceBundle); @Nullable String getResourceBundleName(); Logger getParent(); void setParent(@SuppressWarnings("unused") Logger parent); void setLevel(@SuppressWarnings("unused") Level newLevel); static Logger getAnonymousLogger(); static Logger getAnonymousLogger(@SuppressWarnings("unused") String resourceBundleName); static final Logger getGlobal(); static final String GLOBAL_LOGGER_NAME; static final Logger global; }
@Test public void testGetLevelSevere() { org.slf4j.Logger slf4jLogger = mock(org.slf4j.Logger.class); when(slf4jLogger.isErrorEnabled()).thenReturn(true); Logger logger = new Logger(slf4jLogger); assertThat(logger.getLevel()).isEqualTo(Level.SEVERE); }
@Test public void testGetLevelWarning() { org.slf4j.Logger slf4jLogger = mock(org.slf4j.Logger.class); when(slf4jLogger.isWarnEnabled()).thenReturn(true); Logger logger = new Logger(slf4jLogger); assertThat(logger.getLevel()).isEqualTo(Level.WARNING); }
@Test public void testGetLevelConfig() { org.slf4j.Logger slf4jLogger = mock(org.slf4j.Logger.class); when(slf4jLogger.isInfoEnabled()).thenReturn(true); Logger logger = new Logger(slf4jLogger); assertThat(logger.getLevel()).isEqualTo(Level.CONFIG); }
@Test public void testGetLevelFine() { org.slf4j.Logger slf4jLogger = mock(org.slf4j.Logger.class); when(slf4jLogger.isDebugEnabled()).thenReturn(true); Logger logger = new Logger(slf4jLogger); assertThat(logger.getLevel()).isEqualTo(Level.FINE); }
@Test public void testGetLevelFinest() { org.slf4j.Logger slf4jLogger = mock(org.slf4j.Logger.class); when(slf4jLogger.isTraceEnabled()).thenReturn(true); Logger logger = new Logger(slf4jLogger); assertThat(logger.getLevel()).isEqualTo(Level.FINEST); }
@Test public void testGetLevelOff() { org.slf4j.Logger slf4jLogger = mock(org.slf4j.Logger.class); Logger logger = new Logger(slf4jLogger); assertThat(logger.getLevel()).isEqualTo(Level.OFF); }