我有一个问题,用JUnit测试我的Spring webflows。JUnit和Spring Webflow
正如文档中所建议的,我编写了一个扩展了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");
}
测试下的webflow继承自定义了一些全局转换的抽象父Webflow。所以我尝试重写getModelResources来提供这个父Webflow。但这根本不起作用。
@Override
protected FlowDefinitionResource[] getModelResources(FlowDefinitionResourceFactory resourceFactory) {
FlowDefinitionResource[] flowDefResources = new FlowDefinitionResource[1];
see below...
return flowDefResources;
}
我的具体问题是:
当我使用resourceFactory.createFileResource
父流动名是不正确的,所以我得到一个例外王氏消息Unable to find flow 'main/parentflow' to inherit from
。
当我使用resourceFactory.createResource(String path, null, "main/parentflow"
时,定义流的.xml从未找到。例外打印路径,并说FileNotFound但路径确实存在肯定(复制和这个路径粘贴到编辑器 - 提前打开作品
我在做什么错在这里
非常感谢 - 文件。?。
我使用弹簧的Webflow-2.3.2和JUnit 4