public NamenodeBeanMetrics getNamenodeMetrics() throws IOException {
    if (this.metrics == null) {
      throw new IOException("Namenode metrics is not initialized");
    }
    return this.metrics.getNamenodeMetrics();
  }
@Test
  public void testRouterMetricsWhenDisabled() throws Exception {

    Router router = new Router();
    router.init(new RouterConfigBuilder(conf).rpc().build());
    router.start();

    intercept(IOException.class, "Namenode metrics is not initialized",
        () -> router.getNamenodeMetrics().getCacheCapacity());

    router.stop();
    router.close();
  }