### Question:
XmlConfig extends Config { @Override public Collection<String> getCollection(String key) { Object obj = mConfiguration.getProperty(key); if (obj instanceof Collection) { return (Collection<String>) obj; } else if (obj instanceof String) { Collection<String> coll = new ArrayList<String>(1); coll.add((String) obj); return coll; } return null; } XmlConfig();  XmlConfig(XmlConfig parent, HierarchicalConfiguration config);  XmlConfig(File file); @Override String getProperty(String key); @Override boolean getBoolean(String key, boolean defaultValue); @Override int getInt(String key, int defaultValue); @Override void setProperty(String key, String value); @Override boolean hasProperty(String key); @Override Config getSubconfig(String key); @Override U getComponent(Class<U> baseInterface); @Override U getComponent(String key, Class<U> baseInterface); @Override InputStream getNestedInputStream(String key); @Override OutputStream getNestedOutputStream(String key); @Override Collection<String> getCollection(String key); @Override void saveTo(OutputStream output);  }### Answer:
@Test public void testCollectionsSingleItem() throws BadConfigException, IOException { Collection<String> list = mConfig.getCollection("list1.string"); assertNotNull(list); assertEquals(1, list.size()); assertEquals("single item", list.iterator().next()); }
@Test public void testCollections() throws BadConfigException, IOException { Collection<String> list = mConfig.getCollection("list.string"); assertNotNull(list); assertEquals(4, list.size()); int cur = 1; for (String s : list) { assertEquals("data" + cur, s); cur++; } }