### Question:
SearchEngineManager extends AbstractService implements ICmsSearchEngineManager, PublicContentChangedObserver, EntityTypesChangingObserver { @Override public List<String> searchEntityId(String langCode, String word, Collection<String> allowedGroups) throws ApsSystemException { SearchEngineFilter[] filters = new SearchEngineFilter[0]; if (StringUtils.isNotEmpty(langCode) && StringUtils.isNotEmpty(word)) { SearchEngineFilter filter = new SearchEngineFilter(langCode, word); filter.setFullTextSearch(true); filters = ArrayUtils.add(filters, filter); } return this.searchEntityId(filters, null, allowedGroups); }  @Override void init(); @Override void refresh(); @Override void updateFromPublicContentChanged(PublicContentChangedEvent event); @Override Thread startReloadContentsReferences(); @Override Thread startReloadContentsReferences(String subDirectory); @Override void updateFromEntityTypesChanging(EntityTypesChangingEvent event); @Override void addEntityToIndex(IApsEntity entity); @Override void deleteIndexedEntity(String entityId); @Override LastReloadInfo getLastReloadInfo(); @Override List<String> searchId(String sectionCode, String langCode,
            String word, Collection<String> allowedGroups); @Override List<String> searchEntityId(String langCode, String word,
            Collection<String> allowedGroups); List<String> searchEntityId(SearchEngineFilter[] filters, Collection<ITreeNode> categories, Collection<String> allowedGroups); @Override FacetedContentsResult searchFacetedEntities(SearchEngineFilter[] filters, Collection<ITreeNode> categories, Collection<String> allowedGroups); @Override FacetedContentsResult searchFacetedEntities(SearchEngineFilter[] filters, SearchEngineFilter[] categories, Collection<String> allowedGroups); @Override List<String> loadContentsId(SearchEngineFilter[] filters, SearchEngineFilter[] facetNodeCodes, List<String> allowedGroups); @Override int getStatus(); @Override void updateIndexedEntity(IApsEntity entity); void setFactory(ISearchEngineDAOFactory factory); void setContentManager(IContentManager contentManager); static final String RELOAD_THREAD_NAME_PREFIX; }### Answer:
@Test public void testSearchIds() throws Exception { when(this.searcherDao.searchContentsId(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(new ArrayList<>(Arrays.asList("Art123", "Art456"))); when(this.factory.checkCurrentSubfolder()).thenReturn(Boolean.TRUE); List<String> resources = this.searchEngineManager.searchEntityId("it", "test", Arrays.asList("group1", "group2")); Assert.assertEquals(2, resources.size()); }
@Test(expected = ApsSystemException.class) public void testSearchIds_withErrors() throws Exception { Mockito.doThrow(ApsSystemException.class).when(this.searcherDao).searchContentsId(Mockito.any(), Mockito.any(), Mockito.any()); when(this.factory.checkCurrentSubfolder()).thenReturn(Boolean.TRUE); this.searchEngineManager.searchEntityId("it", "test", Arrays.asList("group1", "group2")); }