### Question:
WindowsResourceCalculatorPlugin extends ResourceCalculatorPlugin { @Override public long getAvailablePhysicalMemorySize() { refreshIfNeeded(); return memAvailable; } WindowsResourceCalculatorPlugin(); @Override long getVirtualMemorySize(); @Override long getPhysicalMemorySize(); @Override long getAvailableVirtualMemorySize(); @Override long getAvailablePhysicalMemorySize(); @Override int getNumProcessors(); @Override long getCpuFrequency(); @Override long getCumulativeCpuTime(); @Override float getCpuUsage();  }### Answer:
@Test (timeout = 30000) public void parseSystemInfoString() { WindowsResourceCalculatorPluginTester tester = new WindowsResourceCalculatorPluginTester(); tester.infoStr = "17177038848,8589467648,15232745472,6400417792,1,2805000,6261812\r\n"; tester.getAvailablePhysicalMemorySize(); assertTrue(tester.vmemSize == 17177038848L); assertTrue(tester.memSize == 8589467648L); assertTrue(tester.vmemAvailable == 15232745472L); assertTrue(tester.memAvailable == 6400417792L); assertTrue(tester.numProcessors == 1); assertTrue(tester.cpuFrequencyKhz == 2805000L); assertTrue(tester.cumulativeCpuTimeMs == 6261812L); assertTrue(tester.cpuUsage == -1); }
@Test (timeout = 20000) public void refreshAndCpuUsage() throws InterruptedException { WindowsResourceCalculatorPluginTester tester = new WindowsResourceCalculatorPluginTester(); tester.infoStr = "17177038848,8589467648,15232745472,6400417792,1,2805000,6261812\r\n"; tester.getAvailablePhysicalMemorySize(); assertTrue(tester.memAvailable == 6400417792L); assertTrue(tester.cpuUsage == -1); tester.infoStr = "17177038848,8589467648,15232745472,5400417792,1,2805000,6261812\r\n"; tester.getAvailablePhysicalMemorySize(); assertTrue(tester.memAvailable == 6400417792L); assertTrue(tester.cpuUsage == -1); Thread.sleep(1500); tester.infoStr = "17177038848,8589467648,15232745472,5400417792,1,2805000,6286812\r\n"; tester.getAvailablePhysicalMemorySize(); assertTrue(tester.memAvailable == 5400417792L); assertTrue(tester.cpuUsage >= 0.1); }
@Test (timeout = 20000) public void errorInGetSystemInfo() { WindowsResourceCalculatorPluginTester tester = new WindowsResourceCalculatorPluginTester(); tester.infoStr = null; tester.getAvailablePhysicalMemorySize(); }