Execution execution = runtimeService.createExecutionQuery().signalEventSubscriptionName("newSignal").singleResult();
runtimeService.signalEventReceived("newSignal", execution.getId());
HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
query.activityId("signal");
assertEquals(1, query.count());
assertNotNull(query.singleResult().getEndTime());
assertEquals("boundarySignal", query.singleResult().getActivityType());
Task task = taskService.createTaskQuery().singleResult();
taskService.complete(task.getId());
assertProcessEnded(pi.getId());