### Question:
WinRegistry { public static boolean setApiServerPort(int port) { if (!NetUtils.isValidPort(port)) { throw new IllegalArgumentException("Port out of range (port is: " + port + ")"); } if (!OsUtils.isWindows()) { throw new RuntimeException("Cannot set ApiServerPort in registry (not running on Windows)."); } ProcessBuilder builder = new ProcessBuilder(); builder.command("reg", "ADD", "HKCU\\Software\\PeerWasp", "/v", "api_server_port", "/t", "REG_DWORD", "/d", String.format("%d", port), "/f" ); if (!ExecuteProcessUtils.executeCommand(builder, null)) { logger.warn("Could not set the port in the registry"); return false; } return true; } private  WinRegistry(); static boolean setApiServerPort(int port); static boolean setRootPath(Path rootPath);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testNegativeApiServerPort() { WinRegistry.setApiServerPort(-1); }
@Test(expected = IllegalArgumentException.class) public void testTooBigApiServerPort() { WinRegistry.setApiServerPort(65536); }
@Test public void testSetApiServerPort() { for (int i = 0; i < NUMBER_ITERATIONS; ++i) { int port = RandomUtils.nextInt(0, 65536); WinRegistry.setApiServerPort(port); assertPort(port); } }