use of software.amazon.awssdk.services.dynamodb.paginators.BatchGetItemIterable in project aws-sdk-java-v2 by aws.
the class BatchGetItemOperationTest method getServiceCall_usingShortcutForm_makesTheRightCallAndReturnsResponse.
@Test
public void getServiceCall_usingShortcutForm_makesTheRightCallAndReturnsResponse() {
BatchGetItemEnhancedRequest batchGetItemEnhancedRequest = BatchGetItemEnhancedRequest.builder().readBatches(ReadBatch.builder(FakeItem.class).mappedTableResource(fakeItemMappedTable).addGetItem(FAKE_ITEM_KEYS.get(0)).build()).build();
BatchGetItemOperation operation = BatchGetItemOperation.create(batchGetItemEnhancedRequest);
BatchGetItemRequest batchGetItemRequest = BatchGetItemRequest.builder().requestItems(singletonMap("test-table", KeysAndAttributes.builder().keys(singletonList(FAKE_ITEM_MAPS.get(0))).build())).build();
BatchGetItemIterable expectedResponse = mock(BatchGetItemIterable.class);
when(mockDynamoDbClient.batchGetItemPaginator(any(BatchGetItemRequest.class))).thenReturn(expectedResponse);
SdkIterable<BatchGetItemResponse> response = operation.serviceCall(mockDynamoDbClient).apply(batchGetItemRequest);
assertThat(response, sameInstance(expectedResponse));
verify(mockDynamoDbClient).batchGetItemPaginator(batchGetItemRequest);
}
use of software.amazon.awssdk.services.dynamodb.paginators.BatchGetItemIterable in project aws-sdk-java-v2 by aws.
the class BatchGetItemOperationTest method getServiceCall_usingKeyItemForm_makesTheRightCallAndReturnsResponse.
@Test
public void getServiceCall_usingKeyItemForm_makesTheRightCallAndReturnsResponse() {
BatchGetItemEnhancedRequest batchGetItemEnhancedRequest = BatchGetItemEnhancedRequest.builder().readBatches(ReadBatch.builder(FakeItem.class).mappedTableResource(fakeItemMappedTable).addGetItem(FAKE_ITEMS.get(0)).build()).build();
BatchGetItemOperation operation = BatchGetItemOperation.create(batchGetItemEnhancedRequest);
BatchGetItemRequest batchGetItemRequest = BatchGetItemRequest.builder().requestItems(singletonMap("test-table", KeysAndAttributes.builder().keys(singletonList(FAKE_ITEM_MAPS.get(0))).build())).build();
BatchGetItemIterable expectedResponse = mock(BatchGetItemIterable.class);
when(mockDynamoDbClient.batchGetItemPaginator(any(BatchGetItemRequest.class))).thenReturn(expectedResponse);
SdkIterable<BatchGetItemResponse> response = operation.serviceCall(mockDynamoDbClient).apply(batchGetItemRequest);
assertThat(response, sameInstance(expectedResponse));
verify(mockDynamoDbClient).batchGetItemPaginator(batchGetItemRequest);
}
Aggregations