Class AbstractXmlFlowExecutionTests

java.lang.Object
junit.framework.Assert
junit.framework.TestCase
All Implemented Interfaces:
junit.framework.Test

public abstract class AbstractXmlFlowExecutionTests extends AbstractExternalizedFlowExecutionTests
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 Details

    • AbstractXmlFlowExecutionTests

      public AbstractXmlFlowExecutionTests()
      Constructs a default XML flow execution test.
      See Also:
      • TestCase.setName(String)
    • AbstractXmlFlowExecutionTests

      public AbstractXmlFlowExecutionTests(String name)
      Constructs an XML flow execution test with given name.
      Parameters:
      name - the name of the test
  • Method Details

    • createFlowBuilder

      protected final FlowBuilder createFlowBuilder(FlowDefinitionResource resource)
      Description copied from class: AbstractExternalizedFlowExecutionTests
      Create the flow builder to build the flow at the specified resource location.
      Specified by:
      createFlowBuilder in class AbstractExternalizedFlowExecutionTests
      Parameters:
      resource - the resource location of the flow definition
      Returns:
      the flow builder that can build the flow definition
    • getModelResources

      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. 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 using SingletonBeanRegistry.registerSingleton(String, Object)