use of com.couchbase.client.java.kv.ExistsResult in project couchbase-jvm-clients by couchbase.
the class KeyValueIntegrationTest method exists.
/**
* Mock does not support Get Meta, so we need to ignore it there.
*/
@Test
@IgnoreWhen(clusterTypes = ClusterType.MOCKED)
void exists() {
String id = UUID.randomUUID().toString();
assertFalse(collection.exists(id).exists());
MutationResult insertResult = collection.insert(id, "Hello, World");
assertTrue(insertResult.cas() != 0);
ExistsResult existsResult = collection.exists(id);
assertEquals(insertResult.cas(), existsResult.cas());
assertTrue(existsResult.exists());
assertFalse(collection.exists("some_id").exists());
}
Aggregations