MXHostAddressIterator implements Iterator<HostAddress> { @Override public boolean hasNext() { return addresses.hasNext(); } MXHostAddressIterator(Iterator<String> hosts, DNSService dns, boolean useSingleIP);  MXHostAddressIterator(Iterator<String> hosts, int defaultPort, DNSService dns, boolean useSingleIP); @Override boolean hasNext(); @Override HostAddress next(); @Override void remove();  }
@Test public void testIteratorWithInvalidMX() { MXHostAddressIterator it = new MXHostAddressIterator(Arrays.asList("localhost").iterator(), new InMemoryDNSService(), false); assertThat(it.hasNext()).isFalse(); }