use of com.hazelcast.client.UndefinedErrorCodeException in project hazelcast by hazelcast.
the class ClientAtomicLongTest method alter_whenException.
@Test
public void alter_whenException() {
IAtomicLong ref = client.getAtomicLong("alter_whenException");
ref.set(10);
try {
ref.alter(new FailingFunction());
fail();
} catch (UndefinedErrorCodeException expected) {
assertEquals(expected.getOriginClassName(), ExpectedRuntimeException.class.getName());
}
assertEquals(10, ref.get());
}
use of com.hazelcast.client.UndefinedErrorCodeException in project hazelcast by hazelcast.
the class ClientAtomicLongTest method alterAndGet_whenException.
@Test
public void alterAndGet_whenException() {
IAtomicLong ref = client.getAtomicLong("alterAndGet_whenException");
ref.set(10);
try {
ref.alterAndGet(new FailingFunction());
fail();
} catch (UndefinedErrorCodeException expected) {
assertEquals(expected.getOriginClassName(), ExpectedRuntimeException.class.getName());
}
assertEquals(10, ref.get());
}
use of com.hazelcast.client.UndefinedErrorCodeException in project hazelcast by hazelcast.
the class ClientAtomicLongTest method applyAsync_whenException.
@Test
public void applyAsync_whenException() {
IAtomicLong ref = client.getAtomicLong("applyAsync_whenException");
ref.set(1);
try {
ICompletableFuture<Long> future = ref.applyAsync(new FailingFunction());
future.get();
} catch (InterruptedException e) {
fail();
} catch (ExecutionException e) {
assertEquals(e.getCause().getClass(), UndefinedErrorCodeException.class);
assertEquals(((UndefinedErrorCodeException) e.getCause()).getOriginClassName(), ExpectedRuntimeException.class.getName());
}
assertEquals(1, ref.get());
}
use of com.hazelcast.client.UndefinedErrorCodeException in project hazelcast by hazelcast.
the class ClientAtomicLongTest method alterAndGetAsync_whenException.
@Test
public void alterAndGetAsync_whenException() {
IAtomicLong ref = client.getAtomicLong("alterAndGetAsync_whenException");
ref.set(10);
try {
ICompletableFuture<Long> future = ref.alterAndGetAsync(new FailingFunction());
future.get();
} catch (InterruptedException e) {
fail();
} catch (ExecutionException e) {
assertEquals(e.getCause().getClass(), UndefinedErrorCodeException.class);
assertEquals(((UndefinedErrorCodeException) e.getCause()).getOriginClassName(), ExpectedRuntimeException.class.getName());
}
assertEquals(10, ref.get());
}
use of com.hazelcast.client.UndefinedErrorCodeException in project hazelcast by hazelcast.
the class ClientAtomicLongTest method getAndAlterAsync_whenException.
@Test
public void getAndAlterAsync_whenException() {
IAtomicLong ref = client.getAtomicLong("getAndAlterAsync_whenException");
ref.set(10);
try {
ICompletableFuture<Long> future = ref.getAndAlterAsync(new FailingFunction());
future.get();
fail();
} catch (InterruptedException e) {
assertEquals(e.getCause().getClass().getName(), UndefinedErrorCodeException.class.getName());
assertEquals(((UndefinedErrorCodeException) e.getCause()).getOriginClassName(), ExpectedRuntimeException.class.getName());
} catch (ExecutionException e) {
assertEquals(e.getCause().getClass().getName(), UndefinedErrorCodeException.class.getName());
assertEquals(((UndefinedErrorCodeException) e.getCause()).getOriginClassName(), ExpectedRuntimeException.class.getName());
}
assertEquals(10, ref.get());
}
Aggregations