@Test
public void shouldPickIpv6WhenBothAreDefinedButIpv6IsPreferred() {

    Map<String, Inet4Address> inet4Entries = new HashMap<String, Inet4Address>();
    Map<String, Inet6Address> inet6Entries = new HashMap<String, Inet6Address>();
    inet4Entries.put("localhost", NetUtil.LOCALHOST4);
    inet6Entries.put("localhost", NetUtil.LOCALHOST6);
    DefaultHostsFileEntriesResolver resolver =
            new DefaultHostsFileEntriesResolver(new HostsFileEntries(inet4Entries, inet6Entries));
    InetAddress address = resolver.address("localhost", ResolvedAddressTypes.IPV6_PREFERRED);
    Assert.assertTrue("Should pick an IPv6 address", address instanceof Inet6Address);
}