DefaultCouchbaseBucketManagerFactory implements CouchbaseBucketManagerFactory { @Override public <T> Set<T> getSet(String bucketName, Class<T> clazz) { requireNonNull(bucketName, "bucketName is required"); requireNonNull(clazz, "valueValue is required"); if (JsonValueCheck.checkType(clazz) && !JsonValue.class.isAssignableFrom(clazz)) { return new CouchbaseArraySet<>(bucketName + SET, getBucket(bucketName)); } else { return new CouchbaseSet<>(getBucket(bucketName), bucketName, clazz); } } DefaultCouchbaseBucketManagerFactory(CouchbaseCluster couchbaseCluster, String user, String password); @Override CouchbaseBucketManager getBucketManager(String bucketName); @Override Map<K, V> getMap(String bucketName, Class<K> keyValue, Class<V> valueValue); @Override Map<K, V> getMap(String bucketName, String key, Class<K> keyValue, Class<V> valueValue); @Override Queue<T> getQueue(String bucketName, Class<T> clazz); @Override Set<T> getSet(String bucketName, Class<T> clazz); @Override List<T> getList(String bucketName, Class<T> clazz); @Override Queue<T> getQueue(String bucketName, String key, Class<T> clazz); @Override Set<T> getSet(String bucketName, String key, Class<T> clazz); @Override List<T> getList(String bucketName, String key, Class<T> clazz); @Override void close();  }
@Test public void shouldReturnSet() { assertTrue(factory.getSet("jnosql", String.class) instanceof CouchbaseArraySet); assertTrue(factory.getSet("jnosql", User.class) instanceof CouchbaseSet); assertTrue(factory.getSet("jnosql", "jnosql", User.class) instanceof CouchbaseSet); assertTrue(factory.getSet("jnosql", "jnosql", String.class) instanceof CouchbaseArraySet); }