Sep 19th, 2011, 07:51 AM
Output of Spring Webflow in Junit
I have a Junit written for a Spring Webflow. The Junit works fine but I need to check the values of the output of the webflow. How can we get those in my Junit class? See the below workflow. How can I get the value out_object in my Junit test case?
<?xml version="1.0" encoding="UTF-8"?>
<view-state id="showSomething" view="showView">
<transition on="save" to="store">
<transition on="cancel" to="end"/>
do something the storing stuff and transition to finish
<output name="out_object" value="flowScope.outputObject"/>
Thanks in advance.
Sep 19th, 2011, 09:54 AM
Try registering a FlowExecutionListener (subclass FlowExecutionListenerAdapter) implementing 'sessionEnded' as an inner class of your JUnit test suite and assert the k/v pairs of the attribute map 'output' within it.
Originally Posted by nitindabadghav
Sep 21st, 2011, 12:59 AM
got it working
Eventually I got it working yesterday in the below way :
LocalAttributeMap outputVariables = (LocalAttributeMap)getFlowExecutionOutcome().getOu tput();
This returned me the value of the output parameters of the webflow.
Sep 21st, 2011, 07:41 AM
Great. I had been using my approach previously, however yours is more concise!
Tags for this Thread