@Test
public void shouldReportMissingProxyHostnameDefinition() throws Exception {
// given
LoggerForTesting logger = new LoggerForTesting(LoggingLevel.DEBUG);
setField(systemPropertiesConfig, "logger", logger);
Properties props = new Properties();
props.put(CUSTOM_PROXY_PREFIX + DOT + "myProxy1" + DOT + "hostname", "www.myhost1.com");
props.put(CUSTOM_PROXY_PREFIX + DOT + "myProxy1" + DOT + "port", "8080");
props.put(CUSTOM_PROXY_PREFIX + DOT + "myProxy1" + DOT + "type", "http");
// no type definition for myProxy2
props.put(CUSTOM_PROXY_PREFIX + DOT + "myProxy2" + DOT + "port", "7070");
props.put(CUSTOM_PROXY_PREFIX + DOT + "myProxy2" + DOT + "port", "7070");
props.put("someprop", "something");
props.put("someotherprop", "something");
systemPropertiesMock.setProperties(props);
// when
List<ProxyConfig> customProxies = systemPropertiesConfig.getCustomProxies();
// then
assertThat(customProxies, notNullValue());
assertThat(customProxies.size(), equalTo(1));
assertThat(customProxies, hasItem(new ProxyConfig("www.myhost1.com", "8080", "http", EMPTY_SET)));
assertThat(logger.getLogBuffer(),
containsString("Missing system property defining hostname for custom proxy: myProxy2"));
}