businessProcess.setVariable("key", value);
assertEquals(value, businessProcess.getVariable("key"));
// complete the task
assertEquals(task.getId(), businessProcess.startTask(task.getId()).getId());
businessProcess.completeTask();
// assert the task is completed
assertNull(processEngine.getTaskService().createTaskQuery().singleResult());
// assert that the process is ended: