### Question:
NamedEntityAnalyser { public NerResultSet process(final String text) { final NerResultSet rs = extractor.process(text); classifier.process(rs); if (tracing) trace = classifier.trace; return rs; } NamedEntityAnalyser(final Configuration config); NerResultSet process(final String text); static void main(final String[] args); public Collection<String> trace; }### Answer:
@Test(dataProvider = "testProcess") public void testProcess(final String phrase, final List<Result> resultList) { final NerResultSet result = namedEntityAnalyser.process(phrase); final Map<EntityClass, Set<String>> mappedResult = result.getMappedResult(); for (final Result r : resultList) { assertTrue(mappedResult.containsKey(r.type), "Could not find the phrase '" + r.phrase + "', type " + r.type + ", in results map containing: " + mappedResult + ": "); final Set<String> phrases = mappedResult.get(r.type); assertNotNull(phrases.remove(r.phrase), "Phrase '" + r.phrase + "' was not found in the set of values: " + phrases + ", "); if (phrases.isEmpty()) mappedResult.remove(r.type); } assertTrue(mappedResult.isEmpty(), "Result map is not empty: " + mappedResult); final List<Phrase> flat = new ArrayList<>(); for (final List<Phrase> l : result.phrases) { for (final Phrase p : l) { flat.add(p); } } for (int i = 0; i < flat.size(); i++) { final Phrase p = flat.get(i); final Result r = resultList.get(i); assertEquals(p.score, r.scores, "Phrase '" + p.phraseString() + "', expected '" + r.scores + "' but found '" + p.score + "'"); assertEquals(p.attachedWordMap, r.attachedWordMap); } }