### Question:
MavenSettingsProxyProvider { @VisibleForTesting static void setProxyProperties(Proxy proxy) { String protocol = proxy.getProtocol(); setPropertySafe(protocol + ".proxyHost", proxy.getHost()); setPropertySafe(protocol + ".proxyPort", String.valueOf(proxy.getPort())); setPropertySafe(protocol + ".proxyUser", proxy.getUsername()); setPropertySafe(protocol + ".proxyPassword", proxy.getPassword()); setPropertySafe("http.nonProxyHosts", proxy.getNonProxyHosts()); }    }### Answer:
@Test public void testSetProxyProperties() { Proxy httpProxy = new Proxy(); httpProxy.setProtocol("http"); httpProxy.setHost("host"); httpProxy.setPort(1080); httpProxy.setUsername("user"); httpProxy.setPassword("pass"); httpProxy.setNonProxyHosts("non proxy hosts"); MavenSettingsProxyProvider.setProxyProperties(httpProxy); Assert.assertEquals("host", System.getProperty("http.proxyHost")); Assert.assertEquals("1080", System.getProperty("http.proxyPort")); Assert.assertEquals("user", System.getProperty("http.proxyUser")); Assert.assertEquals("pass", System.getProperty("http.proxyPassword")); Assert.assertEquals("non proxy hosts", System.getProperty("http.nonProxyHosts")); Proxy httpsProxy = new Proxy(); httpsProxy.setProtocol("https"); httpsProxy.setHost("https host"); httpsProxy.setPort(1443); httpsProxy.setUsername("https user"); httpsProxy.setPassword("https pass"); MavenSettingsProxyProvider.setProxyProperties(httpsProxy); Assert.assertEquals("https host", System.getProperty("https.proxyHost")); Assert.assertEquals("1443", System.getProperty("https.proxyPort")); Assert.assertEquals("https user", System.getProperty("https.proxyUser")); Assert.assertEquals("https pass", System.getProperty("https.proxyPassword")); }
@Test public void testSetProxyProperties_someValuesUndefined() { Proxy httpProxy = new Proxy(); httpProxy.setProtocol("http"); httpProxy.setHost("http: MavenSettingsProxyProvider.setProxyProperties(httpProxy); Assert.assertEquals("http: Assert.assertNull(System.getProperty("http.proxyUser")); Assert.assertNull(System.getProperty("http.proxyPassword")); Assert.assertNull(System.getProperty("http.nonProxyHosts")); Proxy httpsProxy = new Proxy(); httpsProxy.setProtocol("https"); httpsProxy.setUsername("https user"); httpsProxy.setPassword("https pass"); MavenSettingsProxyProvider.setProxyProperties(httpsProxy); Assert.assertNull(System.getProperty("https.proxyHost")); Assert.assertEquals("https user", System.getProperty("https.proxyUser")); Assert.assertEquals("https pass", System.getProperty("https.proxyPassword")); }