@Test
public void testGetAllBinaryKeys() throws BinaryStoreException {

    List<S3ObjectSummary> objectList = new ArrayList<>();
    for (int i = 0; i < 101; i++) {
        S3ObjectSummary object = new S3ObjectSummary();
        object.setKey(String.valueOf(i));
        objectList.add(object);
    }
    // First request to get objects (incomplete list returned)
    expect(s3Client.listObjects(isA(ListObjectsRequest.class)))
        .andReturn(objectListing);
    expect(objectListing.getObjectSummaries()).andReturn(objectList);
    expect(objectListing.isTruncated()).andReturn(true);
    // Second request to get more objects
    expect(s3Client.listNextBatchOfObjects(objectListing))
        .andReturn(objectListing);
    expect(objectListing.getObjectSummaries()).andReturn(objectList);
    expect(objectListing.isTruncated()).andReturn(false);
    expect(objectListing.isTruncated()).andReturn(false);
    replayAll();
    final AtomicInteger keyCount = new AtomicInteger();
    s3BinaryStore.getAllBinaryKeys().forEach(k -> keyCount.incrementAndGet());
    assertEquals(202, keyCount.get()); // Expecting two sets of 101 objects
}