diff --git a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/util/NetUtilsTest.java b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/util/NetUtilsTest.java index b22730657c0..23982560fce 100644 --- a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/util/NetUtilsTest.java +++ b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/util/NetUtilsTest.java @@ -17,11 +17,14 @@ package org.apache.logging.log4j.core.util; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assumptions.assumeThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import java.io.File; +import java.net.InetAddress; import java.net.URI; +import java.net.UnknownHostException; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.condition.EnabledOnOs; import org.junit.jupiter.api.condition.OS; @@ -73,7 +76,8 @@ public void testToUriWindowsAbsolutePath() { } @Test - public void testCanonicalHostName() { + public void testCanonicalHostName() throws UnknownHostException { + assumeThat(InetAddress.getLocalHost().getCanonicalHostName()).contains("."); // If this fails the host might be misconfigured assertThat(NetUtils.getCanonicalLocalHostname()).contains("."); }