@Test
public void multipartUpload_progressReporter() {

    final UploadManager uploadManager =
            new UploadManager(objectStorage, getMultipartUploadConfiguration()) {
                @Override
                protected MultipartObjectAssembler createAssembler(
                        PutObjectRequest request,
                        UploadRequest uploadRequest,
                        ExecutorService executorService) {
                    return assembler;
                }
            };
    final AtomicInteger onProgressCallbackCount = new AtomicInteger();
    when(assembler.addPart(any(InputStream.class), anyLong(), anyString()))
            .thenAnswer(
                    new Answer<Integer>() {
                        @Override
                        public Integer answer(InvocationOnMock invocationOnMock)
                                throws Throwable {
                            final InputStream inputStream =
                                    invocationOnMock.getArgumentAt(0, null);
                            final byte[] buffer = new byte[READ_BLOCK_SIZE];
                            while (inputStream.read(buffer) != -1) {
                                onProgressCallbackCount.incrementAndGet();
                            }
                            return ThreadLocalRandom.current().nextInt();
                        }
                    });
    when(assembler.commit()).thenReturn(CommitMultipartUploadResponse.builder().build());
    final ProgressReporter progressReporter = mock(ProgressReporter.class);
    final UploadResponse uploadResponse =
            uploadManager.upload(createUploadRequest(progressReporter));
    assertNotNull(uploadResponse);
    verify(progressReporter, times(onProgressCallbackCount.get()))
            .onProgress(and(gt(0L), leq(CONTENT_LENGTH)), eq(CONTENT_LENGTH));
}