CouchbaseManager { protected static URI checkAndGetURI(String hostOrKey) { URI uri = URI.create(hostOrKey); if (!StringUtils.isEmpty(uri.getScheme())) { String userInfo = uri.getUserInfo(); if (StringUtils.isEmpty(userInfo)) { throw new RuntimeException("URI must include credentials otherwise use apoc.couchbase.<key>.* configuration"); } String[] infoTokens = userInfo.split(":"); if (infoTokens.length != 2) { throw new RuntimeException("Credentials must be defined according URI specifications"); } return uri; } return null; } protected  CouchbaseManager(); static CouchbaseConnection getConnection(String hostOrKey, String bucketName); static String getConfig(String key);  }
@Test public void testURIFailsWithExceptionIfNotCredentials() { exceptionRule.expect(RuntimeException.class); exceptionRule.expectMessage("URI must include credentials otherwise use apoc.couchbase.<key>.* configuration"); CouchbaseManager.checkAndGetURI("couchbase: }
@Test public void testURIFailsWithExceptionIfMissingCredentialsFormat() { exceptionRule.expect(RuntimeException.class); exceptionRule.expectMessage("Credentials must be defined according URI specifications"); CouchbaseManager.checkAndGetURI("couchbase: }