### Question:
OnceLogger extends LoggerWrapper { public static Logger once(Logger logger) { try { if (Boolean.parseBoolean(GlobalSettings.getProperty(ENABLE_ONCE_LOGGER_PROPERTY, "true"))) { return new OnceLogger(logger); } } catch (Exception ex) { logger.warn("Unable to wrap logger instance in OnceLogger. Falling back to non-decorated implementation, which may be noisy."); } return logger; } OnceLogger(Logger logger);   OnceLogger(Logger logger, String fqcn); static Logger once(Logger logger); @Override void trace(String msg); @Override void debug(String msg); @Override void info(String msg); @Override void warn(String msg); @Override void error(String msg);  }### Answer:
@Test public void onceReturnsDecoratedLogger() { Logger instance = once(mockLogger); assertTrue(instance instanceof OnceLogger); }
@Test public void onceReturnsOriginalLoggerWhenDisabled() { String originalSetting = GlobalSettings.getProperty(ENABLE_ONCE_LOGGER_PROPERTY); try { GlobalSettings.setProperty(ENABLE_ONCE_LOGGER_PROPERTY, "false"); Logger instance = once(mockLogger); assertFalse(instance instanceof OnceLogger); } finally { resetGlobalProperty(ENABLE_ONCE_LOGGER_PROPERTY, originalSetting); } }