|
1 | 1 | package com.scalar.db.transaction.consensuscommit; |
2 | 2 |
|
| 3 | +import static org.assertj.core.api.Assertions.assertThat; |
3 | 4 | import static org.assertj.core.api.Assertions.assertThatCode; |
4 | 5 | import static org.assertj.core.api.Assertions.assertThatThrownBy; |
| 6 | +import static org.assertj.core.api.Assertions.catchException; |
5 | 7 | import static org.mockito.ArgumentMatchers.any; |
6 | 8 | import static org.mockito.Mockito.atMost; |
7 | 9 | import static org.mockito.Mockito.doThrow; |
@@ -693,13 +695,24 @@ public void executeTasks_ParallelTrueAndStopOnErrorTrue_ExceptionThrown_ShouldSt |
693 | 695 |
|
694 | 696 | List<ParallelExecutorTask> mixedTasks = Arrays.asList(failingTask1, failingTask2, task); |
695 | 697 |
|
696 | | - // Act Assert |
697 | | - assertThatThrownBy( |
| 698 | + // Act |
| 699 | + Exception exception = |
| 700 | + catchException( |
698 | 701 | () -> |
699 | 702 | parallelExecutor.executeTasks( |
700 | | - mixedTasks, parallel, noWait, stopOnError, "test", TX_ID)) |
701 | | - .isEqualTo(executionException1) |
702 | | - .hasSuppressedException(executionException2); |
| 703 | + mixedTasks, parallel, noWait, stopOnError, "test", TX_ID)); |
| 704 | + |
| 705 | + // Assert |
| 706 | + assertThat(exception) |
| 707 | + .satisfiesAnyOf( |
| 708 | + e -> |
| 709 | + assertThat(e) |
| 710 | + .isEqualTo(executionException1) |
| 711 | + .hasSuppressedException(executionException2), |
| 712 | + e -> |
| 713 | + assertThat(e) |
| 714 | + .isEqualTo(executionException2) |
| 715 | + .hasSuppressedException(executionException1)); |
703 | 716 |
|
704 | 717 | verify(parallelExecutorService, times(mixedTasks.size())).execute(any()); |
705 | 718 | } |
|
0 commit comments