Hello All
Sorry to ask this, but I've looked around and haven't seen how to do this.
I have a simple unit test using JbpmJUnitTestCase. I want to validate my custom work handlers, so I have created a BPMN2 workflow with a work handler in it. The work handler takes in some parameters and has results that are mapped to a variable. I know that it is generally working correctly as I can put a script task after the custom task to output the variables to the console. My unit test creates a parameter map and launches the flow:
|
| ProcessInstance processInstance = knowledgeSession.createProcessInstance("testprocess", parameterMap); |
|
| knowledgeSession.startProcessInstance(processInstance.getId()); |
I know I can do this in one step using the startProcess method. This method above works, as does the startProcess method.
I am also able to successfully assert, e.g.:
assertProcessInstanceCompleted
assertNodeTriggered
However by this time the processInstance is completed (per the assertation). So the variable context has been destroyed and I cannot use standard JUnit asserts to validate the output, retreived using getVariableValue.
So does anyone have an idea how I am meant to get variables from the context after the flow is complete? Or am I meant to watch the variables while the flow is happening, maybe through an event listener?
Thanks for any help.