@Test
public void testGetRelated() throws Exception {

    final String regionsPath = "/org/fao/geonet/services/region/external/thesauri/place/regions.rdf";
    Path regionsFile = Paths.get(AllThesaurusTest.class.getResource(regionsPath).toURI());
    final Thesaurus regionsThesaurus = new Thesaurus(isoLangMapper, regionsFile.getFileName().toString(), null, null, "external",
        "place", regionsFile, "http://org.fao.geonet", false);
    regionsThesaurus.initRepository();
    final HashMap<String, Thesaurus> thesauri = Maps.newHashMap();
    thesauri.put(regionsThesaurus.getKey(), regionsThesaurus);
    this.thesaurusFinder = Mockito.mock(ThesaurusFinder.class);
    Mockito.when(thesaurusFinder.getThesauriMap()).thenReturn(thesauri);
    Mockito.when(thesaurusFinder.getThesaurusByName(regionsThesaurus.getKey())).thenReturn(regionsThesaurus);
    Mockito.when(thesaurusFinder.existsThesaurus(regionsThesaurus.getKey())).thenReturn(true);
    this.allThesaurus = new AllThesaurus(thesaurusFinder, isoLangMapper, "http://blah.com");
    thesauri.put(AllThesaurus.ALL_THESAURUS_KEY, this.allThesaurus);
    final KeywordBean country = regionsThesaurus.getKeyword("http://geonetwork-opensource.org/regions#country", "eng");
    String countryAllURI = AllThesaurus.buildKeywordUri(country);
    assertRelated(countryAllURI, KeywordRelation.BROADER, 278);
    assertRelated(countryAllURI, KeywordRelation.NARROWER, 0);
    assertRelated(countryAllURI, KeywordRelation.RELATED, 0);
    final KeywordBean brazil = regionsThesaurus.getKeyword("http://geonetwork-opensource.org/regions#21", "eng");
    String brazilAllURI = AllThesaurus.buildKeywordUri(brazil);
    assertRelated(brazilAllURI, KeywordRelation.BROADER, 0);
    assertRelated(brazilAllURI, KeywordRelation.NARROWER, 1);
    assertRelated(brazilAllURI, KeywordRelation.RELATED, 0);
}