### Question:
MultipleAddresses { public Set<InetSocketAddress> getWildcardAddresses() { return addresses.stream().map(a -> new InetSocketAddress(a.getPort())).collect(Collectors.toSet()); } 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 testGetWildcardAddresses() { List<Integer> ports = getPortList(); List<InetSocketAddress> addresses = getAddressList(ports); MultipleAddresses multipleAddresses = new MultipleAddresses(addresses); List<InetSocketAddress> allAddresses = ports.stream().map(InetSocketAddress::new).collect(Collectors.toList()); assertTrue(CollectionUtils.isEqualCollection(allAddresses, multipleAddresses.getWildcardAddresses())); multipleAddresses.addAddress(new InetSocketAddress("localhost", ports.get(ports.size() - 1))); assertTrue(CollectionUtils.isEqualCollection(allAddresses, multipleAddresses.getWildcardAddresses())); }