ThesaurusManager implements ThesaurusFinder { @Override public Map<String, Thesaurus> getThesauriMap() { if (this.settingManager.getValueAsBool(Settings.SYSTEM_ENABLE_ALL_THESAURUS)) { final HashMap<String, Thesaurus> all = Maps.newHashMap(this.thesauriMap); all.put(this.allThesaurus.getKey(), this.allThesaurus); return all; } else { return Collections.unmodifiableMap(thesauriMap); } }  synchronized void init(boolean isTest, ServiceContext context, String thesauriRepository); Path buildThesaurusFilePath(String fname, String type, String dname); void addThesaurus(Thesaurus gst, boolean writeTitle); void remove(String name); Path getThesauriDirectory(); @Override Map<String, Thesaurus> getThesauriMap(); @Override @Nullable Thesaurus getThesaurusByName(@Nonnull String thesaurusName); @Override Thesaurus getThesaurusByConceptScheme(String uri); @Override boolean existsThesaurus(String name); String createUpdateThesaurusFromRegister(String uuid, String type, ServiceContext context); Element buildResultfromThTable(ServiceContext context);  }
@Test public void testGetThesauriMap() throws Exception { this.settingManager.setValue(Settings.SYSTEM_ENABLE_ALL_THESAURUS, false); int count = this.thesaurusManager.getThesauriMap().size(); assertFalse(this.thesaurusManager.getThesauriMap().containsKey(AllThesaurus.ALL_THESAURUS_KEY)); this.settingManager.setValue(Settings.SYSTEM_ENABLE_ALL_THESAURUS, true); assertTrue(this.thesaurusManager.getThesauriMap().containsKey(AllThesaurus.ALL_THESAURUS_KEY)); assertEquals(count + 1, this.thesaurusManager.getThesauriMap().size()); this.settingManager.setValue(Settings.SYSTEM_ENABLE_ALL_THESAURUS, false); assertFalse(this.thesaurusManager.getThesauriMap().containsKey(AllThesaurus.ALL_THESAURUS_KEY)); assertEquals(count, this.thesaurusManager.getThesauriMap().size()); }