Search in sources :

Example 1 with IAtomicReference

use of com.hazelcast.cp.IAtomicReference in project hazelcast by hazelcast.

the class AbstractAtomicRefBasicTest method test_get_whenRefIsException.

@Test
public void test_get_whenRefIsException() {
    IAtomicReference atomicRef = createAtomicRef(randomName());
    RuntimeException value = new RuntimeException("boom");
    atomicRef.set(value);
    assertInstanceOf(RuntimeException.class, atomicRef.get());
    assertEquals(value.getMessage(), ((RuntimeException) atomicRef.get()).getMessage());
}
Also used : IAtomicReference(com.hazelcast.cp.IAtomicReference) Test(org.junit.Test)

Example 2 with IAtomicReference

use of com.hazelcast.cp.IAtomicReference in project hazelcast by hazelcast.

the class AbstractAtomicRefBasicTest method test_getAsync_whenRefIsException.

@Test
public void test_getAsync_whenRefIsException() throws ExecutionException, InterruptedException {
    IAtomicReference atomicRef = createAtomicRef(randomName());
    RuntimeException value = new RuntimeException("boom");
    atomicRef.set(value);
    assertInstanceOf(RuntimeException.class, atomicRef.getAsync().toCompletableFuture().get());
    assertEquals(value.getMessage(), ((RuntimeException) atomicRef.getAsync().toCompletableFuture().get()).getMessage());
}
Also used : IAtomicReference(com.hazelcast.cp.IAtomicReference) Test(org.junit.Test)

Aggregations

IAtomicReference (com.hazelcast.cp.IAtomicReference)2 Test (org.junit.Test)2