### Question:
XmlDataCollectionConfigDaoJaxb extends AbstractJaxbConfigDao<XmlDataCollectionConfig, XmlDataCollectionConfig> implements XmlDataCollectionConfigDao { public XmlDataCollectionConfig getConfig() { return getContainer().getObject(); } XmlDataCollectionConfigDaoJaxb(); XmlDataCollection getDataCollectionByName(String name); XmlDataCollection getDataCollectionByIndex(int idx); XmlDataCollectionConfig getConfig();  }### Answer:
@Test public void testAfterPropertiesSetWithGoodConfigFile() throws Exception { XmlDataCollectionConfigDaoJaxb dao = new XmlDataCollectionConfigDaoJaxb(); File xmlCollectionConfig= new File("src/test/resources/", XmlDataCollectionConfig.XML_DATACOLLECTION_CONFIG_FILE); assertTrue(XmlDataCollectionConfig.XML_DATACOLLECTION_CONFIG_FILE + " is readable", xmlCollectionConfig.canRead()); InputStream in = new FileInputStream(xmlCollectionConfig); dao.setConfigResource(new InputStreamResource(in)); dao.afterPropertiesSet(); Assert.assertNotNull("xml data collection should not be null", dao.getConfig()); }
@Test public void testAfterPropertiesSetWithNestedFiles() throws Exception { System.setProperty("opennms.home", "src/test/resources"); XmlDataCollectionConfigDaoJaxb dao = new XmlDataCollectionConfigDaoJaxb(); File xmlCollectionConfig= new File("src/test/resources/etc", XmlDataCollectionConfig.XML_DATACOLLECTION_CONFIG_FILE); assertTrue(XmlDataCollectionConfig.XML_DATACOLLECTION_CONFIG_FILE + " is readable", xmlCollectionConfig.canRead()); InputStream in = new FileInputStream(xmlCollectionConfig); dao.setConfigResource(new InputStreamResource(in)); dao.afterPropertiesSet(); XmlDataCollectionConfig config = dao.getConfig(); Assert.assertNotNull("xml data collection should not be null", config); Assert.assertEquals(2, config.getXmlDataCollections().get(0).getXmlSources().get(0).getXmlGroups().size()); Assert.assertEquals(5, config.getXmlDataCollections().get(1).getXmlSources().get(0).getXmlGroups().size()); }