Skip to content

Commit c01a26e

Browse files
committed
Fix
1 parent e045ad5 commit c01a26e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void getState_TransactionIdGiven_ShouldReturnState()
6868
// Arrange
6969
Result result = mock(Result.class);
7070
when(result.getText(Attribute.ID)).thenReturn(ANY_ID_1);
71-
when(result.getText(Attribute.CHILD_IDS)).thenReturn(EMPTY_CHILD_IDS);
71+
when(result.contains(Attribute.CHILD_IDS)).thenReturn(false);
7272
when(result.getInt(Attribute.STATE)).thenReturn(TransactionState.COMMITTED.get());
7373
when(result.getBigInt(Attribute.CREATED_AT)).thenReturn(ANY_TIME_1);
7474
when(storage.get(any(Get.class))).thenReturn(Optional.of(result));
@@ -112,6 +112,7 @@ public void getStateByParentId_GroupCommitParentIdGiven_ShouldReturnStateUsingIt
112112

113113
Result result = mock(Result.class);
114114
when(result.getText(Attribute.ID)).thenReturn(parentId);
115+
when(result.contains(Attribute.CHILD_IDS)).thenReturn(true);
115116
when(result.getText(Attribute.CHILD_IDS)).thenReturn(childIdsStr);
116117
when(result.getInt(Attribute.STATE)).thenReturn(TransactionState.ABORTED.get());
117118
when(result.getBigInt(Attribute.CREATED_AT)).thenReturn(ANY_TIME_1);
@@ -139,6 +140,7 @@ public void getStateByFullId_GroupCommitFullIdGiven_ShouldReturnStateUsingItPare
139140

140141
Result result = mock(Result.class);
141142
when(result.getText(Attribute.ID)).thenReturn(fullId);
143+
when(result.contains(Attribute.CHILD_IDS)).thenReturn(true);
142144
when(result.getText(Attribute.CHILD_IDS)).thenReturn(EMPTY_CHILD_IDS);
143145
when(result.getInt(Attribute.STATE)).thenReturn(TransactionState.ABORTED.get());
144146
when(result.getBigInt(Attribute.CREATED_AT)).thenReturn(ANY_TIME_1);
@@ -220,6 +222,7 @@ public void getState_WithCoordinatorNamespaceChanged_ShouldGetWithChangedNamespa
220222

221223
Result result = mock(Result.class);
222224
when(result.getText(Attribute.ID)).thenReturn(ANY_ID_1);
225+
when(result.contains(Attribute.CHILD_IDS)).thenReturn(true);
223226
when(result.getText(Attribute.CHILD_IDS)).thenReturn(EMPTY_CHILD_IDS);
224227
when(result.getInt(Attribute.STATE)).thenReturn(TransactionState.COMMITTED.get());
225228
when(result.getBigInt(Attribute.CREATED_AT)).thenReturn(ANY_TIME_1);
@@ -297,6 +300,7 @@ public void getState_TransactionIdForGroupCommitGivenAndParentIdAndChildIdMatch_
297300

298301
Result resultForGroupCommitState = mock(Result.class);
299302
when(resultForGroupCommitState.getText(Attribute.ID)).thenReturn(parentId);
303+
when(resultForGroupCommitState.contains(Attribute.CHILD_IDS)).thenReturn(true);
300304
when(resultForGroupCommitState.getText(Attribute.CHILD_IDS))
301305
.thenReturn(Joiner.on(',').join(childIds));
302306
when(resultForGroupCommitState.getInt(Attribute.STATE)).thenReturn(transactionState.get());
@@ -353,13 +357,15 @@ public void getState_TransactionIdForSingleCommitGivenAndFullIdMatches_ShouldRet
353357

354358
Result resultForGroupCommitState = mock(Result.class);
355359
when(resultForGroupCommitState.getText(Attribute.ID)).thenReturn(parentId);
360+
when(resultForGroupCommitState.contains(Attribute.CHILD_IDS)).thenReturn(true);
356361
when(resultForGroupCommitState.getText(Attribute.CHILD_IDS))
357362
.thenReturn(Joiner.on(',').join(dummyChildIds));
358363
when(resultForGroupCommitState.getInt(Attribute.STATE)).thenReturn(transactionState.get());
359364
when(resultForGroupCommitState.getBigInt(Attribute.CREATED_AT)).thenReturn(ANY_TIME_1);
360365

361366
Result resultForSingleCommitState = mock(Result.class);
362367
when(resultForSingleCommitState.getText(Attribute.ID)).thenReturn(fullId);
368+
when(resultForSingleCommitState.contains(Attribute.CHILD_IDS)).thenReturn(true);
363369
when(resultForSingleCommitState.getText(Attribute.CHILD_IDS)).thenReturn(EMPTY_CHILD_IDS);
364370
when(resultForSingleCommitState.getInt(Attribute.STATE)).thenReturn(transactionState.get());
365371
when(resultForSingleCommitState.getBigInt(Attribute.CREATED_AT)).thenReturn(ANY_TIME_1);
@@ -410,6 +416,7 @@ public void getState_TransactionIdForGroupCommitGivenAndOnlyParentIdMatches_Shou
410416

411417
Result resultForGroupCommitState = mock(Result.class);
412418
when(resultForGroupCommitState.getText(Attribute.ID)).thenReturn(parentId);
419+
when(resultForGroupCommitState.contains(Attribute.CHILD_IDS)).thenReturn(true);
413420
when(resultForGroupCommitState.getText(Attribute.CHILD_IDS))
414421
.thenReturn(Joiner.on(',').join(childIds));
415422
when(resultForGroupCommitState.getInt(Attribute.STATE)).thenReturn(transactionState.get());
@@ -464,13 +471,15 @@ public void getState_TransactionIdForGroupCommitGivenAndOnlyParentIdMatches_Shou
464471

465472
Result resultForGroupCommitState = mock(Result.class);
466473
when(resultForGroupCommitState.getText(Attribute.ID)).thenReturn(parentId);
474+
when(resultForGroupCommitState.contains(Attribute.CHILD_IDS)).thenReturn(true);
467475
when(resultForGroupCommitState.getText(Attribute.CHILD_IDS))
468476
.thenReturn(Joiner.on(',').join(childIds));
469477
when(resultForGroupCommitState.getInt(Attribute.STATE)).thenReturn(transactionState.get());
470478
when(resultForGroupCommitState.getBigInt(Attribute.CREATED_AT)).thenReturn(ANY_TIME_1);
471479

472480
Result resultForSingleCommitState = mock(Result.class);
473481
when(resultForSingleCommitState.getText(Attribute.ID)).thenReturn(targetFullId);
482+
when(resultForSingleCommitState.contains(Attribute.CHILD_IDS)).thenReturn(true);
474483
when(resultForSingleCommitState.getText(Attribute.CHILD_IDS)).thenReturn(EMPTY_CHILD_IDS);
475484
when(resultForSingleCommitState.getInt(Attribute.STATE)).thenReturn(transactionState.get());
476485
when(resultForSingleCommitState.getBigInt(Attribute.CREATED_AT)).thenReturn(ANY_TIME_1);
@@ -522,6 +531,7 @@ public void getState_TransactionIdGivenButNoIdMatches_ShouldReturnEmpty(
522531

523532
Result resultForGroupCommitState = mock(Result.class);
524533
when(resultForGroupCommitState.getText(Attribute.ID)).thenReturn(parentId);
534+
when(resultForGroupCommitState.contains(Attribute.CHILD_IDS)).thenReturn(true);
525535
when(resultForGroupCommitState.getText(Attribute.CHILD_IDS))
526536
.thenReturn(Joiner.on(',').join(childIds));
527537
when(resultForGroupCommitState.getInt(Attribute.STATE)).thenReturn(transactionState.get());

0 commit comments

Comments
 (0)