OpenPatentWebServiceFacadeFactory implements ServiceFacadeFactory<PatentServiceFacade> { protected static String buildCredential(String key, String secret) { return Base64.getEncoder().encodeToString((key + ':' + secret).getBytes(DEFAULT_CHARSET)); }  @Override PatentServiceFacade instantiate(Map<String, String> conf); static final Charset DEFAULT_CHARSET; static final String PARAM_CONSUMER_KEY; static final String PARAM_CONSUMER_SECRET; static final String PARAM_SERVICE_ENDPOINT_AUTH_HOST; static final String PARAM_SERVICE_ENDPOINT_AUTH_PORT; static final String PARAM_SERVICE_ENDPOINT_AUTH_SCHEME; static final String PARAM_SERVICE_ENDPOINT_AUTH_URI_ROOT; static final String PARAM_SERVICE_ENDPOINT_OPS_HOST; static final String PARAM_SERVICE_ENDPOINT_OPS_PORT; static final String PARAM_SERVICE_ENDPOINT_OPS_SCHEME; static final String PARAM_SERVICE_ENDPOINT_OPS_URI_ROOT; static final String PARAM_SERVICE_ENDPOINT_READ_TIMEOUT; static final String PARAM_SERVICE_ENDPOINT_CONNECTION_TIMEOUT; static final String PARAM_SERVICE_ENDPOINT_THROTTLE_SLEEP_TIME; static final String PARAM_SERVICE_ENDPOINT_RETRIES_COUNT; }
@Test public void testBuildCredential() { String key = "someKey"; String secret = "someSecret"; String credential = OpenPatentWebServiceFacadeFactory.buildCredential(key, secret); assertNotNull(credential); assertEquals(Base64.getEncoder().encodeToString((key+':'+secret).getBytes(StandardCharsets.UTF_8)), credential); }