@Test public void resolveAll_failsOnEmptyResult() throws Exception { String hostname = "dns: DnsNameResolver nrf = new DnsNameResolverProvider().newNameResolver(new URI(hostname), Attributes.EMPTY); nrf.setAddressResolver(new AddressResolver() { @Override public List<InetAddress> resolveAddress(String host) throws Exception { return Collections.emptyList(); } }); new DnsNameResolver.Resolve(nrf, Stopwatch.createUnstarted(), 0).resolveInternal(mockListener); ArgumentCaptor<Status> ac = ArgumentCaptor.forClass(Status.class); verify(mockListener).onError(ac.capture()); verifyNoMoreInteractions(mockListener); assertThat(ac.getValue().getCode()).isEqualTo(Code.UNAVAILABLE); assertThat(ac.getValue().getDescription()).contains("No DNS backend or balancer addresses"); }
@VisibleForTesting void setAddressResolver(AddressResolver addressResolver) { this.addressResolver = addressResolver; }
DnsNameResolver extends NameResolver { @VisibleForTesting void setAddressResolver(AddressResolver addressResolver) { this.addressResolver = addressResolver; } }
DnsNameResolver extends NameResolver { @VisibleForTesting void setAddressResolver(AddressResolver addressResolver) { this.addressResolver = addressResolver; } DnsNameResolver(@Nullable String nsAuthority, String name, Attributes params,
      Resource<Executor> executorResource, ProxyDetector proxyDetector,
      Stopwatch stopwatch, boolean isAndroid); }
DnsNameResolver extends NameResolver { @VisibleForTesting void setAddressResolver(AddressResolver addressResolver) { this.addressResolver = addressResolver; } DnsNameResolver(@Nullable String nsAuthority, String name, Attributes params,
      Resource<Executor> executorResource, ProxyDetector proxyDetector,
      Stopwatch stopwatch, boolean isAndroid); @Override final String getServiceAuthority(); @Override final synchronized void start(Listener listener); @Override final synchronized void refresh(); @Override final synchronized void shutdown(); }
DnsNameResolver extends NameResolver { @VisibleForTesting void setAddressResolver(AddressResolver addressResolver) { this.addressResolver = addressResolver; } DnsNameResolver(@Nullable String nsAuthority, String name, Attributes params,
      Resource<Executor> executorResource, ProxyDetector proxyDetector,
      Stopwatch stopwatch, boolean isAndroid); @Override final String getServiceAuthority(); @Override final synchronized void start(Listener listener); @Override final synchronized void refresh(); @Override final synchronized void shutdown();  }