public void uploadPart(RefCountedFSOutputStream file) throws IOException {
        checkState(file.isClosed());

        final CompletableFuture<PartETag> future = new CompletableFuture<>();
        uploadsInProgress.add(future);

        numberOfRegisteredParts += 1;
        expectedSizeInBytes += file.getPos();

        file.retain();
        uploadThreadPool.execute(
                new UploadTask(
                        ossAccessor, objectName, uploadId, numberOfRegisteredParts, file, future));
    }
@Test(expected = IllegalStateException.class)
    public void testUploadingNonClosedFileAsCompleteShouldThroughException() throws IOException {
        final byte[] incompletePart = OSSTestUtils.bytesOf("!!!", 1024);

        RefCountedBufferingFileStream partFile =
                OSSTestUtils.writeData(temporaryFolder, incompletePart);

        uploader.uploadPart(partFile);
    }