use of com.hazelcast.client.UndefinedErrorCodeException in project hazelcast by hazelcast.
the class ClientAtomicLongTest method getAndAlter_whenException.
@Test
public void getAndAlter_whenException() {
IAtomicLong ref = client.getAtomicLong("getAndAlter_whenException");
ref.set(10);
try {
ref.getAndAlter(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 alterAsync_whenException.
@Test
public void alterAsync_whenException() {
IAtomicLong ref = client.getAtomicLong("alterAsync_whenException");
ref.set(10);
try {
ICompletableFuture<Void> future = ref.alterAsync(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 apply_whenException.
@Test
public void apply_whenException() {
IAtomicLong ref = client.getAtomicLong("apply_whenException");
ref.set(1);
try {
ref.apply(new FailingFunction());
fail();
} catch (UndefinedErrorCodeException expected) {
assertEquals(expected.getOriginClassName(), ExpectedRuntimeException.class.getName());
}
assertEquals(1, ref.get());
}
use of com.hazelcast.client.UndefinedErrorCodeException in project hazelcast by hazelcast.
the class ClientExceptionFactory method createException.
private Throwable createException(int errorCode, String className, String message, Throwable cause) {
ExceptionFactory exceptionFactory = intToFactory.get(errorCode);
Throwable throwable;
if (exceptionFactory == null) {
throwable = new UndefinedErrorCodeException(message, className);
} else {
throwable = exceptionFactory.createException(message, cause);
}
return throwable;
}
Aggregations