@Test
public void testExceptionFromUploadPart_inResume() throws B2Exception, IOException {

    // arrange to answer startLargeRequest
    final B2FileVersion largeFileVersion = makeVersion(1, 2);
    when(webifier.startLargeFile(anyObject(), anyObject())).thenReturn(largeFileVersion);
    // arrange to answer get_upload_part_url (which will be called several times, but it's ok to reuse the same value since it's all mocked!)
    final B2GetUploadPartUrlRequest partUrlRequest = B2GetUploadPartUrlRequest.builder(largeFileVersion.getFileId()).build();
    final B2UploadPartUrlResponse partUrl = new B2UploadPartUrlResponse(largeFileVersion.getFileId(), "uploadPartUrl", "uploadPartAuthToken");
    when(webifier.getUploadPartUrl(anyObject(), eq(partUrlRequest))).thenReturn(partUrl);
    // arrange to answer upload_part, based on the request.
    when(webifier.uploadPart(anyObject(), anyObject())).thenAnswer(invocationOnMock -> {
        B2UploadPartRequest request = (B2UploadPartRequest) invocationOnMock.getArguments()[1];
        return makePart(request.getPartNumber());
    });
    // depending on thread timing we'll get one of these results:
    recordingListener.setExpected(
            "B2UploadProgress{partIndex=0, partCount=2, startByte=0, length=1000, bytesSoFar=0, state=WAITING_TO_START}",
            "B2UploadProgress{partIndex=0, partCount=2, startByte=0, length=1000, bytesSoFar=0, state=STARTING}",
            "B2UploadProgress{partIndex=0, partCount=2, startByte=0, length=1000, bytesSoFar=1000, state=SUCCEEDED}",
            "B2UploadProgress{partIndex=1, partCount=2, startByte=1000, length=1000, bytesSoFar=0, state=WAITING_TO_START}",
            "B2UploadProgress{partIndex=1, partCount=2, startByte=1000, length=1000, bytesSoFar=0, state=STARTING}",
            "B2UploadProgress{partIndex=1, partCount=2, startByte=1000, length=1000, bytesSoFar=1000, state=SUCCEEDED}"
            );
    thrown.expect(B2Exception.class);
    thrown.expectMessage("testing");
    makeUploader(PART_SIZES, new ThrowingExecutor(IN_GET_AFTER_RUNNING_IN_SUBMIT, ExceptionType.B2_EXCEPTION), contentSource, recordingListener).uploadLargeFile();
}