### Question:
HostAddressFactory { public List<HostAddress> toHostAddressList(Collection<Host> hosts) { ArrayList<HostAddress> list = new ArrayList<>(hosts.size()); for (Host host : hosts) { list.add(toHostAddress(host)); } return list; }  HostAddress toHostAddress(Host host); List<HostAddress> toHostAddressList(Collection<Host> hosts); HostAddress toHostAddress(String hostAddressName); List<HostAddress> hostAddressNamesToHostAddressList(Collection<String> hosts);  }### Answer:
@Test public void testToHostAddressList() throws Exception { Set<Host> hosts = ImmutableSet.of( new TestHost( new InetSocketAddress( InetAddress.getByAddress(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }), 3000)), new TestHost(new InetSocketAddress(InetAddress.getByAddress(new byte[] {1, 2, 3, 4}), 3000))); HostAddressFactory hostAddressFactory = new HostAddressFactory(); List<HostAddress> list = hostAddressFactory.toHostAddressList(hosts); assertEquals(list.toString(), "[[102:304:506:708:90a:b0c:d0e:f10], 1.2.3.4]"); }