From d2f26e26134178fd9bb6ec292705cbf4004228ec Mon Sep 17 00:00:00 2001 From: Tigran Mkrtchyan Date: Fri, 16 Sep 2022 17:40:08 +0200 Subject: [PATCH] test: skip tests that can be made under java19 java19 have made InetAddress sealed with permitted subtypes Inet4Address, Inet6Address. Thus we can't mock it anymore. Acked-by: Lea Morschel Target: master --- .../dcache/oncrpc4j/rpc/net/InetSocketAddressesTest.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/oncrpc4j-core/src/test/java/org/dcache/oncrpc4j/rpc/net/InetSocketAddressesTest.java b/oncrpc4j-core/src/test/java/org/dcache/oncrpc4j/rpc/net/InetSocketAddressesTest.java index 071ba869..763c276f 100644 --- a/oncrpc4j-core/src/test/java/org/dcache/oncrpc4j/rpc/net/InetSocketAddressesTest.java +++ b/oncrpc4j-core/src/test/java/org/dcache/oncrpc4j/rpc/net/InetSocketAddressesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 - 2018 Deutsches Elektronen-Synchroton, + * Copyright (c) 2009 - 2022 Deutsches Elektronen-Synchroton, * Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY * * This library is free software; you can redistribute it and/or modify @@ -24,7 +24,10 @@ import java.net.UnknownHostException; import org.junit.Test; + +import static org.hamcrest.Matchers.lessThanOrEqualTo; import static org.junit.Assert.*; +import static org.junit.Assume.assumeThat; import static org.mockito.Mockito.mock; public class InetSocketAddressesTest { @@ -130,6 +133,8 @@ public void testTCPv6Netid() throws UnknownHostException { @Test(expected = IllegalArgumentException.class) public void testInvalitInetaddressType() throws UnknownHostException { + // java19 have made InetAddress sealed with permitted subtypes Inet4Address, Inet6Address + assumeThat(Runtime.version().feature(), lessThanOrEqualTo(11)); InetAddress address = mock(InetAddress.class); // not a direct instance of Inet4/6Address assertEquals("invalid netid", "tcp6", InetSocketAddresses.tcpNetidOf(address)); }