### Question:
FunctionSearchService implements LiveSearchService<String> { @Override public void searchEntry(final String key, final LiveSearchCallback<String> callback) { LiveSearchResults<String> results = new LiveSearchResults<>(); if (options.containsKey(key)) { results.add(key, options.get(key)); } callback.afterSearch(results); } @Inject  FunctionSearchService(final ConditionEditorAvailableFunctionsService availableFunctionsService,
                                 final FunctionNamingService functionNamingService); void init(final ClientSession session); void reload(final String type,
                       final Command onSuccess); void clear(); @Override void search(final String pattern,
                       final int maxResults,
                       final LiveSearchCallback<String> callback); @Override void searchEntry(final String key,
                            final LiveSearchCallback<String> callback); FunctionDef getFunction(final String function);  }### Answer:
@Test @SuppressWarnings("unchecked") public void testSearchEntryWithResults() { loadTestFunctions(); searchService.searchEntry(FUNCTION1, searchCallback); verify(searchCallback).afterSearch(searchResultsCaptor.capture()); LiveSearchResults<String> results = searchResultsCaptor.getValue(); verifyContains(results, new Pair<>(FUNCTION1, FUNCTION1_NAME)); searchService.searchEntry(FUNCTION2, searchCallback); verify(searchCallback, times(2)).afterSearch(searchResultsCaptor.capture()); results = searchResultsCaptor.getValue(); verifyContains(results, new Pair<>(FUNCTION2, FUNCTION2_NAME)); }
@Test public void testSearchEntryWithoutResults() { loadTestFunctions(); searchService.searchEntry("SOME_OTHER_FUNCTION", searchCallback); verify(searchCallback).afterSearch(searchResultsCaptor.capture()); assertEquals(0, searchResultsCaptor.getValue().size()); }