use of com.couchbase.client.java.Bucket in project samza by apache.
the class TestCouchbaseTableReadFunction method testGetAsyncFailedToDeserialize.
@Test
public void testGetAsyncFailedToDeserialize() {
String key = "key";
Bucket bucket = mock(Bucket.class);
AsyncBucket asyncBucket = mock(AsyncBucket.class);
CouchbaseTableReadFunction readFunction = createAndInit(String.class, new StringSerde(), bucket, asyncBucket);
when(asyncBucket.get(eq(key), anyObject(), anyLong(), any(TimeUnit.class))).thenReturn(Observable.just(BinaryDocument.create(key, null)));
assertTrue(readFunction.getAsync(key).isCompletedExceptionally());
}
use of com.couchbase.client.java.Bucket in project samza by apache.
the class TestCouchbaseTableReadFunction method testGetAsyncNonExistingKey.
@Test
public void testGetAsyncNonExistingKey() throws Exception {
String key = "NonExistingKey";
Bucket bucket = mock(Bucket.class);
AsyncBucket asyncBucket = mock(AsyncBucket.class);
CouchbaseTableReadFunction readFunction = createAndInit(String.class, new StringSerde(), bucket, asyncBucket);
when(asyncBucket.get(eq(key), anyObject(), anyLong(), any(TimeUnit.class))).thenReturn(Observable.empty());
assertNull(readFunction.getAsync(key).get());
}
Aggregations