### Question:
Utils { public static void setProxyIfRequired(String httpProxyUrl, String httpsProxyUrl, String nonProxyHosts) throws IOException { if (!isEmptyString(httpProxyUrl)) { setSystemProxy(httpProxyUrl, Constants.HTTP); } if (!isEmptyString(httpsProxyUrl)) { setSystemProxy(httpsProxyUrl, Constants.HTTPS); } if (!isEmptyString(nonProxyHosts)) { System.setProperty("http.nonProxyHosts", nonProxyHosts.replaceAll("[,;]", "|")); } } private  Utils(); static void copyResourceAsFile(String resourcePath, String destPath, boolean markExec); static void copyLocalFile(Path sourcePath, Path destPath, boolean markExec); static void copyLocalDirectory(Path sourcePath, Path destPath, boolean markExec); static void setProxyIfRequired(String httpProxyUrl, String httpsProxyUrl, String nonProxyHosts); static String writeDockerfile(String destPath, String template, DockerfileOptions options, boolean dryRun); static void writeResolvedFiles(List<Path> paths, List<Object> options); static void deleteFilesRecursively(String pathDir); static int compareVersions(String thisVersion, String otherVersion); static boolean isEmptyString(String s); static Properties getBaseImageProperties(String dockerImage, String tmpDir); static String findProxyUrl(String proxyUrl, String protocol); static String getPasswordFromInputs(String passwordStr, Path passwordFile, String passwordEnv); static String getEnvironmentProperty(String name); static String getBuildWorkingDir(); static String getOpatchVersionFromZip(String fileName); static boolean validatePatchIds(List<String> patches, boolean rigid); static void setOracleHome(List<Path> responseFiles, DockerfileOptions options); static void setInventoryLocation(String inventoryLocFile, DockerfileOptions options); static String getMessage(@PropertyKey(resourceBundle = "ImageTool") String key, Object... params); static void removeIntermediateDockerImages(String buildId); static String getPsuVersion(String lsInventory); @SafeVarargs static List<T> list(Collection<? extends T> start, T... elements);  }### Answer:
@Test void settingProxy() throws IOException { String host = "www-proxy.mycompany.com"; String port = "80"; String simpleProxy = host + ":" + port; String simpleHttp = "http: String simpleHttps = "https: Utils.setProxyIfRequired(simpleHttp, simpleHttps, ""); assertEquals(host, System.getProperty("http.proxyHost")); assertEquals(port, System.getProperty("http.proxyPort")); assertEquals(host, System.getProperty("https.proxyHost")); assertEquals(port, System.getProperty("https.proxyPort")); Utils.setProxyIfRequired(simpleHttp, simpleHttp, ""); assertEquals(host, System.getProperty("http.proxyHost")); assertEquals(port, System.getProperty("http.proxyPort")); assertEquals(host, System.getProperty("https.proxyHost")); assertEquals(port, System.getProperty("https.proxyPort")); Utils.setProxyIfRequired(simpleProxy, simpleProxy, ""); assertEquals(host, System.getProperty("http.proxyHost")); assertEquals(port, System.getProperty("http.proxyPort")); assertEquals(host, System.getProperty("https.proxyHost")); assertEquals(port, System.getProperty("https.proxyPort")); }