@Test public void testEmptyMonitorContext() throws MeasurementNotAvailableException, InvalidMonitorContextException { MonitorContextBuilder builder = DefaultMonitorContext.builder(); sensor.setMonitorContext(builder.build()); System.out.println(sensor.getMeasurement().getValue()); }
@Test(expected = MeasurementNotAvailableException.class) public void testWrongFsRoot() throws MeasurementNotAvailableException, InvalidMonitorContextException { MonitorContextBuilder builder = DefaultMonitorContext.builder(); builder.addContext("fs_root", "foobar"); sensor.setMonitorContext(builder.build()); System.out.println(sensor.getMeasurement().getValue()); }
@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()); }