diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/InetAddressSetTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/InetAddressSetTest.java index 08699d0c4464..fc3018385afa 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/InetAddressSetTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/InetAddressSetTest.java @@ -122,14 +122,13 @@ public void testBadSingleton(final String badAddr) InetAddress inetAddress = InetAddress.getByName(badAddr); Assumptions.assumeTrue(inetAddress == null); } - catch (UnknownHostException ignored) + catch (UnknownHostException expected) { + //noinspection MismatchedQueryAndUpdateOfCollection + InetAddressSet inetAddressSet = new InetAddressSet(); + IllegalArgumentException cause = assertThrows(IllegalArgumentException.class, () -> inetAddressSet.add(badAddr)); + assertThat(cause.getMessage(), containsString(badAddr)); } - - //noinspection MismatchedQueryAndUpdateOfCollection - InetAddressSet inetAddressSet = new InetAddressSet(); - IllegalArgumentException cause = assertThrows(IllegalArgumentException.class, () -> inetAddressSet.add(badAddr)); - assertThat(cause.getMessage(), containsString(badAddr)); } @Test