@Test
    void resolvePreferredRecordsFirst() {
        final CompletableFuture<List<DnsRecord>> future = new CompletableFuture<>();
        final List<? extends DnsQuestion> questions = ImmutableList.of(
                DnsQuestionWithoutTrailingDot.of("foo.com.", DnsRecordType.A),
                DnsQuestionWithoutTrailingDot.of("foo.com.", DnsRecordType.AAAA));
        final Object[] results = new Object[questions.size()];

        final DnsQuestionContext ctx = new DnsQuestionContext(CommonPools.workerGroup().next(), Long.MAX_VALUE);
        final List<DnsRecord> fooDnsRecord = ImmutableList.of(newAddressRecord("foo.com.", "1.2.3.4"));
        maybeCompletePreferredRecords(ctx, future, questions, results, 0, fooDnsRecord, null);
        // The preferred question is resolved. Don't need to wait for the questions.
        assertThat(future).isCompletedWithValue(fooDnsRecord);
        assertThat(ctx.isCompleted()).isTrue();
    }
This test does not check anything but makes the future returned by
{@link DefaultDnsResolver#resolve(List, String)}} is completed even before the DNS responses
are received. By doing so, we can make our leak detectors detect any leaks if we forgot to release
the DNS responses. See https://github.com/line/armeria/pull/2951 for more information.
core/src/test/java/com/linecorp/armeria/internal/client/dns/DefaultDnsResolverTest.java