ConfigureCouchbase { @SuppressWarnings("rawtypes") @Bean(name = "couchbaseDistributedMap") public CouchbaseDistributedMapClient simpleCouchbaseClient() throws IOException, URISyntaxException { if (couchbaseClientEnabled) { return new CouchbaseDistributedMapClient( couchbaseClient()); } else { return new CouchbaseDistributedMapClient( null); } }  @SuppressWarnings("rawtypes") @Bean(name = "couchbaseDistributedMap") CouchbaseDistributedMapClient simpleCouchbaseClient(); @Bean(name = "couchbaseClient") CouchbaseClient couchbaseClient(); @Bean CouchbaseManifestComparator couchbaseManifestComparator();  }
@Test public void createDistributedCacheMemcachedOff() throws IOException, URISyntaxException { config.setCouchbaseClientEnabled(false); DistributedMap<Object> cache = config.simpleCouchbaseClient(); assertThat(cache.get("hello"), is(Optional.empty())); }
@Test(expected = NullPointerException.class) public void createDistributedCache() throws IOException, URISyntaxException { memcachedOn(); config.simpleCouchbaseClient(); fail("Memcache should throw exception"); }