|
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; |
@@ -694,12 +696,21 @@ public void executeTasks_ParallelTrueAndStopOnErrorTrue_ExceptionThrown_ShouldSt |
694 | 696 | List<ParallelExecutorTask> mixedTasks = Arrays.asList(failingTask1, failingTask2, task); |
695 | 697 |
|
696 | 698 | // Act Assert |
697 | | - assertThatThrownBy( |
| 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 | + if (exception == executionException1) { |
| 706 | + assertThat(exception) |
| 707 | + .isEqualTo(executionException1) |
| 708 | + .hasSuppressedException(executionException2); |
| 709 | + } else { |
| 710 | + assertThat(exception) |
| 711 | + .isEqualTo(executionException2) |
| 712 | + .hasSuppressedException(executionException1); |
| 713 | + } |
703 | 714 |
|
704 | 715 | verify(parallelExecutorService, times(mixedTasks.size())).execute(any()); |
705 | 716 | } |
|
0 commit comments