public void call(int httpStatusCode) {
    String canonicalStatusCode = ServiceCallMetric.convertToCanonicalStatusString(httpStatusCode);
    call(canonicalStatusCode);
  }
@Test
  public void testCall() {
    // Test that its on the ProcessWideMetricContainer.
    MetricsContainerImpl container = new MetricsContainerImpl(null);
    MetricsEnvironment.setProcessWideContainer(container);

    String urn = MonitoringInfoConstants.Urns.API_REQUEST_COUNT;
    HashMap<String, String> labels = new HashMap<String, String>();
    labels.put("key", "value");
    ServiceCallMetric metric =
        new ServiceCallMetric(MonitoringInfoConstants.Urns.API_REQUEST_COUNT, labels);

    // Http Status Code
    metric.call(200);
    labels.put(MonitoringInfoConstants.Labels.STATUS, "ok");
    MonitoringInfoMetricName name = MonitoringInfoMetricName.named(urn, labels);
    Assert.assertEquals(1, (long) container.getCounter(name).getCumulative());

    // Normalize the status by lower casing and mapping to a canonical name with underscores.
    metric.call("notFound");
    labels.put(MonitoringInfoConstants.Labels.STATUS, "not_found");
    name = MonitoringInfoMetricName.named(urn, labels);
    Assert.assertEquals(1, (long) container.getCounter(name).getCumulative());

    // Normalize the status by lower casing and mapping to a canonical name with underscores.
    metric.call("PERMISSIONDENIED");
    labels.put(MonitoringInfoConstants.Labels.STATUS, "permission_denied");
    name = MonitoringInfoMetricName.named(urn, labels);
    Assert.assertEquals(1, (long) container.getCounter(name).getCumulative());

    // Accept other string codes passed in, even if they aren't in the canonical map.
    metric.call("something_else");
    labels.put(MonitoringInfoConstants.Labels.STATUS, "something_else");
    name = MonitoringInfoMetricName.named(urn, labels);
    Assert.assertEquals(1, (long) container.getCounter(name).getCumulative());

    // Map unknown numeric codes to "unknown"
    metric.call(123);
    labels.put(MonitoringInfoConstants.Labels.STATUS, "unknown");
    name = MonitoringInfoMetricName.named(urn, labels);
    Assert.assertEquals(1, (long) container.getCounter(name).getCumulative());
  }