@Test
  public void testOptionsFailures() throws Exception {
    ThrowingConsumer<Pair<RequestAndResult, RouterErrorCode>> runTest = requestAndErrorCode -> {
      requestAndResultsList.clear();
      requestAndResultsList.add(requestAndErrorCode.getFirst());
      mockClusterMap.clearLastNRequestedPartitionClasses();
      submitPutsAndAssertFailure(new RouterException("", requestAndErrorCode.getSecond()), true, false, false);
    };
    runTest.accept(new Pair<>(new RequestAndResult(chunkSize, null,
        new PutBlobOptionsBuilder().chunkUpload(true).maxUploadSize(chunkSize + 1).build(), null),
        RouterErrorCode.InvalidPutArgument));
    runTest.accept(new Pair<>(new RequestAndResult(chunkSize + 1, null,
        new PutBlobOptionsBuilder().chunkUpload(true).maxUploadSize(chunkSize).build(), null),
        RouterErrorCode.BlobTooLarge));
    runTest.accept(new Pair<>(new RequestAndResult(2, null, new PutBlobOptionsBuilder().maxUploadSize(1).build(), null),
        RouterErrorCode.BlobTooLarge));
    runTest.accept(new Pair<>(
        new RequestAndResult(2 * chunkSize, null, new PutBlobOptionsBuilder().maxUploadSize(2 * chunkSize - 1).build(),
            null), RouterErrorCode.BlobTooLarge));
    runTest.accept(
        new Pair<>(new RequestAndResult(0, null, new PutBlobOptionsBuilder().maxUploadSize(-1).build(), null),
            RouterErrorCode.BlobTooLarge));
  }
Test failure cases with various {@link PutBlobOptions} set.
ambry-router/src/test/java/com/github/ambry/router/PutManagerTest.java