submitDeltaToNewWavelet(name, USER1, op1, op2);
} else {
submitDeltaToNewWavelet(name, USER2, addParticipantToWavelet(USER2, name));
}
}
SearchResult resultsAsc =
searchProvider.search(USER2, "in:inbox orderby:creatorasc orderby:createddesc", 0, 10);
assertEquals(10, resultsAsc.getNumResults());
Ordering<SearchResult.Digest> ascAuthorOrdering = Ordering.from(ASC_CREATOR_COMPARATOR);
assertTrue(ascAuthorOrdering.isOrdered(resultsAsc.getDigests()));
Ordering<SearchResult.Digest> descCreatedOrdering = Ordering.from(DESC_CREATED_COMPARATOR);
// The whole list should not be ordered by creation time.
assertFalse(descCreatedOrdering.isOrdered(resultsAsc.getDigests()));
// Each sublist should be ordered by creation time.
assertTrue(descCreatedOrdering.isOrdered(Lists.newArrayList(resultsAsc.getDigests()).subList(0,
2)));
assertTrue(descCreatedOrdering.isOrdered(Lists.newArrayList(resultsAsc.getDigests()).subList(2,
10)));
}