Search in sources :

Example 1 with ExistsResult

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());
}
Also used : ExistsResult(com.couchbase.client.java.kv.ExistsResult) MutationResult(com.couchbase.client.java.kv.MutationResult) IgnoreWhen(com.couchbase.client.test.IgnoreWhen) JavaIntegrationTest(com.couchbase.client.java.util.JavaIntegrationTest) Test(org.junit.jupiter.api.Test)

Aggregations

ExistsResult (com.couchbase.client.java.kv.ExistsResult)1 MutationResult (com.couchbase.client.java.kv.MutationResult)1 JavaIntegrationTest (com.couchbase.client.java.util.JavaIntegrationTest)1 IgnoreWhen (com.couchbase.client.test.IgnoreWhen)1 Test (org.junit.jupiter.api.Test)1