ProgressTracker { protected void invalidateBytesRead(long invalidByteCount) { if (invalidByteCount > totalBytesRead) { throw new IllegalStateException( String.format( "Cannot invalidate %d bytes when total read bytes is %d", invalidByteCount, totalBytesRead)); } totalBytesRead -= invalidByteCount; }    }
@Test(expected = IllegalStateException.class) public void illegalProgressReset() { ProgressTrackerFactory progressTrackerFactory = ProgressTrackerFactory.createSingleUploadProgressTrackerFactory( new ProgressReporter() { @Override public void onProgress(long completed, long total) {} }, 0L); progressTrackerFactory.getProgressTracker().invalidateBytesRead(1); }