private void putBlobAndVerify(ThrowingConsumer<ExecutionException> errorChecker, long ttl) throws Exception {
    JSONObject headers = new JSONObject();
    FrontendRestRequestServiceTest.setAmbryHeadersForPut(headers, ttl, !REF_CONTAINER.isCacheable(), SERVICE_ID,
        CONTENT_TYPE, OWNER_ID, null, null, null);
    byte[] content = TestUtils.getRandomBytes(1024);
    RestRequest request = getRestRequest(headers, request_path, content);
    RestResponseChannel restResponseChannel = new MockRestResponseChannel();
    FutureResult<Void> future = new FutureResult<>();
    idConverterFactory.lastInput = null;
    idConverterFactory.lastBlobProperties = null;
    idConverterFactory.lastConvertedId = null;
    namedBlobPutHandler.handle(request, restResponseChannel, future::done);
    if (errorChecker == null) {
      future.get(TIMEOUT_SECS, TimeUnit.SECONDS);
      // in id converter, the callback is invoked before the lastConvertedId is set, we need to wait
      // for a while before we can check the lastConvertedId.
      Thread.sleep(100);
      assertEquals("Unexpected location header", idConverterFactory.lastConvertedId,
          restResponseChannel.getHeader(RestUtils.Headers.LOCATION));
      InMemoryRouter.InMemoryBlob blob = router.getActiveBlobs().get(idConverterFactory.lastInput);
      assertEquals("Unexpected blob content stored", ByteBuffer.wrap(content), blob.getBlob());
      assertEquals("Unexpected TTL in blob", ttl, blob.getBlobProperties().getTimeToLiveInSeconds());
      assertEquals("Unexpected response status", restResponseChannel.getStatus(), ResponseStatus.Ok);
    } else {
      TestUtils.assertException(ExecutionException.class, () -> future.get(TIMEOUT_SECS, TimeUnit.SECONDS),
          errorChecker);
    }
  }
Make a stitch blob call using {@link PostBlobHandler} and verify the result of the operation.
@param errorChecker if non-null, expect an exception to be thrown by the post flow and verify it using this
                    {@link ThrowingConsumer}.
@param ttl the ttl used for the blob
@throws Exception
ambry-frontend/src/test/java/com/github/ambry/frontend/NamedBlobPutHandlerTest.java