@Test
  public void requestMarkingExceptionsTest() {
    RestRequestMetricsTracker requestMetrics = new RestRequestMetricsTracker();
    try {
      requestMetrics.nioMetricsTracker.markFirstByteSent();
      fail("Marking request as complete before marking it received should have thrown exception");
    } catch (IllegalStateException e) {
      // expected. nothing to do.
    }

    try {
      requestMetrics.nioMetricsTracker.markRequestCompleted();
      fail("Marking request as complete before marking it received should have thrown exception");
    } catch (IllegalStateException e) {
      // expected. nothing to do.
    }

    try {
      requestMetrics.scalingMetricsTracker.markRequestCompleted();
      fail("Marking request as complete before marking it received should have thrown exception");
    } catch (IllegalStateException e) {
      // expected. nothing to do.
    }
  }
Tests reaction to bad calls to {@link RestRequestMetricsTracker.NioMetricsTracker#markRequestCompleted()} and
{@link RestRequestMetricsTracker.ScalingMetricsTracker#markRequestCompleted()}
ambry-api/src/test/java/com/github/ambry/rest/RestRequestMetricsTrackerTest.java