DnsEndpointGroupBuilder { public DnsEndpointGroupBuilder ttl(int minTtl, int maxTtl) { checkArgument(minTtl > 0 && minTtl <= maxTtl, "minTtl: %s, maxTtl: %s (expected: 1 <= minTtl <= maxTtl)", minTtl, maxTtl); this.minTtl = minTtl; this.maxTtl = maxTtl; return this; } DnsEndpointGroupBuilder(String hostname); DnsEndpointGroupBuilder eventLoop(EventLoop eventLoop); DnsEndpointGroupBuilder ttl(int minTtl, int maxTtl); DnsEndpointGroupBuilder queryTimeout(Duration queryTimeout); DnsEndpointGroupBuilder queryTimeoutMillis(long queryTimeoutMillis); DnsEndpointGroupBuilder serverAddresses(InetSocketAddress... serverAddresses); DnsEndpointGroupBuilder serverAddresses(Iterable<InetSocketAddress> serverAddresses); DnsEndpointGroupBuilder backoff(Backoff backoff); DnsEndpointGroupBuilder selectionStrategy(EndpointSelectionStrategy selectionStrategy);  }
@Test void ttl() { assertThat(builder().minTtl()).isOne(); assertThat(builder().maxTtl()).isEqualTo(Integer.MAX_VALUE); final Builder builderWithCustomTtl = builder().ttl(10, 20); assertThat(builderWithCustomTtl.minTtl()).isEqualTo(10); assertThat(builderWithCustomTtl.maxTtl()).isEqualTo(20); assertThatThrownBy(() -> builder().ttl(0, 10)).isInstanceOf(IllegalArgumentException.class); assertThatThrownBy(() -> builder().ttl(20, 10)).isInstanceOf(IllegalArgumentException.class); final Builder builderWithSameCustomTtl = builder().ttl(1, 1); assertThat(builderWithSameCustomTtl.minTtl()).isOne(); assertThat(builderWithSameCustomTtl.maxTtl()).isOne(); }