@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/receivetask/ReceiveTaskTest.multiParallelReceiveTaskBoundary.bpmn20.xml")
public void testSupportsMessageEventReceivedOnParallelMultiInstanceWithBoundaryEventReceived() {
// given: a process instance waiting in two receive tasks
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testProcess");
// expect: there are three message event subscriptions
assertEquals(3, getEventSubscriptionList().size());
// expect: there is one message event subscription for the boundary event
List<EventSubscription> subscriptions = getEventSubscriptionList("cancel");
assertEquals(1, subscriptions.size());
EventSubscription subscription = subscriptions.get(0);
// then: we can trigger the boundary subscription to cancel both tasks
runtimeService.messageEventReceived(subscription.getEventName(), subscription.getExecutionId());
// expect: all subscriptions are removed (receive task subscriptions too)
assertEquals(0, getEventSubscriptionList().size());
// expect: this ends the process instance
assertProcessEnded(processInstance.getId());
}