vy commented on code in PR #3921:
URL: https://github.com/apache/logging-log4j2/pull/3921#discussion_r2423090924
##########
log4j-core-test/src/test/java/org/apache/logging/log4j/core/config/ConfigurationFactoryTest.java:
##########
@@ -130,4 +136,63 @@ void properties(final LoggerContext context) throws
IOException {
final Path logFile = loggingPath.resolve("test-properties.log");
checkFileLogger(context, logFile);
}
+
+ @Test
+ void testGetConfigurationWithNullUris() {
+ final ConfigurationFactory factory =
ConfigurationFactory.getInstance();
+ try (final LoggerContext context = new LoggerContext("test")) {
+ assertThrows(NullPointerException.class, () ->
factory.getConfiguration(context, "test", (List<URI>) null));
+ }
+ }
+
+ @Test
+ void testGetConfigurationWithEmptyUris() {
+ final ConfigurationFactory factory =
ConfigurationFactory.getInstance();
+ try (final LoggerContext context = new LoggerContext("test")) {
+ assertThrows(
+ IllegalArgumentException.class,
+ () -> factory.getConfiguration(context, "test",
Collections.emptyList()));
+ }
+ }
+
+ @Test
+ void testGetConfigurationWithNullInList() {
+ final ConfigurationFactory factory =
ConfigurationFactory.getInstance();
+ try (final LoggerContext context = new LoggerContext("test")) {
+ final List<URI> listWithNull = Collections.singletonList(null);
+ assertThrows(ConfigurationException.class, () ->
factory.getConfiguration(context, "test", listWithNull));
+ }
+ }
+
+ @Test
+ void testGetConfigurationWithSingleUri() throws Exception {
+ final ConfigurationFactory factory =
ConfigurationFactory.getInstance();
Review Comment:
Fixed in a738f0da5.
--
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]