ppkarwasz commented on code in PR #3773:
URL: https://github.com/apache/logging-log4j2/pull/3773#discussion_r2173152567
##########
log4j-core-test/src/test/java/org/apache/logging/log4j/core/LoggerContextTest.java:
##########
@@ -75,4 +82,23 @@ void getLoggers_can_be_updated_concurrently(final TestInfo
testInfo) {
executorService.shutdown();
}
}
+
+ @Test
+ @Issue("https://github.com/apache/logging-log4j2/issues/3770")
+ void start_should_fallback_on_reconfigure_if_context_already_started(final
TestInfo testInfo) {
+ final String testName = testInfo.getDisplayName();
+ try (final LoggerContext loggerContext = new LoggerContext(testName)) {
+ loggerContext.start();
+ assertThat(loggerContext.isStarted()).isTrue();
+
assertThat(loggerContext.getConfiguration()).isInstanceOf(DefaultConfiguration.class);
+ // Start
+ Configuration configuration = mock(
+ AbstractConfiguration.class,
+ withSettings()
+ .useConstructor(null,
ConfigurationSource.NULL_SOURCE)
+ .defaultAnswer(CALLS_REAL_METHODS));
Review Comment:
Yes, the `Configuration` interface is not very easy to mock.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]