Repository: netty/netty
File: resolver-dns/src/test/java/io/netty/resolver/dns/DnsNameResolverBuilderTest.java (Java)

Code before:
    }

    @AfterEach
    void tearDown() {
        if (resolver != null) {
            resolver.close();
        }
    }

    @AfterAll
    static void shutdownEventLoopGroup() {
        GROUP.shutdownGracefully();
    }

    @Test
    void testDefaults() {
        resolver = builder.build();

        checkDefaultDnsCache((DefaultDnsCache) resolver.resolveCache(), MAX_SUPPORTED_TTL_SECS, 0, 0);

        checkDefaultDnsCnameCache((DefaultDnsCnameCache) resolver.cnameCache(), MAX_SUPPORTED_TTL_SECS, 0);

        checkDefaultAuthoritativeDnsServerCache(
                (DefaultAuthoritativeDnsServerCache) resolver.authoritativeDnsServerCache(), MAX_SUPPORTED_TTL_SECS, 0);

        assertThat(resolver.queryDnsServerAddressStream()).isInstanceOf(ThreadLocalNameServerAddressStream.class);
    }

    @Test
    void testCustomDnsCacheDefaultTtl() {
        DnsCache testDnsCache = new TestDnsCache();
        resolver = builder.resolveCache(testDnsCache).build();

        assertThat(resolver.resolveCache()).isSameAs(testDnsCache);

        checkDefaultDnsCnameCache((DefaultDnsCnameCache) resolver.cnameCache(), MAX_SUPPORTED_TTL_SECS, 0);

        checkDefaultAuthoritativeDnsServerCache(
                (DefaultAuthoritativeDnsServerCache) resolver.authoritativeDnsServerCache(), MAX_SUPPORTED_TTL_SECS, 0);
    }

    @Test
    void testCustomDnsCacheCustomTtl() {
        DnsCache testDnsCache = new TestDnsCache();
        resolver = builder.resolveCache(testDnsCache).ttl(1, 2).negativeTtl(3).build();

        assertThat(resolver.resolveCache()).isSameAs(testDnsCache);

        checkDefaultDnsCnameCache((DefaultDnsCnameCache) resolver.cnameCache(), 2, 1);

        checkDefaultAuthoritativeDnsServerCache(

Review comment (suggestion):
```suggestion
assertThat(resolver.queryDnsServerAddressStream()).isInstanceOf(ThreadLocalNameServerAddressStream.class);
```

Code after:
    }

    @AfterEach
    void tearDown() {
        if (resolver != null) {
            resolver.close();
        }
    }

    @AfterAll
    static void shutdownEventLoopGroup() {
        GROUP.shutdownGracefully();
    }

    @Test
    void testDefaults() {
        resolver = builder.build();

        checkDefaultDnsCache((DefaultDnsCache) resolver.resolveCache(), MAX_SUPPORTED_TTL_SECS, 0, 0);

        checkDefaultDnsCnameCache((DefaultDnsCnameCache) resolver.cnameCache(), MAX_SUPPORTED_TTL_SECS, 0);

        checkDefaultAuthoritativeDnsServerCache(
                (DefaultAuthoritativeDnsServerCache) resolver.authoritativeDnsServerCache(), MAX_SUPPORTED_TTL_SECS, 0);
assertThat(resolver.queryDnsServerAddressStream()).isInstanceOf(ThreadLocalNameServerAddressStream.class);
    }

    @Test
    void testCustomDnsCacheDefaultTtl() {
        DnsCache testDnsCache = new TestDnsCache();
        resolver = builder.resolveCache(testDnsCache).build();

        assertThat(resolver.resolveCache()).isSameAs(testDnsCache);

        checkDefaultDnsCnameCache((DefaultDnsCnameCache) resolver.cnameCache(), MAX_SUPPORTED_TTL_SECS, 0);

        checkDefaultAuthoritativeDnsServerCache(
                (DefaultAuthoritativeDnsServerCache) resolver.authoritativeDnsServerCache(), MAX_SUPPORTED_TTL_SECS, 0);
    }

    @Test
    void testCustomDnsCacheCustomTtl() {
        DnsCache testDnsCache = new TestDnsCache();
        resolver = builder.resolveCache(testDnsCache).ttl(1, 2).negativeTtl(3).build();

        assertThat(resolver.resolveCache()).isSameAs(testDnsCache);

        checkDefaultDnsCnameCache((DefaultDnsCnameCache) resolver.cnameCache(), 2, 1);

        checkDefaultAuthoritativeDnsServerCache(
                (DefaultAuthoritativeDnsServerCache) resolver.authoritativeDnsServerCache(), 2, 1);