public void testEventBasedSplitBefore() throws Exception {
// signaling before the split is reached should have no effect
KnowledgeBase kbase = createKnowledgeBase("BPMN2-EventBasedSplit.xml");
StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
ksession.getWorkItemManager().registerWorkItemHandler("Email1", new DoNothingWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler("Email2", new DoNothingWorkItemHandler());
// Yes
ProcessInstance processInstance = ksession.startProcess("com.sample.test");
assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE);
ksession = restoreSession(ksession);
ksession.getWorkItemManager().registerWorkItemHandler("Email1", new DoNothingWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler("Email2", new DoNothingWorkItemHandler());
ksession.signalEvent("Yes", "YesValue", processInstance.getId());
assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE);
// No
processInstance = ksession.startProcess("com.sample.test");
assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE);
ksession = restoreSession(ksession);
ksession.getWorkItemManager().registerWorkItemHandler("Email1", new DoNothingWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler("Email2", new DoNothingWorkItemHandler());
ksession.signalEvent("No", "NoValue", processInstance.getId());
assertTrue(processInstance.getState() == ProcessInstance.STATE_ACTIVE);
}