SolrDocumentServiceImpl implements SolrDocumentService { @Override public List<SolrDocument> getDocuments(QueryFacetsSelection selection, int first, int count) { final SolrQuery query = queryFactory.createDocumentQuery(selection, first, count); return searchResultsDao.getDocuments(query); } SolrDocumentServiceImpl(SearchResultsDao searchResultsDao, SolrDocumentQueryFactory queryFactory); @Override SolrDocument getDocument(String docId); @Override SolrDocumentExpansionPair getDocumentWithExpansion(String docId, String collapseField, QueryFacetsSelection selection, int expansionFirst, int expansionCount); @Override List<SolrDocument> getDocuments(QueryFacetsSelection selection, int first, int count); @Override SolrDocumentExpansionList getDocumentsWithExpansion(QueryFacetsSelection selection, int first, int count, String collapseField); @Override long getResultCount(QueryFacetsSelection selection); @Override long getTotalDocumentCount(QueryFacetsSelection selection);  }
@Test public void testGetDocuments() { final QueryFacetsSelection selection = new QueryFacetsSelection("query", Collections.<String, FacetSelection>emptyMap()); final int first = 100; final int count = 15; final SolrQuery solrQuery = new SolrQuery("query"); final SolrDocumentList resultList = new SolrDocumentList(); resultList.add(new SolrDocument()); resultList.add(new SolrDocument()); context.checking(new Expectations() { { oneOf(queryFactory).createDocumentQuery(selection, first, count); will(returnValue(solrQuery)); oneOf(dao).getDocuments(solrQuery); will(returnValue(resultList)); } }); final List<SolrDocument> result = instance.getDocuments(selection, first, count); assertEquals(resultList, result); }