UnixResolverDnsServerAddressStreamProvider implements DnsServerAddressStreamProvider { static int parseEtcResolverFirstNdots() throws IOException { return parseEtcResolverFirstNdots(new File(ETC_RESOLV_CONF_FILE)); } UnixResolverDnsServerAddressStreamProvider(File etcResolvConf, File... etcResolverFiles);  UnixResolverDnsServerAddressStreamProvider(String etcResolvConf, String etcResolverDir); @Override DnsServerAddressStream nameServerAddressStream(String hostname);  }
@Test public void ndotsIsParsedIfPresent() throws IOException { File f = buildFile("search localdomain\n" + "nameserver 127.0.0.11\n" + "options ndots:0\n"); assertEquals(0, parseEtcResolverFirstNdots(f)); f = buildFile("search localdomain\n" + "nameserver 127.0.0.11\n" + "options ndots:123 foo:goo\n"); assertEquals(123, parseEtcResolverFirstNdots(f)); }
@Test public void defaultValueReturnedIfNdotsNotPresent() throws IOException { File f = buildFile("search localdomain\n" + "nameserver 127.0.0.11\n"); assertEquals(DEFAULT_NDOTS, parseEtcResolverFirstNdots(f)); }