@Test
public void singleUpload_progressReporter() {

    final UploadConfiguration uploadConfiguration =
            UploadConfiguration.builder().allowMultipartUploads(false).build();
    final UploadManager uploadManager = new UploadManager(objectStorage, uploadConfiguration);
    final AtomicInteger expectedProgressNotificationCount = new AtomicInteger();
    when(objectStorage.putObject(any(PutObjectRequest.class)))
            .then(
                    new Answer<PutObjectResponse>() {
                        @Override
                        public PutObjectResponse answer(InvocationOnMock invocationOnMock)
                                throws Throwable {
                            final PutObjectRequest putObjectRequest =
                                    invocationOnMock.getArgumentAt(0, null);
                            final InputStream inputStream = putObjectRequest.getPutObjectBody();
                            byte[] buffer = new byte[READ_BLOCK_SIZE];
                            while (inputStream.read(buffer) != -1) {
                                expectedProgressNotificationCount.getAndIncrement();
                            }
                            return PutObjectResponse.builder().build();
                        }
                    });
    final ProgressReporter progressReporter = mock(ProgressReporter.class);
    final UploadResponse uploadResponse =
            uploadManager.upload(createUploadRequest(progressReporter));
    assertNotNull(uploadResponse);
    verify(progressReporter, times(expectedProgressNotificationCount.get()))
            .onProgress(and(gt(0L), leq(CONTENT_LENGTH)), eq(CONTENT_LENGTH));
}