### Question:
MultipleAddresses { public List<String> getAllHostStrings() { return addresses.stream().map(InetSocketAddress::getHostString).distinct().collect(Collectors.toList()); } MultipleAddresses();  MultipleAddresses(Collection<InetSocketAddress> addresses);  MultipleAddresses(InetSocketAddress address);  MultipleAddresses(Collection<InetSocketAddress> addresses, Duration timeout); boolean isEmpty(); Set<InetSocketAddress> getAllAddresses(); Set<InetSocketAddress> getWildcardAddresses(); List<Integer> getAllPorts(); List<String> getAllHostStrings(); void addAddress(InetSocketAddress address); InetSocketAddress getReachableAddress(); Set<InetSocketAddress> getAllReachableAddresses(); Set<InetSocketAddress> getAllReachableAddressesOrAll(); InetSocketAddress getReachableOrOne(); void recreateSocketAddresses(); InetSocketAddress getOne(); int size(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static final Duration DEFAULT_TIMEOUT; }### Answer:
@Test public void testGetAllHostStrings() { List<InetSocketAddress> addresses = getAddressList(); List<String> hostStrings = getHostStrings(addresses); MultipleAddresses multipleAddresses = new MultipleAddresses(addresses); assertTrue(CollectionUtils.isEqualCollection(hostStrings, multipleAddresses.getAllHostStrings())); multipleAddresses.addAddress(addresses.get(addresses.size() - 1)); assertTrue(CollectionUtils.isEqualCollection(hostStrings, multipleAddresses.getAllHostStrings())); }