Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,9 @@ public synchronized void onNext(ListenResponse listenResponse) {
}
break;
case ADD:
Preconditions.checkState(
WATCH_TARGET_ID == change.getTargetIds(0), "Target ID must be 0xD0");
if (WATCH_TARGET_ID != change.getTargetIds(0)) {
closeStream(FirestoreException.invalidState("Target ID must be 0x01"));
}
break;
case REMOVE:
Status status =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ private void runQueryTest(TestDefinition.QueryTest testCase) {
}
}

private void runWatchTest(TestDefinition.ListenTest testCase)
private void runWatchTest(final TestDefinition.ListenTest testCase)
throws ExecutionException, InterruptedException {
final SettableApiFuture<Void> testCaseStarted = SettableApiFuture.create();
final SettableApiFuture<Void> testCaseFinished = SettableApiFuture.create();
Expand All @@ -464,10 +464,20 @@ public ApiStreamObserver<ListenRequest> answer(InvocationOnMock invocationOnMock
public void onEvent(
@Nullable QuerySnapshot actualSnapshot, @Nullable FirestoreException error) {
try {
Assert.assertFalse(expectedSnapshots.isEmpty());
Snapshot expectedSnapshot = expectedSnapshots.remove(0);
Assert.assertEquals(convertQuerySnapshot(expectedSnapshot), actualSnapshot);
if (expectedSnapshots.isEmpty()) {
if (actualSnapshot != null) {
Assert.assertNull(error);
Assert.assertFalse(expectedSnapshots.isEmpty());
Snapshot expectedSnapshot = expectedSnapshots.remove(0);
Assert.assertEquals(convertQuerySnapshot(expectedSnapshot), actualSnapshot);
if (expectedSnapshots.isEmpty()) {
if (!testCase.getIsError()) {
testCaseFinished.set(null);
}
}
} else { // Error case
Assert.assertNotNull(error);
Assert.assertTrue(expectedSnapshots.isEmpty());
Assert.assertTrue(testCase.getIsError());
testCaseFinished.set(null);
}
} catch (AssertionError e) {
Expand Down
Binary file modified google-cloud-firestore/src/test/resources/test-suite.binproto
Binary file not shown.