Source:
<code><START> public void executeListener() { <END> ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration().buildProcessEngine(); processEngine.getRepositoryService().createDeployment().addBpmnModel("simpleTestProcess.bpmn", getSimpleTestProcess()).deploy(); processEngine.getRuntimeService().addEventListener(eventListener); processEngine.getRuntimeService().startProcessInstanceByKey("simpleTestProcess"); ProcessEngineEvent[] events = (ProcessEngineEvent[]) MockMessageChannel.messageResult.getPayload(); assertThat(events.length).isEqualTo(7); assertThat(events[0].getClass()).isEqualTo(ProcessStartedEventImpl.class); assertThat(events[1].getClass()).isEqualTo(ActivityStartedEventImpl.class); assertThat(events[2].getClass()).isEqualTo(ActivityCompletedEventImpl.class); assertThat(events[3].getClass()).isEqualTo(SequenceFlowTakenEventImpl.class); assertThat(events[4].getClass()).isEqualTo(ActivityStartedEventImpl.class); assertThat(events[5].getClass()).isEqualTo(ActivityCompletedEventImpl.class); assertThat(events[6].getClass()).isEqualTo(ProcessCompletedEventImpl.class); }</code><technical_language>Perfect! Tank much</technical_language>

Target:
public void executeListener() throws Exception { ProcessEngine processEngine = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration().buildProcessEngine(); deploy("SimpleProcess", processEngine); deploy("RollbackProcess", processEngine); deploy("AsyncErrorProcess", processEngine); processEngine.getRuntimeService().addEventListener(eventListener); processEngine.getRuntimeService().startProcessInstanceByKey("simpleProcess"); ProcessEngineEvent[] events = (ProcessEngineEvent[]) MockMessageChannel.messageResult.getPayload(); assertThat(events.length).isEqualTo(7); assertThat(events[0].getClass()).isEqualTo(ProcessStartedEventImpl.class); assertThat(events[1].getClass()).isEqualTo(ActivityStartedEventImpl.class); assertThat(events[2].getClass()).isEqualTo(ActivityCompletedEventImpl.class); assertThat(events[3].getClass()).isEqualTo(SequenceFlowTakenEventImpl.class); assertThat(events[4].getClass()).isEqualTo(ActivityStartedEventImpl.class); assertThat(events[5].getClass()).isEqualTo(ActivityCompletedEventImpl.class); assertThat(events[6].getClass()).isEqualTo(ProcessCompletedEventImpl.class); MockMessageChannel.messageResult = null; try { processEngine.getRuntimeService().startProcessInstanceByKey("rollbackProcess"); } catch (Exception e) { } assertThat(MockMessageChannel.messageResult).isEqualTo(null); MockMessageChannel.messageResult = null; try { processEngine.getRuntimeService().startProcessInstanceByKey("asyncErrorProcess"); } catch (Exception e) { } assertThat(MockMessageChannel.messageResult).isNotNull(); events = (ProcessEngineEvent[]) MockMessageChannel.messageResult.getPayload(); assertThat(events.length).isEqualTo(4); assertThat(events[0].getClass()).isEqualTo(ProcessStartedEventImpl.class); assertThat(events[1].getClass()).isEqualTo(ActivityStartedEventImpl.class); assertThat(events[2].getClass()).isEqualTo(ActivityCompletedEventImpl.class); assertThat(events[3].getClass()).isEqualTo(SequenceFlowTakenEventImpl.class); }