S3NameOrderPrefixFileExplorer extends S3PrefixFileExplorer { @Override protected List<S3ObjectSummary> fetch() { final ListObjectsRequest req = new ListObjectsRequest(bucketName, pathPrefix, lastPath, null, 1024); final ObjectListing ol = new DefaultRetryable<ObjectListing>("Listing objects") { @Override public ObjectListing call() { return s3Client.listObjects(req); } }.executeWith(retryExecutor); lastPath = ol.getNextMarker(); return ol.getObjectSummaries(); } S3NameOrderPrefixFileExplorer(final String bucketName, final AmazonS3 s3Client, final RetryExecutor retryExecutor,
            final String pathPrefix, final boolean skipGlacierObjects, final String lastPath);   }
@Test public void fetch_should_return_list_objects() { final ObjectListing ol = mock(ObjectListing.class); when(s3Client.listObjects(any(ListObjectsRequest.class))).thenReturn(ol); s3NameOrderPrefixFileExplorer.fetch(); final ArgumentCaptor<ListObjectsRequest> listObjectsRequestCaptor = ArgumentCaptor.forClass(ListObjectsRequest.class); verify(ol).getNextMarker(); verify(s3Client).listObjects(listObjectsRequestCaptor.capture()); final ListObjectsRequest listObjectsRequest = listObjectsRequestCaptor.getValue(); assertEquals(BUCKET_NAME, listObjectsRequest.getBucketName()); assertEquals(PATH_PREFIX, listObjectsRequest.getPrefix()); assertEquals(LAST_PATH, listObjectsRequest.getMarker()); }