HistorySearchHandler implements OmniSearchHandler { @Override public SearchResult getResults(ResourceResolver resolver, Map<String, Object> predicateParameters, long limit, long offset) { Map<String, Object> predicates = new HashMap<>(predicateParameters); predicates.put("path", HistoryUtil.HISTORY_BASE); PredicateGroup predicateGroup = PredicateGroup.create(predicates); com.day.cq.search.Query query = queryBuilder.createQuery(predicateGroup, resolver.adaptTo(Session.class)); if (limit != 0) { query.setHitsPerPage(limit); } if (offset != 0) { query.setStart(offset); } return query.getResult(); }  @Override String getID(); @Override Resource getModuleConfig(ResourceResolver resourceResolver); @Override List<PredicateSuggestion> getPredicateSuggestions(ResourceResolver arg0, I18n arg1, String arg2); @Override SearchResult getResults(ResourceResolver resolver, Map<String, Object> predicateParameters, long limit, long offset); @Override Query getSpellCheckQuery(ResourceResolver resourceResolver, String searchTerm); @Override Query getSuggestionQuery(ResourceResolver resourceResolver, String searchTerm);  }
@Test public void getResults() { Map<String, Object> predicates = new HashMap<>(); handler.getResults(resolver, predicates, 50, 10); verify(queryBuilder, times(1)).createQuery(Mockito.any(), Mockito.eq(session)); verify(query, times(1)).setHitsPerPage(50L); verify(query, times(1)).setStart(10L); }