String query = "in:inbox";
SearchResult.Digest digest =
new Digest("", "", WAVE_ID.serialise(), ImmutableList.of(PARTICIPANT.getAddress()), -1L,
-1L, 1, 1);
SearchResult searchResult = new SearchResult(query);
searchResult.addDigest(digest);
when(searchProvider.search(USER, query, 0, 10)).thenReturn(searchResult);
service.execute(operation, context, USER);
verify(context).constructResponse(
eq(operation), argThat(new BaseMatcher<Map<ParamsProperty, Object>>() {
@SuppressWarnings("unchecked")
@Override
public boolean matches(Object item) {
Map<ParamsProperty, Object> map = (Map<ParamsProperty, Object>) item;
assertTrue(map.containsKey(ParamsProperty.SEARCH_RESULTS));
Object resultsObj = map.get(ParamsProperty.SEARCH_RESULTS);
SearchResult results = (SearchResult) resultsObj;
assertEquals(providerResults.size(), results.getNumResults());
assertEquals(providerResults.size(), results.getDigests().size());
return true;
}
@Override