Skip to content

Commit

Permalink
test: skip tests that can be made under java19
Browse files Browse the repository at this point in the history
java19 have made InetAddress sealed with permitted subtypes
Inet4Address, Inet6Address. Thus we can't mock it anymore.

Acked-by: Lea Morschel
Target: master
  • Loading branch information
kofemann committed Sep 23, 2022
1 parent 4e98f79 commit d2f26e2
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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));
}
Expand Down

0 comments on commit d2f26e2

Please sign in to comment.