|
38 | 38 | import static com.google.firebase.firestore.testutil.TestUtil.viewChanges;
|
39 | 39 | import static java.util.Arrays.asList;
|
40 | 40 | import static java.util.Collections.emptyList;
|
41 |
| -import static java.util.Collections.singletonList; |
42 | 41 | import static org.junit.Assert.assertEquals;
|
43 | 42 | import static org.junit.Assert.assertFalse;
|
44 | 43 | import static org.junit.Assert.assertNotNull;
|
|
74 | 73 | import com.google.firebase.firestore.testutil.TestUtil;
|
75 | 74 | import com.google.firebase.firestore.util.AsyncQueue;
|
76 | 75 | import java.util.ArrayList;
|
77 |
| -import java.util.Arrays; |
78 | 76 | import java.util.Collections;
|
79 | 77 | import java.util.List;
|
80 | 78 | import java.util.Map.Entry;
|
81 | 79 | import java.util.Set;
|
82 |
| -import java.util.stream.Collectors; |
83 | 80 | import javax.annotation.Nullable;
|
84 | 81 | import org.junit.After;
|
85 | 82 | import org.junit.Assert;
|
@@ -158,11 +155,14 @@ private void acknowledgeMutationWithTransform(long documentVersion, Object... tr
|
158 | 155 | MutationBatch batch = batches.remove(0);
|
159 | 156 | SnapshotVersion version = version(documentVersion);
|
160 | 157 | List<MutationResult> mutationResults =
|
161 |
| - transformResult == null |
162 |
| - ? singletonList(new MutationResult(version, emptyList())) |
163 |
| - : Arrays.stream(transformResult) |
164 |
| - .map(o -> new MutationResult(version, Collections.singletonList(TestUtil.wrap(o)))) |
165 |
| - .collect(Collectors.toList()); |
| 158 | + Collections.singletonList(new MutationResult(version, emptyList())); |
| 159 | + if (transformResult != null) { |
| 160 | + mutationResults = new ArrayList<>(); |
| 161 | + for (Object o : transformResult) { |
| 162 | + mutationResults.add( |
| 163 | + new MutationResult(version, Collections.singletonList(TestUtil.wrap(o)))); |
| 164 | + } |
| 165 | + } |
166 | 166 | MutationBatchResult result =
|
167 | 167 | MutationBatchResult.create(batch, version, mutationResults, WriteStream.EMPTY_STREAM_TOKEN);
|
168 | 168 | lastChanges = localStore.acknowledgeBatch(result);
|
@@ -964,8 +964,12 @@ public void testReadsAllDocumentsForInitialCollectionQueries() {
|
964 | 964 | localStore.executeQuery(query, /* usePreviousResults= */ true);
|
965 | 965 |
|
966 | 966 | assertRemoteDocumentsRead(/* byKey= */ 0, /* byQuery= */ 2);
|
967 |
| - // No mutations are read because only overlay is needed. |
968 |
| - assertMutationsRead(/* byKey= */ 0, /* byQuery= */ 0); |
| 967 | + if (Persistence.OVERLAY_SUPPORT_ENABLED) { |
| 968 | + // No mutations are read because only overlay is needed. |
| 969 | + assertMutationsRead(/* byKey= */ 0, /* byQuery= */ 0); |
| 970 | + } else { |
| 971 | + assertMutationsRead(/* byKey= */ 0, /* byQuery= */ 1); |
| 972 | + } |
969 | 973 | }
|
970 | 974 |
|
971 | 975 | @Test
|
|
0 commit comments