### Question:
BatchJobUploader { @VisibleForTesting String constructContentRangeHeaderValue( long requestLength, boolean isLastRequest, BatchJobUploadStatus batchJobUploadStatus) { Preconditions.checkArgument(requestLength > 0, "Request length %s is <= 0", requestLength); long previousTotalLength = batchJobUploadStatus.getTotalContentLength(); long contentLowerBound = previousTotalLength; long contentUpperBound = previousTotalLength + requestLength - 1; String totalBytesString; if (isLastRequest) { totalBytesString = String.valueOf(contentUpperBound + 1); } else { totalBytesString = "*"; } return String.format("bytes %d-%d/%s", contentLowerBound, contentUpperBound, totalBytesString); } @Inject  BatchJobUploader(
      AdWordsSession session, HttpTransport httpTransport, BatchJobLogger batchJobLogger); BatchJobUploadResponse uploadIncrementalBatchJobOperations(
      final BatchJobMutateRequestInterface request, final boolean isLastRequest,
      BatchJobUploadStatus batchJobUploadStatus);  }### Answer:
@Test public void testConstructContentRangeHeaderValue_notLast_nonZeroLength_zeroPrevious() { BatchJobUploadStatus status = new BatchJobUploadStatus(0, null); long requestLength = 100; String expectedContentRange = "bytes 0-99/*"; assertEquals( expectedContentRange, uploader.constructContentRangeHeaderValue(requestLength, false, status)); }
@Test public void testConstructContentRangeHeaderValue_notLast_nonZeroLength_nonZeroPrevious() { BatchJobUploadStatus status = new BatchJobUploadStatus(100, null); long requestLength = 100; String expectedContentRange = "bytes 100-199/*"; assertEquals( expectedContentRange, uploader.constructContentRangeHeaderValue(requestLength, false, status)); }
@Test public void testConstructContentRangeHeaderValue_isLast_nonZeroLength_nonZeroPrevious() { BatchJobUploadStatus status = new BatchJobUploadStatus(100, null); long requestLength = 100; String expectedContentRange = "bytes 100-199/200"; assertEquals( expectedContentRange, uploader.constructContentRangeHeaderValue(requestLength, true, status)); }
@Test public void testConstructContentRangeHeaderValue_isLast_nonZeroLength_zeroPrevious() { BatchJobUploadStatus status = new BatchJobUploadStatus(0, null); long requestLength = 100; String expectedContentRange = "bytes 0-99/100"; assertEquals( expectedContentRange, uploader.constructContentRangeHeaderValue(requestLength, true, status)); }
@Test public void testConstructContentRangeHeaderValue_notLast_zeroLength() { BatchJobUploadStatus status = new BatchJobUploadStatus(0, null); thrown.expect(IllegalArgumentException.class); uploader.constructContentRangeHeaderValue(0, false, status); }