@Test
public void testConnectionException() throws ProtocolAdapterException {

    final List<ActionDto> actionDtoList = this.makeActions();
    final BundleMessagesRequestDto dto = new BundleMessagesRequestDto(actionDtoList);
    // Set the point where to throw the ConnectionException
    this.getStub(FindEventsRequestDto.class)
            .failWithRuntimeException(new ConnectionException("Connection Exception thrown!"));
    try {
        // Execute all the actions
        this.callExecutors(dto);
        fail("A ConnectionException should be thrown");
    } catch (final ConnectionException connectionException) {
        // The execution is stopped. The number of responses is equal to the
        // actions performed before the point the exception is thrown. See
        // also the order of the ArrayList in method 'makeActions'.
        assertThat(dto.getAllResponses().size()).isEqualTo(8);
    }
    // Reset the point where the exception was thrown.
    this.getStub(FindEventsRequestDto.class).failWithRuntimeException(null);
    try {
        // Execute the remaining actions
        this.callExecutors(dto);
        assertThat(actionDtoList.size()).isEqualTo(dto.getAllResponses().size());
    } catch (final ConnectionException connectionException) {
        fail("A ConnectionException should not have been thrown.");
    }
}