@Test public void createAndVerifyDiskSpaceWithUpperThresholdBeingCrossed() { DiskSpace diskSpace = new DiskSpace(EmptyConfiguration.INSTANCE); ThresholdValues tVals = new ThresholdValues(0.00, 0.05); diskSpace.setThresholdValues(tVals); SimpleThresholdListener l = new SimpleThresholdListener(); diskSpace.start(); if (!System.getProperty("os.name").startsWith("Windows")) { double utilization = diskSpace.getUtilization(); Assert.assertTrue("Utilization should be > 0", utilization > 0); } Assert.assertTrue(l.getType() == null); }
@Test public void createAndVerifyDiskSpaceClass() throws InterruptedException { DiskSpace diskSpace = new DiskSpace(EmptyConfiguration.INSTANCE); diskSpace.start(); MeasuredResource mRes = diskSpace.getMeasuredResource(); Assert.assertTrue("MeasuredResource should not be null", mRes != null); Assert.assertTrue( "MeasuredResource should be a DiskSpaceUtilization", mRes instanceof DiskSpaceUtilization); if (!System.getProperty("os.name").startsWith("Windows")) { double utilization = diskSpace.getUtilization(); Assert.assertTrue("Utilization should be > 0", utilization > 0); } }