InetNetworkBuilder { public InetNetwork getFromString(String netspec) throws UnknownHostException { return isV6(netspec) ? getV6FromString(netspec) : getV4FromString(netspec); } InetNetworkBuilder(DNSService dnsServer); InetNetwork getFromString(String netspec); static boolean isV6(String netspec);  }
@Test public void testInetNetworkBuilderDnsV4() throws UnknownHostException { inetNetworkBuilder = new InetNetworkBuilder(DNSFixture.DNS_SERVER_IPV4_MOCK); inetNetwork = inetNetworkBuilder.getFromString(DNSFixture.LOCALHOST_IP_V4_ADDRESS_0); assertThat(inetNetwork.toString()).isEqualTo("127.0.0.0/255.255.0.0"); inetNetwork = inetNetworkBuilder.getFromString(DNSFixture.LOCALHOST_IP_V4_ADDRESS_1); assertThat(inetNetwork.toString()).isEqualTo("172.16.0.0/255.255.0.0"); }
@Test public void testInetNetworkBuilderDnsV6() throws UnknownHostException { inetNetworkBuilder = new InetNetworkBuilder(DNSFixture.DNS_SERVER_IPV6_MOCK); inetNetwork = inetNetworkBuilder.getFromString(DNSFixture.LOCALHOST_IP_V6_ADDRESS_0); assertThat(inetNetwork.toString()).isEqualTo("0:0:0:0:0:0:0:1/32768"); inetNetwork = inetNetworkBuilder.getFromString(DNSFixture.LOCALHOST_IP_V6_ADDRESS_1); assertThat(inetNetwork.toString()).isEqualTo("2781:db8:1234:0:0:0:0:0/48"); }