Java Code Examples for org.apache.commons.configuration2.AbstractConfiguration#setLogger()

The following examples show how to use org.apache.commons.configuration2.AbstractConfiguration#setLogger() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestConfigurationLogger.java    From commons-configuration with Apache License 2.0 5 votes vote down vote up
/**
 * Tests whether the logger can be set.
 */
@Test
public void testAbstractConfigurationSetLogger()
{
    final ConfigurationLogger logger = new ConfigurationLogger(getClass());
    final AbstractConfiguration config = new BaseConfiguration();

    config.setLogger(logger);
    assertThat("Logger not set", config.getLogger(), sameInstance(logger));
}
 
Example 2
Source File: TestConfigurationLogger.java    From commons-configuration with Apache License 2.0 5 votes vote down vote up
/**
 * Tests that the logger can be disabled by setting it to null.
 */
@Test
public void testAbstractConfigurationSetLoggerNull()
{
    final AbstractConfiguration config = new BaseConfiguration();
    config.setLogger(new ConfigurationLogger(getClass()));

    config.setLogger(null);
    assertThat("Logger not disabled", config.getLogger().getLog(), instanceOf(NoOpLog.class));
}