use of com.amazonaws.services.dynamodbv2.document.spec.QuerySpec in project BridgeServer2 by Sage-Bionetworks.
the class DynamoIndexHelperTest method testQuery.
@Test
public void testQuery() {
helper = new TestDynamoIndexHelper("test key", "test value", null, null);
QuerySpec spec = new QuerySpec();
Index mockIndex = mock(Index.class);
helper.setIndex(mockIndex);
ItemCollection mockItemCollection = mock(ItemCollection.class);
when(mockIndex.query(spec)).thenReturn(mockItemCollection);
QueryOutcome mockQueryOutcome = mock(QueryOutcome.class);
List<Item> items = Lists.newArrayList(mock(Item.class));
Page<Item, QueryOutcome> mockPage = new TestPage<Item, QueryOutcome>(items, mockQueryOutcome);
when(mockItemCollection.firstPage()).thenReturn(mockPage);
QueryOutcome result = helper.query(spec);
assertEquals(mockQueryOutcome, result);
verify(mockIndex).query(spec);
}
Aggregations