I have a problem testing my Spring webflows with JUnit.
As suggested in the docs I wrote a Test Class which extends AbstractXmlFlowExecutionTests.
public class MyFlowTest extends AbstractXmlFlowExecutionTests {
MockExternalContext context = new MockExternalContext();
String workingDirectory = null;
@Override
protected FlowDefinitionResource getResource(FlowDefinitionResourceFactory resourceFactory) {
return resourceFactory.createFileResource("WebContent/flows/myflow-flow.xml");
}
The webflow under Test inherits from an abstract parent webflow which defines some global transitions. So I try to override getModelResources to provide this parent webflow. But this is not working at all.
@Override
protected FlowDefinitionResource[] getModelResources(FlowDefinitionResourceFactory resourceFactory) {
FlowDefinitionResource[] flowDefResources = new FlowDefinitionResource[1];
see below...
return flowDefResources;
}
My specific problem is:
When I use resourceFactory.createFileResource for the parent flow the name is not correct so I get a exception wih the message Unable to find flow 'main/parentflow' to inherit from.
When I use resourceFactory.createResource(String path, null, "main/parentflow" the .xml defining the flow is never found. The Exception prints the Path and says FileNotFound but the path does exist for sure (copy and paste this path to an Editor - File - Open works.
What am I doing wrong here?
Many thanks in advance.
I am using spring-webflow-2.3.2 and jUnit 4