Configuration implements LogConfigListener { static LogLevelUpdateOccurs getLogLevelUpdateOccurs() { try { return LogLevelUpdateOccurs.valueOf(System.getProperty(LOG_LEVEL_UPDATE_OCCURS_PROPERTY, ONLY_WHEN_USING_DEFAULT_CONFIG.name()).toUpperCase()); } catch (IllegalArgumentException e) { return ONLY_WHEN_USING_DEFAULT_CONFIG; } } private  Configuration(final LogLevelUpdateOccurs logLevelUpdateOccurs,
      final LogLevelUpdateScope logLevelUpdateScope, final LoggingProvider loggingProvider); static Configuration create(); @VisibleForTesting static Configuration create(final LoggingProvider loggingProvider); @VisibleForTesting static Configuration create(final LogLevelUpdateOccurs logLevelUpdateOccurs,
      final LogLevelUpdateScope logLevelUpdateScope); @VisibleForTesting static Configuration create(final LogLevelUpdateOccurs logLevelUpdateOccurs,
      final LogLevelUpdateScope logLevelUpdateScope, final LoggingProvider loggingProvider); synchronized void initialize(final LogConfigSupplier logConfigSupplier); @Override synchronized void configChanged(); synchronized void shutdown(); @VisibleForTesting
  static final int DEFAULT_LOGWRITER_LEVEL; static final String STARTUP_CONFIGURATION; static final String CLI_CONFIG; static final String LOG_LEVEL_UPDATE_OCCURS_PROPERTY; }
@Test public void getLogLevelUpdateOccurs_defaultsTo_ONLY_WHEN_USING_DEFAULT_CONFIG() { assertThat(Configuration.getLogLevelUpdateOccurs()) .isEqualTo(LogLevelUpdateOccurs.ONLY_WHEN_USING_DEFAULT_CONFIG); }
@Test public void getLogLevelUpdateOccurs_usesSystemPropertySetTo_ONLY_WHEN_USING_DEFAULT_CONFIG() { System.setProperty(LOG_LEVEL_UPDATE_OCCURS_PROPERTY, LogLevelUpdateOccurs.ONLY_WHEN_USING_DEFAULT_CONFIG.name()); assertThat(Configuration.getLogLevelUpdateOccurs()) .isEqualTo(LogLevelUpdateOccurs.ONLY_WHEN_USING_DEFAULT_CONFIG); }
@Test public void getLogLevelUpdateOccurs_usesSystemPropertySetTo_ALWAYS() { System.setProperty(LOG_LEVEL_UPDATE_OCCURS_PROPERTY, LogLevelUpdateOccurs.ALWAYS.name()); assertThat(Configuration.getLogLevelUpdateOccurs()).isEqualTo(LogLevelUpdateOccurs.ALWAYS); }
@Test public void getLogLevelUpdateOccurs_usesSystemPropertySetTo_NEVER() { System.setProperty(LOG_LEVEL_UPDATE_OCCURS_PROPERTY, LogLevelUpdateOccurs.NEVER.name()); assertThat(Configuration.getLogLevelUpdateOccurs()).isEqualTo(LogLevelUpdateOccurs.NEVER); }
@Test public void getLogLevelUpdateOccurs_usesSystemPropertySetTo_only_when_using_default_config() { System.setProperty(LOG_LEVEL_UPDATE_OCCURS_PROPERTY, LogLevelUpdateOccurs.ONLY_WHEN_USING_DEFAULT_CONFIG.name().toLowerCase()); assertThat(Configuration.getLogLevelUpdateOccurs()) .isEqualTo(LogLevelUpdateOccurs.ONLY_WHEN_USING_DEFAULT_CONFIG); }
@Test public void getLogLevelUpdateOccurs_usesSystemPropertySetTo_always() { System.setProperty(LOG_LEVEL_UPDATE_OCCURS_PROPERTY, LogLevelUpdateOccurs.ALWAYS.name().toLowerCase()); assertThat(Configuration.getLogLevelUpdateOccurs()).isEqualTo(LogLevelUpdateOccurs.ALWAYS); }
@Test public void getLogLevelUpdateOccurs_usesSystemPropertySetTo_never() { System.setProperty(LOG_LEVEL_UPDATE_OCCURS_PROPERTY, LogLevelUpdateOccurs.NEVER.name().toLowerCase()); assertThat(Configuration.getLogLevelUpdateOccurs()).isEqualTo(LogLevelUpdateOccurs.NEVER); }
@Test public void getLogLevelUpdateOccurs_usesDefaultWhenSystemPropertySetTo_gibberish() { System.setProperty(LOG_LEVEL_UPDATE_OCCURS_PROPERTY, "gibberish"); assertThat(Configuration.getLogLevelUpdateOccurs()) .isEqualTo(LogLevelUpdateOccurs.ONLY_WHEN_USING_DEFAULT_CONFIG); }