MachineList { @VisibleForTesting public Collection<String> getCollection() { Collection<String> list = new ArrayList<String>(); if (all) { list.add("*"); } else { if (ipAddresses != null) { list.addAll(ipAddresses); } if (hostNames != null) { list.addAll(hostNames); } if (cidrAddresses != null) { for(SubnetUtils.SubnetInfo cidrAddress : cidrAddresses) { list.add(cidrAddress.getCidrSignature()); } } } return list; } MachineList(String hostEntries);  MachineList(Collection<String> hostEntries);  MachineList(Collection<String> hostEntries, InetAddressFactory addressFactory); boolean includes(String ipAddress); @VisibleForTesting Collection<String> getCollection(); static final Logger LOG; static final String WILDCARD_VALUE; }
@Test public void testGetCollection() { MachineList ml = new MachineList(HOSTNAME_IP_CIDR_LIST); Collection<String> col = ml.getCollection(); assertEquals(7,ml.getCollection().size()); for (String item:StringUtils.getTrimmedStringCollection(HOSTNAME_IP_CIDR_LIST)) { assertTrue(col.contains(item)); } }