@Test public void testGetDefaultInstance() throws Exception { final Constructor<IpAddressBuilder> constructor = IpAddressBuilder.class.getDeclaredConstructor(); assertFalse(constructor.isAccessible()); constructor.setAccessible(true); final IpAddressBuilder newInstance = constructor.newInstance(); assertNotNull(newInstance); testIpv4("1.1.1.1"); testIpv4("192.168.155.100"); testIpv4("1.192.1.221"); testIpv6("ABCD:EF01:2345:6789:ABCD:EF01:2345:6789"); testIpv6("2001:DB8:0:0:8:800:200C:417A"); testIpv6("0:0:0:0:0:0:0:0"); testIpv6("::1.2.3.4"); testIpv6("ABCD:EF01:2345:6789:ABCD:EF01:2345:6789"); testIpv6("2001:DB8:0:0:8:800:200C:417A"); testIpv6("2001:DB8::8:800:200C:417A"); testIpv6("FF01:0:0:0:0:0:0:101"); testIpv6("FF01::101"); testIpv6("0:0:0:0:0:0:0:1"); testIpv6("::1"); testIpv6("::"); }
public static IpAddress getDefaultInstance(final String defaultValue) { return IPV4_PATTERN.matcher(defaultValue).matches() ? new IpAddress(new Ipv4Address(defaultValue)) : new IpAddress(new Ipv6Address(defaultValue)); }
IpAddressBuilder { public static IpAddress getDefaultInstance(final String defaultValue) { return IPV4_PATTERN.matcher(defaultValue).matches() ? new IpAddress(new Ipv4Address(defaultValue)) : new IpAddress(new Ipv6Address(defaultValue)); } }
IpAddressBuilder { public static IpAddress getDefaultInstance(final String defaultValue) { return IPV4_PATTERN.matcher(defaultValue).matches() ? new IpAddress(new Ipv4Address(defaultValue)) : new IpAddress(new Ipv6Address(defaultValue)); } private  IpAddressBuilder(); }
IpAddressBuilder { public static IpAddress getDefaultInstance(final String defaultValue) { return IPV4_PATTERN.matcher(defaultValue).matches() ? new IpAddress(new Ipv4Address(defaultValue)) : new IpAddress(new Ipv6Address(defaultValue)); } private  IpAddressBuilder(); static IpAddress getDefaultInstance(final String defaultValue); }
IpAddressBuilder { public static IpAddress getDefaultInstance(final String defaultValue) { return IPV4_PATTERN.matcher(defaultValue).matches() ? new IpAddress(new Ipv4Address(defaultValue)) : new IpAddress(new Ipv6Address(defaultValue)); } private  IpAddressBuilder(); static IpAddress getDefaultInstance(final String defaultValue);  }