/** * Tests {@link S3#listBucket(S3Client, String, ListBucketOptions)} where a * single response returns all results. * * @throws Exception * if anything goes wrong */ @Test public void testSinglePageResult() throws Exception { S3Client api = createMock(S3Client.class); ListBucketOptions options = new ListBucketOptions(); ListBucketResponse response = new ListBucketHandlerTest().expected(); expect(api.listBucket("bucket", options)).andReturn(response).once(); EasyMock.replay(api); PagedIterable<ObjectMetadata> result = S3.listBucket(api, "bucket", options); // number of pages assertEquals(result.size(), 1); // number of objects assertEquals(result.get(0).size(), 10); }
/** * Tests {@link S3#listBucket(S3Client, String, ListBucketOptions)} where a * single response returns all results. * * @throws Exception * if anything goes wrong */ @Test public void testSinglePageResult() throws Exception { S3Client api = createMock(S3Client.class); ListBucketOptions options = new ListBucketOptions(); ListBucketResponse response = new ListBucketHandlerTest().expected(); expect(api.listBucket("bucket", options)).andReturn(response).once(); EasyMock.replay(api); PagedIterable<ObjectMetadata> result = S3.listBucket(api, "bucket", options); // number of pages assertEquals(result.size(), 1); // number of objects assertEquals(result.get(0).size(), 10); }