### Question:
CpuManagement implements CpuManagementInterface { @Override public double getLoadAverage() { return osBean.getSystemLoadAverage(); } CpuManagement(); @Override double getLoadAverage();  }### Answer:
@Test public void testGetLoadAverage() { long total = 0; CpuManagement cpuManagement = null; try { cpuManagement = new CpuManagement(); } catch (final UnsupportedOperationException e) { SysErrLogger.FAKE_LOGGER.syserr(e); return; } double max = 0.0; SysErrLogger.FAKE_LOGGER.sysout("LA: " + cpuManagement.getLoadAverage()); for (int i = 0; i < 1000 * 1000 * 1000; i++) { total += i; total *= 10; } if (total <= 0) { System.out.println(total); } SysErrLogger.FAKE_LOGGER.sysout("LA: " + cpuManagement.getLoadAverage()); total = 0; for (int i = 0; i < 1000 * 1000 * 1000; i++) { total += i; total *= 10; } if (total <= 0) { System.out.println(total); } max = cpuManagement.getLoadAverage(); SysErrLogger.FAKE_LOGGER.sysout("LA: " + max); try { Thread.sleep(5000); } catch (final InterruptedException ignored) { } final double min = cpuManagement.getLoadAverage(); System.err.println("LA: " + min); total = 0; for (long i = 0; i < 1000 * 1000 * 1000 * 1000; i++) { total += i; total *= 10; } if (total <= 0) { System.out.println(total); } max = cpuManagement.getLoadAverage(); System.err.println("LA: " + max); assertTrue(true); }
@Test public void testSysmonGetLoadAverage() { long total = 0; final CpuManagementSysmon cpuManagement = new CpuManagementSysmon(); double max = 0.0; System.err.println("LAs: " + cpuManagement.getLoadAverage()); for (int i = 0; i < 1000 * 1000 * 1000; i++) { total += i; total *= 10; } if (total <= 0) { System.out.println(total); } System.err.println("LAs: " + cpuManagement.getLoadAverage()); total = 0; for (int i = 0; i < 1000 * 1000 * 1000; i++) { total += i; total *= 10; } if (total <= 0) { System.out.println(total); } max = cpuManagement.getLoadAverage(); System.err.println("LAs: " + max); try { Thread.sleep(2000); } catch (final InterruptedException ignored) { } final double min = cpuManagement.getLoadAverage(); System.err.println("LAs: " + min); assertTrue("Max > current: " + max + " >? " + min, max > min); total = 0; for (int i = 0; i < 1000 * 1000 * 1000; i++) { total += i; total *= 10; } if (total <= 0) { System.out.println(total); } max = cpuManagement.getLoadAverage(); System.err.println("LAs: " + max); assertTrue("Min < current: " + min + " <? " + max, max > min); }