Skip to content

Commit ca9fe4b

Browse files
committed
Fix unit tests
1 parent 4f6801f commit ca9fe4b

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

core/src/test/java/com/scalar/db/storage/objectstorage/MutateStatementHandlerTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ public void handle_PutWithoutConditionsWrapperExceptionThrown_ShouldThrowExecuti
232232
throws Exception {
233233
// Arrange
234234
Put put = preparePut();
235-
ObjectStorageWrapperException exception = new ObjectStorageWrapperException("Test error");
235+
ObjectStorageWrapperException exception =
236+
new ObjectStorageWrapperException("Test error", new RuntimeException());
236237
when(wrapper.get(anyString())).thenThrow(exception);
237238

238239
// Act & Assert
@@ -535,7 +536,8 @@ public void handle_DeleteWithoutConditionsWrapperExceptionThrown_ShouldThrowExec
535536
throws Exception {
536537
// Arrange
537538
Delete delete = prepareDelete();
538-
ObjectStorageWrapperException exception = new ObjectStorageWrapperException("Test error");
539+
ObjectStorageWrapperException exception =
540+
new ObjectStorageWrapperException("Test error", new RuntimeException());
539541
when(wrapper.get(anyString())).thenThrow(exception);
540542

541543
// Act & Assert

core/src/test/java/com/scalar/db/storage/objectstorage/SelectStatementHandlerTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@ public void handle_GetOperationWhenExceptionThrown_ShouldThrowExecutionException
194194
throws Exception {
195195
// Arrange
196196
Get get = prepareGet();
197-
when(wrapper.get(anyString())).thenThrow(new ObjectStorageWrapperException("error"));
197+
when(wrapper.get(anyString()))
198+
.thenThrow(new ObjectStorageWrapperException("error", new RuntimeException()));
198199

199200
// Act Assert
200201
assertThatThrownBy(() -> handler.handle(get)).isInstanceOf(ExecutionException.class);
@@ -240,7 +241,8 @@ public void handle_ScanOperationWhenExceptionThrown_ShouldThrowExecutionExceptio
240241
throws Exception {
241242
// Arrange
242243
Scan scan = prepareScan();
243-
when(wrapper.get(anyString())).thenThrow(new ObjectStorageWrapperException("error"));
244+
when(wrapper.get(anyString()))
245+
.thenThrow(new ObjectStorageWrapperException("error", new RuntimeException()));
244246

245247
// Act Assert
246248
assertThatThrownBy(() -> handler.handle(scan)).isInstanceOf(ExecutionException.class);
@@ -352,7 +354,8 @@ public void handle_ScanAllOperationWhenExceptionThrown_ShouldThrowExecutionExcep
352354
throws Exception {
353355
// Arrange
354356
Scan scanAll = prepareScanAll();
355-
when(wrapper.getKeys(anyString())).thenThrow(new ObjectStorageWrapperException("error"));
357+
when(wrapper.getKeys(anyString()))
358+
.thenThrow(new ObjectStorageWrapperException("error", new RuntimeException()));
356359

357360
// Act Assert
358361
assertThatThrownBy(() -> handler.handle(scanAll)).isInstanceOf(ExecutionException.class);

core/src/test/java/com/scalar/db/storage/objectstorage/StreamingRecordIteratorTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ public void hasNext_WhenCalledMultipleTimes_ShouldNotLoadPartitionMultipleTimes(
201201
public void next_WhenWrapperThrowsException_ShouldThrowRuntimeException() throws Exception {
202202
// Arrange
203203
List<String> partitionKeys = Collections.singletonList(PARTITION_KEY_1);
204-
ObjectStorageWrapperException exception = new ObjectStorageWrapperException("Test error");
204+
ObjectStorageWrapperException exception =
205+
new ObjectStorageWrapperException("Test error", new RuntimeException());
205206
when(wrapper.get(anyString())).thenThrow(exception);
206207

207208
StreamingRecordIterator iterator =

0 commit comments

Comments
 (0)