static <T> void assertFailureAndCheckErrorCode(Future<T> future, TestCallback<T> callback,
      RouterErrorCode expectedError) {
    try {
      assertTrue("Callback was not called", callback.getLatch().await(AWAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS));
      future.get(1, TimeUnit.SECONDS);
      fail("Operation should be unsuccessful. Exception is expected.");
    } catch (Exception e) {
      assertEquals("RouterErrorCode should be " + expectedError + " (future)", expectedError,
          ((RouterException) e.getCause()).getErrorCode());
      if (callback != null) {
        assertEquals("RouterErrorCode should be " + expectedError + " (callback)", expectedError,
            ((RouterException) callback.getException()).getErrorCode());
        assertNull("Result should be null", callback.getResult());
      }
    }
  }
Check that a router operation has failed with a router exception with the specified error code.
@param future the {@link Future} for the router operation
@param callback the {@link TestCallback} for the router operation. Can be {@code null}
@param expectedError the expected {@link RouterErrorCode}
ambry-router/src/test/java/com/github/ambry/router/RouterTestHelpers.java