S3VaultLocation implements VaultLocation { @Override public InputStream download() { final GetObjectRequest getObjectRequest = GetObjectRequest.builder() .bucket(bucketName) .key(fileName) .build(); return s3Client.getObject(getObjectRequest, ResponseTransformer.toInputStream()); }  @Override void upload(final byte[] documentContents); @Override InputStream download(); @Override void clear();  }
@Test void testDownload() { final InputStream downloadResult = mock(InputStream.class); when(s3Client.getObject(any(GetObjectRequest.class), any(ResponseTransformer.class))) .thenReturn(downloadResult); final InputStream result = underTest.download(); verify(s3Client).getObject(getObjectRequestArgumentCaptor.capture(), any(ResponseTransformer.class)); final GetObjectRequest getObjectRequest = getObjectRequestArgumentCaptor.getValue(); assertThat(getObjectRequest.bucket(), is(BUCKET_NAME)); assertThat(getObjectRequest.key(), is(FILE_NAME)); assertThat(result, is(downloadResult)); }