@Test
public void failsAddNewJobIfTooManyJobsInProgress() throws Exception {

    asynchronousJobPool.addJob(resource, methodDescriptor, new Object[]{});
    asynchronousJobPool.addJob(resource, methodDescriptor, new Object[]{});
    thrown.expect(AsynchronousJobRejectedException.class);
    thrown.expectMessage("Can't accept new asynchronous request. Too many asynchronous jobs in progress");
    asynchronousJobPool.addJob(resource, methodDescriptor, new Object[]{});
}