Repository: netty/netty
File: handler/src/test/java/io/netty/handler/ssl/EnhancedX509ExtendedTrustManagerTest.java (Java)

Code before:
import javax.net.ssl.SSLSocket;
import javax.net.ssl.X509ExtendedTrustManager;
import javax.security.auth.x500.X500Principal;

import static io.netty.handler.ssl.EnhancingX509ExtendedTrustManager.ALTNAME_DNS;
import static io.netty.handler.ssl.EnhancingX509ExtendedTrustManager.ALTNAME_IP;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.Named.named;
import static org.junit.jupiter.params.provider.Arguments.arguments;

public class EnhancedX509ExtendedTrustManagerTest {

    private static final String SAN_ENTRY_DNS = "some.netty.io";
    private static final String SAN_ENTRY_IP = "127.0.0.1";
    private static final String COMMON_NAME = "leaf.netty.io";

    private static final X509Certificate TEST_CERT = new X509Certificate() {

        @Override
        public Collection<List<?>> getSubjectAlternativeNames() {
            return Arrays.asList(Arrays.asList(1, new Object()),
                    Arrays.asList(ALTNAME_DNS, "some.netty.io"), Arrays.asList(ALTNAME_IP, "127.0.0.1"));
        }

        @Override
        public X500Principal getSubjectX500Principal() {
            return new X500Principal("CN=" + COMMON_NAME + ", O=Netty");
        }

        @Override
        public void checkValidity() {
            // NOOP
        }

        @Override
        public void checkValidity(Date date) {
            // NOOP
        }

        @Override
        public int getVersion() {
            return 0;
        }

        @Override
        public BigInteger getSerialNumber() {
            return null;

Review comment (suggestion):
```suggestion
                    Arrays.asList(ALTNAME_DNS, SAN_ENTRY_DNS), Arrays.asList(ALTNAME_IP, SAN_ENTRY_IP));
```

Code after:
import java.util.Set;
import javax.net.ssl.ExtendedSSLSession;
import javax.net.ssl.SNIHostName;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.X509ExtendedTrustManager;
import javax.security.auth.x500.X500Principal;

import static io.netty.handler.ssl.EnhancingX509ExtendedTrustManager.ALTNAME_DNS;
import static io.netty.handler.ssl.EnhancingX509ExtendedTrustManager.ALTNAME_IP;
import static io.netty.handler.ssl.EnhancingX509ExtendedTrustManager.ALTNAME_URI;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.fail;
import static org.junit.jupiter.api.Named.named;
import static org.junit.jupiter.params.provider.Arguments.arguments;

public class EnhancedX509ExtendedTrustManagerTest {

    private static final String HOSTNAME = "netty.io";
    private static final String SAN_ENTRY_DNS = "some.netty.io";
    private static final String SAN_ENTRY_IP = "127.0.0.1";
    private static final String SAN_ENTRY_URI = "URI:https://uri.netty.io/profile";
    private static final String SAN_ENTRY_RFC822 = "info@netty.io";
    private static final String COMMON_NAME = "leaf.netty.io";

    private static final X509Certificate TEST_CERT = new X509Certificate() {

        @Override
        public Collection<List<?>> getSubjectAlternativeNames() {
            return Arrays.asList(Arrays.asList(1, new Object()),
                    Arrays.asList(ALTNAME_DNS, SAN_ENTRY_DNS), Arrays.asList(ALTNAME_IP, SAN_ENTRY_IP),
                    Arrays.asList(ALTNAME_URI, SAN_ENTRY_URI), Arrays.asList(1 /* rfc822Name */, SAN_ENTRY_RFC822));
        }

        @Override
        public X500Principal getSubjectX500Principal() {
            return new X500Principal("CN=" + COMMON_NAME + ", O=Netty");
        }

        @Override
        public void checkValidity() {
            // NOOP
        }

        @Override
        public void checkValidity(Date date) {
            // NOOP