ProxySettings { @Override public String toString() { return "ProxySettings{" + ", proxyHost='" + proxyHost + '\'' + ", proxyPort=" + proxyPort + '}'; } private  ProxySettings(String proxyHost, int proxyPort); static ProxySettings noProxy(); static ProxySettings useProxy(String host, int port); static ProxySettings fromConfig(boolean useProxy, String host, int port); boolean isProxyUse(); String getProxyHost(); int getProxyPort(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static final String UNDEFINED_HOST; static final int UNDEFINED_PORT; }
@Test public void testToString() { ProxySettings settings = ProxySettings.useProxy(PROXY_HOST, PROXY_PORT); String s = settings.toString(); assertThat(s).contains("proxyHost='" + PROXY_HOST); assertThat(s).contains("proxyPort=" + PROXY_PORT); }