@Test
  public void badInstantiationTest() {
    Class ownerClass = getClass();
    String requestType = "Test";
    MetricRegistry metricRegistry = new MetricRegistry();

    // ownerClass null
    try {
      new RestRequestMetrics(null, requestType, metricRegistry);
      fail("There was no exception even though one of the instantiation arguments for RestRequestMetrics is null");
    } catch (IllegalArgumentException e) {
      // expected. nothing to do.
    }

    // requestType null
    try {
      new RestRequestMetrics(ownerClass, null, metricRegistry);
      fail("There was no exception even though one of the instantiation arguments for RestRequestMetrics is null");
    } catch (IllegalArgumentException e) {
      // expected. nothing to do.
    }

    // MetricRegistry null
    try {
      new RestRequestMetrics(ownerClass, requestType, null);
      fail("There was no exception even though one of the instantiation arguments for RestRequestMetrics is null");
    } catch (IllegalArgumentException e) {
      // expected. nothing to do.
    }
  }
Tests instantiation of {@link RestRequestMetrics} with bad input.
ambry-api/src/test/java/com/github/ambry/rest/RestRequestMetricsTest.java