### Question:
FileFilterXmlParser { public FileFilterConfig parse() throws DocumentException { FileFilterConfig fileFilter = new FileFilterConfig(); SAXReader reader = new SAXReader(); Document doc = reader.read(configPath.toFile()); Element root = doc.getRootElement(); for (Iterator i = root.elementIterator("filter"); i.hasNext(); ) { Element element = (Element) i.next(); String isActiveValue = element.attributeValue("isactive"); if (isActiveValue != null && isActiveValue.equals("true")) { fileFilter.setActive(true); } for (Iterator rules = element.elementIterator("rule"); rules.hasNext(); ) { Element ruleElement = (Element) rules.next(); String rule = ruleElement.attributeValue("value"); if (rule != null) { fileFilter.addRule(rule); } } } return fileFilter; } FileFilterXmlParser(Path configPath); FileFilterConfig parse();  }### Answer:
@Test public void test() throws DocumentException { FileFilterXmlParser parser = new FileFilterXmlParser(loadResourceFile("demo/config-filter.xml").toPath()); FileFilterConfig fileFilter = parser.parse(); assert fileFilter != null; assert fileFilter.isActive(); assert fileFilter.getRules().size() == 2; }