Skip to content

Commit b7d6597

Browse files
committed
Feedback
1 parent f9d4208 commit b7d6597

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

firebase-firestore/src/test/java/com/google/firebase/firestore/local/LocalStoreTestCase.java

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import static com.google.firebase.firestore.testutil.TestUtil.viewChanges;
3939
import static java.util.Arrays.asList;
4040
import static java.util.Collections.emptyList;
41-
import static java.util.Collections.singletonList;
4241
import static org.junit.Assert.assertEquals;
4342
import static org.junit.Assert.assertFalse;
4443
import static org.junit.Assert.assertNotNull;
@@ -74,12 +73,10 @@
7473
import com.google.firebase.firestore.testutil.TestUtil;
7574
import com.google.firebase.firestore.util.AsyncQueue;
7675
import java.util.ArrayList;
77-
import java.util.Arrays;
7876
import java.util.Collections;
7977
import java.util.List;
8078
import java.util.Map.Entry;
8179
import java.util.Set;
82-
import java.util.stream.Collectors;
8380
import javax.annotation.Nullable;
8481
import org.junit.After;
8582
import org.junit.Assert;
@@ -158,11 +155,14 @@ private void acknowledgeMutationWithTransform(long documentVersion, Object... tr
158155
MutationBatch batch = batches.remove(0);
159156
SnapshotVersion version = version(documentVersion);
160157
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+
}
166166
MutationBatchResult result =
167167
MutationBatchResult.create(batch, version, mutationResults, WriteStream.EMPTY_STREAM_TOKEN);
168168
lastChanges = localStore.acknowledgeBatch(result);
@@ -964,8 +964,12 @@ public void testReadsAllDocumentsForInitialCollectionQueries() {
964964
localStore.executeQuery(query, /* usePreviousResults= */ true);
965965

966966
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+
}
969973
}
970974

971975
@Test

0 commit comments

Comments
 (0)