Skip to content

Commit 8efc158

Browse files
committed
Minor fixes to unit tests
1 parent 36f4142 commit 8efc158

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

core/src/test/java/com/scalar/db/transaction/consensuscommit/CoordinatorGroupCommitterTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,9 @@ void remove_GivenAllFullTxIds_ShouldRemoveAll() throws Exception {
258258
}
259259
}
260260

261+
@SuppressWarnings("ClassCanBeStatic")
261262
@Nested
262-
static class CoordinatorGroupCommitKeyManipulatorTest {
263+
class CoordinatorGroupCommitKeyManipulatorTest {
263264
private final CoordinatorGroupCommitKeyManipulator keyManipulator =
264265
new CoordinatorGroupCommitKeyManipulator();
265266

core/src/test/java/com/scalar/db/transaction/consensuscommit/ParallelExecutorTest.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package com.scalar.db.transaction.consensuscommit;
22

3+
import static org.assertj.core.api.Assertions.assertThat;
34
import static org.assertj.core.api.Assertions.assertThatCode;
45
import static org.assertj.core.api.Assertions.assertThatThrownBy;
6+
import static org.assertj.core.api.Assertions.catchException;
57
import static org.mockito.ArgumentMatchers.any;
68
import static org.mockito.Mockito.atMost;
79
import static org.mockito.Mockito.doThrow;
@@ -694,12 +696,21 @@ public void executeTasks_ParallelTrueAndStopOnErrorTrue_ExceptionThrown_ShouldSt
694696
List<ParallelExecutorTask> mixedTasks = Arrays.asList(failingTask1, failingTask2, task);
695697

696698
// Act Assert
697-
assertThatThrownBy(
699+
Exception exception =
700+
catchException(
698701
() ->
699702
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+
}
703714

704715
verify(parallelExecutorService, times(mixedTasks.size())).execute(any());
705716
}

0 commit comments

Comments
 (0)