// check that no listener is invoked by now
assertNotListenerStartInvoked(pi);
assertNotListenerEndInvoked(pi);
// the process is waiting before the message event
Job job = managementService.createJobQuery().singleResult();
assertNotNull(job);
// execute job to get to the message event
executeAvailableJobs();
// now we need to trigger the message to proceed
runtimeService.correlateMessage("testMessage1");
// now the listener should be invoked
assertListenerStartInvoked(pi);
assertListenerEndInvoked(pi);
// and now the process is waiting *after* the intermediate catch event
job = managementService.createJobQuery().singleResult();
assertNotNull(job);
// after executing the waiting job, the process instance will end
managementService.executeJob(job.getId());
assertProcessEnded(pi.getId());
}