@SuppressWarnings("unchecked")
@Test
public void testDiskStatGaugeSet() {

    ManualClock clock = new ManualClock();
    DiskStatGaugeSet diskStatGaugeSet = new DiskStatGaugeSet(10, TimeUnit.MILLISECONDS, clock, new File[]{ root });
    Map<MetricName, Metric> metrics = diskStatGaugeSet.getMetrics();
    Assert.assertEquals("should have 3 metrics", 3, metrics.keySet().size());
    clock.addMillis(20);
    Gauge<Long> diskTotal = (Gauge<Long>)metrics.get(MetricName.build("disk.partition.total").tagged("partition", "/"));
    Gauge<Long> diskFree = (Gauge<Long>)metrics.get(MetricName.build("disk.partition.free").tagged("partition", "/"));
    Gauge<Double> usedRatio = (Gauge<Double>)metrics.get(MetricName.build("disk.partition.used_ratio").tagged("partition", "/"));
    Assert.assertEquals(10000L, diskTotal.getValue().longValue());
    Assert.assertEquals(8000L, diskFree.getValue().longValue());
    Assert.assertEquals(0.2d, usedRatio.getValue(), 0.0001d);
}