@Test public void testFreeDiskSpaceSensor() throws InvalidMonitorContextException, MeasurementNotAvailableException, SigarException { MonitorContextBuilder builder = DefaultMonitorContext.builder(); builder.addContext("fs_root", "/"); builder.addContext("unit", "mb"); sensor.setMonitorContext(builder.build()); System.out.println(sensor.getMeasurement().getValue()); }
@Test public void testWrongUnit() throws MeasurementNotAvailableException, InvalidMonitorContextException { MonitorContextBuilder builder = DefaultMonitorContext.builder(); builder.addContext("unit", "foobar"); sensor.setMonitorContext(builder.build()); System.out.println(sensor.getMeasurement().getValue()); }