### Question:
FindBugsParser implements AnnotationParser { List<XmlBugInstance> preParse(final InputStream file) throws SAXException, IOException { SecureDigester digester = new SecureDigester(FindBugsParser.class); String rootXPath = "BugCollection/BugInstance"; digester.addObjectCreate(rootXPath, XmlBugInstance.class); digester.addSetProperties(rootXPath); String fileXPath = rootXPath + "/LongMessage"; digester.addCallMethod(fileXPath, "setMessage", 0); digester.addSetNext(rootXPath, "add", Object.class.getName()); ArrayList<XmlBugInstance> bugs = new ArrayList<XmlBugInstance>(); digester.push(bugs); digester.parse(file); return bugs; } FindBugsParser(final boolean isRankActivated);  FindBugsParser(final boolean isRankActivated, final String excludePattern, final String includePattern);  FindBugsParser(final Collection<String> sourceFolders, final boolean isRankActivated,
            final String excludePattern, final String includePattern); @Override Collection<FileAnnotation> parse(final File file, final String moduleName); Collection<FileAnnotation> parse(final File file, final Collection<String> sources, final String moduleName);  }### Answer:
@Test public void testMessageMapping() throws SAXException, IOException { InputStream stream = FindBugsParserTest.class.getResourceAsStream(FINDBUGS_NATIVE_XML); try { Map<String, String> mapping = new HashMap<String, String>(); for (XmlBugInstance bug : new FindBugsParser(false).preParse(stream)) { mapping.put(bug.getInstanceHash(), bug.getMessage()); } assertEquals(WRONG_NUMBER_OF_WARNINGS_PARSED, 2, mapping.size()); assertTrue(BUG_WITH_GIVEN_HASHCODE_NOT_FOUND, mapping.containsKey(FIRST_WARNING)); assertTrue(BUG_WITH_GIVEN_HASHCODE_NOT_FOUND, mapping.containsKey(SECOND_WARNING)); assertEquals( WRONG_MESSAGE_PARSED, "Inconsistent synchronization of org.apache.hadoop.dfs.BlockCrcUpgradeObjectDatanode.blocksPreviouslyUpgraded; locked 85% of time", mapping.get(FIRST_WARNING)); assertEquals( WRONG_MESSAGE_PARSED, "Should org.apache.hadoop.streaming.StreamJob$MultiPropertyOption be a _static_ inner class?", mapping.get(SECOND_WARNING)); } finally { IOUtils.closeQuietly(stream); } }