KeywordsSearcher { public void searchForRelated(Element params, KeywordRelation request, @Nullable Comparator<KeywordBean> comparator, String... languages) { String id = Util.getParam(params, "id"); String sThesaurusName = Util.getParam(params, "thesaurus"); searchForRelated(id, sThesaurusName, request, comparator, languages); } KeywordsSearcher(IsoLanguagesMapper mapper, ThesaurusFinder thesaurusFinder);  KeywordsSearcher(ServiceContext context, ThesaurusFinder thesaurusFinder); static Element toRawElement(Element rootEl, KeywordBean kb); KeywordBean searchById(String id, String sThesaurusName, String... languages); void searchTopConcepts(String sThesaurusName, String... languages); void search(KeywordSearchParams params); void search(String contextLanguage, Element params); void search(String contextLanguage, Element params, Comparator<KeywordBean> comparator); void searchForRelated(Element params, KeywordRelation request, @Nullable Comparator<KeywordBean> comparator,
                                 String... languages); void searchForRelated(String id, String sThesaurusName, KeywordRelation request, @Nullable Comparator<KeywordBean> comparator,
                                 String... languages); int getNbResults(); List<KeywordBean> getResults(); Element getXmlResults(); void selectUnselectKeywords(Element params); void selectUnselectKeywords(Set<String> idSet); void clearSelection(); Element getSelectedKeywordsAsXml(); List<KeywordBean> getSelectedKeywordsInList(); KeywordBean getKeywordFromResultsById(int id); KeywordBean getKeywordFromResultsById(String id); KeywordBean getKeywordFromResultsByUriCode(String code);  }
@Test public void testsearchForRelated() throws Exception { KeywordsSearcher searcher = new KeywordsSearcher(isoLangMapper, thesaurusFinder); searcher.searchForRelated(THESAURUS_KEYWORD_NS + 20, thesaurus.getKey(), KeywordRelation.BROADER, null, "eng", "fre"); assertEquals(1, searcher.getNbResults()); assertEquals("" + 15, searcher.getResults().get(0).getRelativeCode()); assertTrue(searcher.getResults().get(0).getValues().keySet().contains("eng")); assertTrue(searcher.getResults().get(0).getValues().keySet().contains("fre")); assertEquals(2, searcher.getResults().get(0).getValues().size()); searcher.searchForRelated(THESAURUS_KEYWORD_NS + 15, thesaurus.getKey(), KeywordRelation.NARROWER, null, "eng", "ger"); assertEquals(1, searcher.getNbResults()); assertEquals("" + 20, searcher.getResults().get(0).getRelativeCode()); assertTrue(searcher.getResults().get(0).getValues().keySet().contains("eng")); assertTrue(searcher.getResults().get(0).getValues().keySet().contains("ger")); assertEquals(2, searcher.getResults().get(0).getValues().size()); searcher.searchForRelated(THESAURUS_KEYWORD_NS + 25, thesaurus.getKey(), KeywordRelation.RELATED, null, "eng"); assertEquals(1, searcher.getNbResults()); assertEquals("" + 22, searcher.getResults().get(0).getRelativeCode()); assertTrue(searcher.getResults().get(0).getValues().keySet().contains("eng")); assertEquals(1, searcher.getResults().get(0).getValues().size()); }