use of com.hazelcast.test.ExpectedRuntimeException in project hazelcast by hazelcast.
the class OperationRunnerImplTest method runOperation_whenRunThrowsException.
@Test
public void runOperation_whenRunThrowsException() {
Operation op = new Operation() {
@Override
public void run() throws Exception {
throw new ExpectedRuntimeException();
}
};
op.setOperationResponseHandler(responseHandler);
op.setPartitionId(operationRunner.getPartitionId());
operationRunner.run(op);
verify(responseHandler).sendResponse(same(op), any(ExpectedRuntimeException.class));
}
use of com.hazelcast.test.ExpectedRuntimeException in project hazelcast by hazelcast.
the class PacketDispatcherTest method whenProblemHandlingPacket_thenSwallowed.
// when one of the handlers throws an exception, the exception is logged but not rethrown
@Test
public void whenProblemHandlingPacket_thenSwallowed() {
Packet packet = new Packet().setPacketType(Packet.Type.OPERATION);
Mockito.doThrow(new ExpectedRuntimeException()).when(operationExecutor).accept(packet);
dispatcher.accept(packet);
}
use of com.hazelcast.test.ExpectedRuntimeException in project hazelcast by hazelcast.
the class OperationServiceImpl_invokeOnPartitionTest method whenExceptionThrownInOperationRun.
@Test
public void whenExceptionThrownInOperationRun() {
DummyOperation operation = new DummyOperation(new ExceptionThrowingCallable());
InternalCompletableFuture<String> invocation = operationService.invokeOnPartition(null, operation, getPartitionId(remote));
try {
invocation.joinInternal();
fail();
} catch (ExpectedRuntimeException expected) {
}
}
use of com.hazelcast.test.ExpectedRuntimeException in project hazelcast-jet by hazelcast.
the class JobTest method when_jobIsFailed_then_jobStatusIsCompletedEventually.
@Test
public void when_jobIsFailed_then_jobStatusIsCompletedEventually() throws InterruptedException {
// Given
DAG dag = new DAG().vertex(new Vertex("test", new MockPS((DistributedSupplier<Processor>) () -> new MockP().setCompleteError(new ExpectedRuntimeException()), NODE_COUNT)));
// When
Job job = instance1.newJob(dag);
// Then
try {
job.getFuture().get();
fail();
} catch (ExecutionException expected) {
assertEquals(FAILED, job.getStatus());
}
}
use of com.hazelcast.test.ExpectedRuntimeException in project hazelcast-jet by hazelcast.
the class JobTest method when_jobIsFailed_then_trackedJobCanQueryJobResult.
@Test
public void when_jobIsFailed_then_trackedJobCanQueryJobResult() throws InterruptedException {
// Given
DAG dag = new DAG().vertex(new Vertex("test", new MockPS((DistributedSupplier<Processor>) () -> new MockP().setCompleteError(new ExpectedRuntimeException()), NODE_COUNT)));
// When
instance1.newJob(dag);
Collection<Job> trackedJobs = instance2.getJobs();
assertEquals(1, trackedJobs.size());
Job trackedJob = trackedJobs.iterator().next();
// Then
try {
trackedJob.getFuture().get();
fail();
} catch (ExecutionException expected) {
assertEquals(FAILED, trackedJob.getStatus());
}
}
Aggregations