@Test public void testBuildHeader() { assertTrue(buildClientVersionHeader("", false).isEmpty()); assertTrue(buildClientVersionHeader(null, false).isEmpty()); assertThat(buildClientVersionHeader("geth 1.4.19", true), equalTo(Collections.singletonMap( "Infura-Ethereum-Preferred-Client", "geth 1.4.19"))); assertThat(buildClientVersionHeader("geth 1.4.19", false), is(Collections.singletonMap( "Infura-Ethereum-Preferred-Client", "geth 1.4.19; required=false"))); }
static Map<String, String> buildClientVersionHeader(String clientVersion, boolean required) { if (clientVersion == null || clientVersion.equals("")) { return Collections.emptyMap(); } if (required) { return Collections.singletonMap(INFURA_ETHEREUM_PREFERRED_CLIENT, clientVersion); } else { return Collections.singletonMap( INFURA_ETHEREUM_PREFERRED_CLIENT, clientVersion + "; required=false"); } }
InfuraHttpService extends HttpService { static Map<String, String> buildClientVersionHeader(String clientVersion, boolean required) { if (clientVersion == null || clientVersion.equals("")) { return Collections.emptyMap(); } if (required) { return Collections.singletonMap(INFURA_ETHEREUM_PREFERRED_CLIENT, clientVersion); } else { return Collections.singletonMap( INFURA_ETHEREUM_PREFERRED_CLIENT, clientVersion + "; required=false"); } } }
InfuraHttpService extends HttpService { static Map<String, String> buildClientVersionHeader(String clientVersion, boolean required) { if (clientVersion == null || clientVersion.equals("")) { return Collections.emptyMap(); } if (required) { return Collections.singletonMap(INFURA_ETHEREUM_PREFERRED_CLIENT, clientVersion); } else { return Collections.singletonMap( INFURA_ETHEREUM_PREFERRED_CLIENT, clientVersion + "; required=false"); } } InfuraHttpService(String url, String clientVersion, boolean required);  InfuraHttpService(String url, String clientVersion);  InfuraHttpService(String url); }
InfuraHttpService extends HttpService { static Map<String, String> buildClientVersionHeader(String clientVersion, boolean required) { if (clientVersion == null || clientVersion.equals("")) { return Collections.emptyMap(); } if (required) { return Collections.singletonMap(INFURA_ETHEREUM_PREFERRED_CLIENT, clientVersion); } else { return Collections.singletonMap( INFURA_ETHEREUM_PREFERRED_CLIENT, clientVersion + "; required=false"); } } InfuraHttpService(String url, String clientVersion, boolean required);  InfuraHttpService(String url, String clientVersion);  InfuraHttpService(String url);  }
InfuraHttpService extends HttpService { static Map<String, String> buildClientVersionHeader(String clientVersion, boolean required) { if (clientVersion == null || clientVersion.equals("")) { return Collections.emptyMap(); } if (required) { return Collections.singletonMap(INFURA_ETHEREUM_PREFERRED_CLIENT, clientVersion); } else { return Collections.singletonMap( INFURA_ETHEREUM_PREFERRED_CLIENT, clientVersion + "; required=false"); } } InfuraHttpService(String url, String clientVersion, boolean required);  InfuraHttpService(String url, String clientVersion);  InfuraHttpService(String url);   }