jbpmContext.save(breadTaskInstance);
long breadTokenId = breadTaskInstance.getToken().getId();
newTransaction();
Token breadToken = jbpmContext.loadToken(breadTokenId);
ContextInstance contextInstance = breadToken.getProcessInstance().getContextInstance();
assertNull(contextInstance.getVariable("hero", breadToken));
newTransaction();
breadTaskInstance = jbpmContext.loadTaskInstance(breadTaskInstance.getId());
assertEquals("asterix", breadTaskInstance.getVariable("hero"));
newTransaction();
TaskInstance monopolyTaskInstance = findTask("play monopoly");
monopolyTaskInstance.setVariable("hero", "obelix");
jbpmContext.save(monopolyTaskInstance);
long monopolyTokenId = monopolyTaskInstance.getToken().getId();
newTransaction();
monopolyTaskInstance = jbpmContext.loadTaskInstance(monopolyTaskInstance.getId());
assertEquals("obelix", monopolyTaskInstance.getVariable("hero"));
newTransaction();
Token monopolyToken = jbpmContext.loadToken(monopolyTokenId);
contextInstance = monopolyToken.getProcessInstance().getContextInstance();
assertNull(contextInstance.getVariable("hero", monopolyToken));
newTransaction();
breadTaskInstance = jbpmContext.loadTaskInstanceForUpdate(breadTaskInstance.getId());