@Deployment(resources = {"org/camunda/bpm/engine/test/api/runtime/ProcessInstanceSuspensionTest.testMessageEventReceiveFailAfterSuspend.bpmn20.xml"})
public void testMessageEventReceiveFailAfterSuspendByProcessDefinitionKey() {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
runtimeService.startProcessInstanceById(processDefinition.getId());
runtimeService.suspendProcessInstanceByProcessDefinitionKey(processDefinition.getKey());
EventSubscription subscription = runtimeService.createEventSubscriptionQuery().singleResult();
try {
runtimeService.messageEventReceived("someMessage", subscription.getExecutionId());
fail();
} catch (SuspendedEntityInteractionException e) {
// This is expected
assertTextPresent("is suspended", e.getMessage());
}
try {
runtimeService.messageEventReceived("someMessage", subscription.getExecutionId(), new HashMap<String, Object>());
fail();
} catch (SuspendedEntityInteractionException e) {
// This is expected
assertTextPresent("is suspended", e.getMessage());
}