Class AbstractXmlFlowExecutionTests
java.lang.Object
junit.framework.Assert
junit.framework.TestCase
org.springframework.webflow.test.execution.AbstractFlowExecutionTests
org.springframework.webflow.test.execution.AbstractExternalizedFlowExecutionTests
org.springframework.webflow.test.execution.AbstractXmlFlowExecutionTests
- All Implemented Interfaces:
junit.framework.Test
Base class for flow integration tests that verify an XML flow definition executes as expected.
Example usage:
public class SearchFlowExecutionTests extends AbstractXmlFlowExecutionTests { protected FlowDefinitionResource getResource(FlowDefinitionResourceFactory resourceFactory) { return resourceFactory.createClassPathResource("search-flow.xml", getClass()); } public void testStartFlow() { ExternalContext context = new MockExternalContext(); startFlow(context); assertCurrentStateEquals("enterSearchCriteria"); } protected void configureFlowBuilderContext(MockFlowBuilderContext builderContext) { builderContext.registerBean("searchService", new TestSearchService()); } }
- Author:
- Keith Donald, Erwin Vervaet, Scott Andrews
-
Constructor Summary
ConstructorDescriptionConstructs a default XML flow execution test.Constructs an XML flow execution test with given name. -
Method Summary
Modifier and TypeMethodDescriptionprotected final FlowBuilder
createFlowBuilder
(FlowDefinitionResource resource) Create the flow builder to build the flow at the specified resource location.protected FlowDefinitionResource[]
getModelResources
(FlowDefinitionResourceFactory resourceFactory) Template method subclasses may override to return pointers to "flow model resources" needed to build the definition of the flow being tested.protected void
registerMockFlowBeans
(org.springframework.beans.factory.config.ConfigurableBeanFactory flowBeanFactory) Template method subclasses may override to register mock implementations of services used locally by the flow being tested.Methods inherited from class org.springframework.webflow.test.execution.AbstractExternalizedFlowExecutionTests
buildFlow, configureFlowBuilderContext, createResourceLoader, getFlow, getFlowDefinition, getFlowDefinitionRegistry, getResource, getResourceFactory, isCacheFlowDefinition, setCacheFlowDefinition, setFlowExecutionAttributes, setFlowExecutionListener, setFlowExecutionListeners
Methods inherited from class org.springframework.webflow.test.execution.AbstractFlowExecutionTests
assertActiveFlowEquals, assertCurrentStateEquals, assertFlowExecutionActive, assertFlowExecutionEnded, assertFlowExecutionOutcomeEquals, assertResponseWrittenEquals, createFlowExecutionFactory, getConversationAttribute, getConversationScope, getFlowAttribute, getFlowExecution, getFlowExecutionFactory, getFlowExecutionOutcome, getFlowScope, getRequiredConversationAttribute, getRequiredConversationAttribute, getRequiredFlowAttribute, getRequiredFlowAttribute, getRequiredViewAttribute, getRequiredViewAttribute, getViewAttribute, getViewScope, resumeFlow, setCurrentState, startFlow, startFlow, updateFlowExecution
Methods inherited from class junit.framework.TestCase
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, setUp, tearDown, toString
-
Constructor Details
-
AbstractXmlFlowExecutionTests
public AbstractXmlFlowExecutionTests()Constructs a default XML flow execution test.- See Also:
-
TestCase.setName(String)
-
AbstractXmlFlowExecutionTests
Constructs an XML flow execution test with given name.- Parameters:
name
- the name of the test
-
-
Method Details
-
createFlowBuilder
Description copied from class:AbstractExternalizedFlowExecutionTests
Create the flow builder to build the flow at the specified resource location.- Specified by:
createFlowBuilder
in classAbstractExternalizedFlowExecutionTests
- Parameters:
resource
- the resource location of the flow definition- Returns:
- the flow builder that can build the flow definition
-
getModelResources
Template method subclasses may override to return pointers to "flow model resources" needed to build the definition of the flow being tested. Typically overridden when the flow being tested extends from another flow. Default returns null, assuming no inheritance.- Parameters:
resourceFactory
- the resource factory- Returns:
- the flow definition model resources
-
registerMockFlowBeans
protected void registerMockFlowBeans(org.springframework.beans.factory.config.ConfigurableBeanFactory flowBeanFactory) Template method subclasses may override to register mock implementations of services used locally by the flow being tested. By default, this method does nothing.- Parameters:
flowBeanFactory
- the local flow bean factory, you may register mock services with it usingSingletonBeanRegistry.registerSingleton(String, Object)
-