@Test public void testFiltersDocumentsBasedOnQueryWithFilters() { Query query = messageQuery().filter(filter("sort", "<=", 2)); View view = new View(query, DocumentKey.emptyKeySet()); Document doc1 = doc("rooms/eros/messages/1", 0, map("sort", 1)); Document doc2 = doc("rooms/eros/messages/2", 0, map("sort", 2)); Document doc3 = doc("rooms/eros/messages/3", 0, map("sort", 3)); Document doc4 = doc("rooms/eros/messages/4", 0, map()); Document doc5 = doc("rooms/eros/messages/5", 0, map("sort", 1)); ViewSnapshot snapshot = applyChanges(view, doc1, doc2, doc3, doc4, doc5).getSnapshot(); assertEquals(query, snapshot.getQuery()); assertEquals(asList(doc1, doc5, doc2), snapshot.getDocuments().toList()); assertEquals( asList( DocumentViewChange.create(Type.ADDED, doc1), DocumentViewChange.create(Type.ADDED, doc5), DocumentViewChange.create(Type.ADDED, doc2)), snapshot.getChanges()); assertTrue(snapshot.isFromCache()); assertTrue(snapshot.didSyncStateChange()); }
public ViewChange applyChanges(DocumentChanges docChanges) { return applyChanges(docChanges, null); }
View { public ViewChange applyChanges(DocumentChanges docChanges) { return applyChanges(docChanges, null); } }
View { public ViewChange applyChanges(DocumentChanges docChanges) { return applyChanges(docChanges, null); } View(Query query, ImmutableSortedSet<DocumentKey> remoteDocuments); }
View { public ViewChange applyChanges(DocumentChanges docChanges) { return applyChanges(docChanges, null); } View(Query query, ImmutableSortedSet<DocumentKey> remoteDocuments); SyncState getSyncState(); DocumentChanges computeDocChanges(
      ImmutableSortedMap<DocumentKey, D> docChanges); DocumentChanges computeDocChanges(
      ImmutableSortedMap<DocumentKey, D> docChanges, @Nullable DocumentChanges previousChanges); ViewChange applyChanges(DocumentChanges docChanges); ViewChange applyChanges(DocumentChanges docChanges, TargetChange targetChange); ViewChange applyOnlineStateChange(OnlineState onlineState); }
View { public ViewChange applyChanges(DocumentChanges docChanges) { return applyChanges(docChanges, null); } View(Query query, ImmutableSortedSet<DocumentKey> remoteDocuments); SyncState getSyncState(); DocumentChanges computeDocChanges(
      ImmutableSortedMap<DocumentKey, D> docChanges); DocumentChanges computeDocChanges(
      ImmutableSortedMap<DocumentKey, D> docChanges, @Nullable DocumentChanges previousChanges); ViewChange applyChanges(DocumentChanges docChanges); ViewChange applyChanges(DocumentChanges docChanges, TargetChange targetChange); ViewChange applyOnlineStateChange(OnlineState onlineState);  }