Source:
public void getExternalIds() { setupQuery(ImmutableList.of("foo1", "foo2")); ForwardCursorPagedResourceList<ExternalIdentifierInfo> results = dao.getExternalIds(TEST_STUDY, "offsetKey", 50, "offset", true); Map<String,Object> paramsMap = results.getRequestParams(); assertEquals(50, (int) paramsMap.get(ResourceList.PAGE_SIZE)); assertTrue((boolean) paramsMap.get(ResourceList.ASSIGNMENT_FILTER)); assertEquals("offset", (String) paramsMap.get(ResourceList.ID_FILTER)); assertEquals("offsetKey", (String) paramsMap.get(ResourceList.OFFSET_KEY)); verify(mapper).queryPage(eq(DynamoExternalIdentifier.class), queryCaptor.capture()); DynamoDBQueryExpression<DynamoExternalIdentifier> query = queryCaptor.getValue(); Condition rangeCondition = query.getRangeKeyConditions().get(DynamoExternalIdDao.IDENTIFIER); assertEquals(BEGINS_WITH.toString(), rangeCondition.getComparisonOperator()); assertEquals("offset", rangeCondition.getAttributeValueList().get(0).getS()); Condition assignmentCondition = query.getQueryFilter().get(DynamoExternalIdDao.HEALTH_CODE); assertEquals(NOT_NULL.toString(), assignmentCondition.getComparisonOperator()); Map<String, AttributeValue> map = query.getExclusiveStartKey(); assertEquals(TEST_STUDY_IDENTIFIER, map.get(DynamoExternalIdDao.STUDY_ID).getS()); assertEquals("offsetKey", map.get(DynamoExternalIdDao.IDENTIFIER).getS()); assertEquals(ReturnConsumedCapacity.TOTAL.toString(), query.getReturnConsumedCapacity()); assertEquals(new Integer(DynamoExternalIdDao.PAGE_SCAN_LIMIT), query.getLimit()); assertTrue(query.isConsistentRead()); DynamoExternalIdentifier id = query.getHashKeyValues(); assertEquals(TEST_STUDY_IDENTIFIER, id.getStudyId()); assertNull(id.getIdentifier()); }

Target:
public void getExternalIds() { setupQueryOfStrings(ImmutableList.of("foo1", "foo2")); ForwardCursorPagedResourceList<ExternalIdentifierInfo> results = dao.getExternalIds(TEST_STUDY, "offsetKey", 50, "offset", true); assertEquals("foo1", results.getItems().get(0).getIdentifier()); assertEquals("foo2", results.getItems().get(1).getIdentifier()); assertEquals(2, results.getItems().size()); Map<String,Object> paramsMap = results.getRequestParams(); assertEquals(50, (int) paramsMap.get(ResourceList.PAGE_SIZE)); assertTrue((boolean) paramsMap.get(ResourceList.ASSIGNMENT_FILTER)); assertEquals("offset", (String) paramsMap.get(ResourceList.ID_FILTER)); assertEquals("offsetKey", (String) paramsMap.get(ResourceList.OFFSET_KEY)); verify(mapper).queryPage(eq(DynamoExternalIdentifier.class), queryCaptor.capture()); DynamoDBQueryExpression<DynamoExternalIdentifier> query = queryCaptor.getValue(); Condition rangeCondition = query.getRangeKeyConditions().get(DynamoExternalIdDao.IDENTIFIER); assertEquals(BEGINS_WITH.toString(), rangeCondition.getComparisonOperator()); assertEquals("offset", rangeCondition.getAttributeValueList().get(0).getS()); Condition assignmentCondition = query.getQueryFilter().get(DynamoExternalIdDao.HEALTH_CODE); assertEquals(NOT_NULL.toString(), assignmentCondition.getComparisonOperator()); Map<String, AttributeValue> map = query.getExclusiveStartKey(); assertEquals(TEST_STUDY_IDENTIFIER, map.get(DynamoExternalIdDao.STUDY_ID).getS()); assertEquals("offsetKey", map.get(DynamoExternalIdDao.IDENTIFIER).getS()); assertEquals(ReturnConsumedCapacity.TOTAL.toString(), query.getReturnConsumedCapacity()); assertEquals(new Integer(DynamoExternalIdDao.PAGE_SCAN_LIMIT), query.getLimit()); assertTrue(query.isConsistentRead()); DynamoExternalIdentifier id = query.getHashKeyValues(); assertEquals(TEST_STUDY_IDENTIFIER, id.getStudyId()); assertNull(id.getIdentifier()); }