@Test
  public void testEmptyRatio() throws Exception {
    NumericVariable num = new NumericVariable(null);
    NumericVariable ord = new NumericVariable(null);

    MetricsFactory.getInstance().addRatio("rat", num, ord);
    String json = ((CodahaleMetrics) MetricsFactory.getInstance()).dumpJson();
    MetricsTestUtils.verifyMetricsJson(json, MetricsTestUtils.GAUGE, "rat", "NaN");
  }
Unit test for the RatioGauge implementation.
standalone-metastore/metastore-common/src/test/java/org/apache/hadoop/hive/common/metrics/metrics2/TestMetricVariableRatioGauge.java