Skip to content

Commit 346acf3

Browse files
committed
Cleanup of example IPv6 addresses and redundant parentheses
1 parent c96667e commit 346acf3

File tree

2 files changed

+57
-217
lines changed

2 files changed

+57
-217
lines changed

src/test/java/org/xbill/DNS/HTTPSRecordTest.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import java.net.InetAddress;
1313
import java.net.UnknownHostException;
1414
import java.util.Arrays;
15+
import java.util.Collections;
1516
import java.util.List;
1617
import org.junit.jupiter.api.Test;
1718

@@ -32,7 +33,8 @@ void createParams() throws UnknownHostException, TextParseException {
3233
assertEquals(HTTPSRecord.PORT, port.getKey());
3334
assertEquals(8443, port.getPort());
3435

35-
List<Inet4Address> ipv4List = Arrays.asList((Inet4Address) InetAddress.getByName("1.2.3.4"));
36+
List<Inet4Address> ipv4List =
37+
Collections.singletonList((Inet4Address) InetAddress.getByName("1.2.3.4"));
3638
HTTPSRecord.ParameterIpv4Hint ipv4hint = new HTTPSRecord.ParameterIpv4Hint(ipv4List);
3739
assertEquals(HTTPSRecord.IPV4HINT, ipv4hint.getKey());
3840
assertEquals(ipv4List, ipv4hint.getAddresses());
@@ -42,7 +44,8 @@ void createParams() throws UnknownHostException, TextParseException {
4244
assertEquals(HTTPSRecord.ECHCONFIG, echconfig.getKey());
4345
assertEquals(data, echconfig.getData());
4446

45-
List<Inet6Address> ipv6List = Arrays.asList((Inet6Address) InetAddress.getByName("2001::1"));
47+
List<Inet6Address> ipv6List =
48+
Collections.singletonList((Inet6Address) InetAddress.getByName("2001:db8::1"));
4649
HTTPSRecord.ParameterIpv6Hint ipv6hint = new HTTPSRecord.ParameterIpv6Hint(ipv6List);
4750
assertEquals(HTTPSRecord.IPV6HINT, ipv6hint.getKey());
4851
assertEquals(ipv6List, ipv6hint.getAddresses());
@@ -112,10 +115,6 @@ void serviceModeEchConfigMulti() throws IOException {
112115
@Test
113116
void unknownKey() {
114117
String str = "1 . sport=8443";
115-
assertThrows(
116-
TextParseException.class,
117-
() -> {
118-
SVCBRecordTest.stringToWire(str);
119-
});
118+
assertThrows(TextParseException.class, () -> SVCBRecordTest.stringToWire(str));
120119
}
121120
}

0 commit comments

Comments
 (0)