assertEquals(1, eventSubscriptionQuery.count());
runtimeService.correlateMessage("newInvoice");
TaskQuery taskQuery = taskService.createTaskQuery();
Task task = taskQuery.singleResult();
assertEquals("afterMessage", task.getName());
HistoricActivityInstanceQuery historicActivityInstanceQuery = historyService.createHistoricActivityInstanceQuery().activityId("gw1");
assertEquals(1, historicActivityInstanceQuery.count());