Skip to content

Commit 92e693b

Browse files
committed
Make tests about tasks from other workers clearer
1 parent fd473d0 commit 92e693b

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

firebase-crashlytics/src/androidTest/java/com/google/firebase/crashlytics/internal/CrashlyticsWorkerTest.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -287,26 +287,28 @@ public void submitTaskFromAnotherWorkerThatThrows() throws Exception {
287287
new CrashlyticsWorker(TestOnlyExecutors.blocking())
288288
.submitTask(() -> Tasks.forException(new IndexOutOfBoundsException()));
289289

290-
// Await on the throwing task to force the exception to propagate.
291-
assertThrows(ExecutionException.class, () -> Tasks.await(otherTask));
290+
// Await on the throwing task to force the exception to propagate threw the local worker.
291+
Task<?> task = crashlyticsWorker.submitTask(() -> otherTask);
292+
assertThrows(ExecutionException.class, () -> Tasks.await(task));
292293

293294
// Submit another task to local worker to verify the chain did not break.
294-
Task<Long> localTask = crashlyticsWorker.submitTask(() -> Tasks.forResult(0x5fe6eb50c7b537a9L));
295+
Task<Integer> localTask = crashlyticsWorker.submitTask(() -> Tasks.forResult(0x5f375a86));
295296

296-
Long localResult = Tasks.await(localTask);
297+
Integer localResult = Tasks.await(localTask);
297298

298299
assertThat(otherTask.isSuccessful()).isFalse();
299300
assertThat(localTask.isSuccessful()).isTrue();
300-
assertThat(localResult).isEqualTo(0x5fe6eb50c7b537a9L);
301+
assertThat(localResult).isEqualTo(0x5f375a86);
301302
}
302303

303304
@Test
304305
public void submitTaskFromAnotherWorkerThatCancels() throws Exception {
305306
Task<?> otherCancelled =
306307
new CrashlyticsWorker(TestOnlyExecutors.blocking()).submitTask(Tasks::forCanceled);
307308

308-
// Await on the cancelled task to force the exception to propagate.
309-
assertThrows(CancellationException.class, () -> Tasks.await(otherCancelled));
309+
// Await on the cancelled task to force the exception to propagate threw the local worker.
310+
Task<?> task = crashlyticsWorker.submitTask(() -> otherCancelled);
311+
assertThrows(CancellationException.class, () -> Tasks.await(task));
310312

311313
// Submit another task to local worker to verify the chain did not break.
312314
Task<Long> localTask = crashlyticsWorker.submitTask(() -> Tasks.forResult(0x5fe6eb50c7b537a9L));

0 commit comments

Comments
 (0)