S3Utils { static ClientConfiguration getClientConfiguration(ProxyInfoProvider proxyInfoProvider) { ClientConfiguration clientConfiguration = new ClientConfiguration(); if (proxyInfoProvider != null) { ProxyInfo proxyInfo = proxyInfoProvider.getProxyInfo("s3"); if (proxyInfo != null) { clientConfiguration.withProxyHost(proxyInfo.getHost()).withProxyPort(proxyInfo.getPort()); } } return clientConfiguration; } private  S3Utils();   }
@Test public void getClientConfiguration() { when(this.proxyInfoProvider.getProxyInfo("s3")).thenReturn(this.proxyInfo); when(this.proxyInfo.getHost()).thenReturn("foo"); when(this.proxyInfo.getPort()).thenReturn(PORT); ClientConfiguration clientConfiguration = S3Utils.getClientConfiguration(this.proxyInfoProvider); assertEquals("foo", clientConfiguration.getProxyHost()); assertEquals(100, clientConfiguration.getProxyPort()); }
@Test public void getClientConfigurationNoProxyInfoProvider() { ClientConfiguration clientConfiguration = S3Utils.getClientConfiguration(null); assertNull(clientConfiguration.getProxyHost()); assertEquals(-1, clientConfiguration.getProxyPort()); }
@Test public void getClientConfigurationNoProxyInfo() { ClientConfiguration clientConfiguration = S3Utils.getClientConfiguration(this.proxyInfoProvider); assertNull(clientConfiguration.getProxyHost()); assertEquals(-1, clientConfiguration.getProxyPort()); }