private void testConversionForNamedBlob(IdConverter idConverter, RestMethod restMethod,
      Map<String, String> signedIdMetadata, String expectedOutput, String input) throws Exception {
    JSONObject requestData = new JSONObject();
    JSONObject headers = new JSONObject();
    String contentType = "application/octet-stream";
    headers.put(RestUtils.Headers.AMBRY_CONTENT_TYPE, contentType);
    requestData.put(MockRestRequest.REST_METHOD_KEY, restMethod.name());
    requestData.put(MockRestRequest.URI_KEY, NAMED_BLOB_PATH);
    requestData.put(MockRestRequest.HEADERS_KEY, headers);
    RestRequest restRequest = new MockRestRequest(requestData, null);
    if (signedIdMetadata != null) {
      restRequest.setArg(RestUtils.InternalKeys.SIGNED_ID_METADATA_KEY, signedIdMetadata);
    }
    BlobInfo blobInfo = null;
    if (restMethod.equals(RestMethod.PUT)) {
      restRequest.setArg(RestUtils.InternalKeys.REQUEST_PATH,
          RequestPath.parse(NAMED_BLOB_PATH, Collections.emptyMap(), Collections.emptyList(), "Ambry-test"));
      blobInfo = new BlobInfo(new BlobProperties(-1, "service", accountId, containerId, false), new byte[0]);
    }
    IdConversionCallback callback = new IdConversionCallback();
    assertEquals("Converted ID does not match expected (Future)", expectedOutput,
        idConverter.convert(restRequest, input, blobInfo.getBlobProperties(), callback).get(5, TimeUnit.SECONDS));
    assertEquals("Converted ID does not match expected (Callback)", expectedOutput, callback.result);
    assertTrue("Named Blob Put request should have named blob version in its internal keys",
        restRequest.getArgs().containsKey(RestUtils.InternalKeys.NAMED_BLOB_VERSION));
  }
Tests the conversion by the {@code idConverter}.
@param idConverter the {@link IdConverter} instance to use.
@param restMethod the {@link RestMethod} of the {@link RestRequest} that will be created.
@param signedIdMetadata the headers of the {@link RestRequest}.
@param expectedOutput the expected output from the {@code idConverter}.
@param input the input string
@throws Exception
ambry-frontend/src/test/java/com/github/ambry/frontend/AmbryIdConverterFactoryTest.java