### Question:
SearchProfilesHelper implements DatastoreHasSearch<ProfileItem> { @Override public ItemSearchResult<ProfileItem> search(int page, int resultsByPage, String search, String orders, Map<String, String> filters) { if (isFilteredBy(filters, ProfileItem.FILTER_USER_ID)) { return searchProfilesForUser(page, filters); } return searchProfiles(page, resultsByPage, search, orders, filters); } SearchProfilesHelper(ProfileEngineClient profileClient); @Override ItemSearchResult<ProfileItem> search(int page, int resultsByPage, String search, String orders, Map<String, String> filters);  }### Answer:
@Test public void testWeCanListUserProfiles() throws Exception { final SearchResultImpl<Profile> aKnownSearchResult = aKnownSearchResult(); final List<ProfileItem> expectedProfiles = new ProfileItemConverter().convert(aKnownSearchResult.getResult()); when(profileAPI.getProfilesForUser(2L, 0, Integer.MAX_VALUE, ProfileCriterion.ID_ASC)).thenReturn(aKnownSearchResult.getResult()); final ItemSearchResult<ProfileItem> searchResult = searchProfilesHelper.search(0, 10, null, null, filterOnUserId(2L, false)); verify(profileAPI).getProfilesForUser(2L, 0, Integer.MAX_VALUE, ProfileCriterion.ID_ASC); assertThat(SearchUtils.areEquals(expectedProfiles, searchResult.getResults())).isTrue(); }
@Test public void testWeCanListUserProfilesWithNavigation() throws Exception { final SearchResultImpl<Profile> aKnownSearchResult = aKnownSearchResult(); final List<ProfileItem> expectedProfiles = new ProfileItemConverter().convert(aKnownSearchResult.getResult()); when(profileAPI.getProfilesWithNavigationForUser(2L, 0, Integer.MAX_VALUE, ProfileCriterion.ID_ASC)).thenReturn(aKnownSearchResult.getResult()); final ItemSearchResult<ProfileItem> searchResult = searchProfilesHelper.search(0, 10, null, null, filterOnUserId(2L, true)); verify(profileAPI).getProfilesWithNavigationForUser(2L, 0, Integer.MAX_VALUE, ProfileCriterion.ID_ASC); assertThat(SearchUtils.areEquals(expectedProfiles, searchResult.getResults())).isTrue(); }