Class ExecutionPlanExpectationHelper


  • public class ExecutionPlanExpectationHelper
    extends java.lang.Object
    Provides some convenience methods in order to build readable execution plan expectations.
    Since:
    2.0.0
    Author:
    Oliver Libutzki <[email protected]>
    • Constructor Detail

      • ExecutionPlanExpectationHelper

        public ExecutionPlanExpectationHelper()
    • Method Detail

      • executionPlan

        public ExecutionPlanExpectation executionPlan()
        Constructs an execution plan expectation without any child expectations.
        Returns:
        the execution plan expectation
      • executionPlan

        public ExecutionPlanExpectation executionPlan​(java.util.List<StructuralElementExpectation> children)
        Constructs an execution plan expectation with the given child expectations.
        Parameters:
        children - child expectations
        Returns:
        the execution plan expectation
      • testSuite

        public TestSuiteExpectation testSuite​(java.lang.Class<?> javaClass,
                                              java.util.List<StructuralElementExpectation> children)
        Constructs a test suite expectation for the given parameters.
        Parameters:
        javaClass - the java class which the test suite should base on
        children - the child expectations
        Returns:
        the test suite expectation
      • testClass

        public TestClassExpectation testClass​(java.lang.Class<?> javaClass,
                                              java.util.List<TestStepExpectation> steps)
        Constructs a test class expectation for the given parameters.
        Parameters:
        javaClass - the java class which the test suite should base on
        steps - the step expectations
        Returns:
        the test class expectation
      • testClass

        public TestClassExpectation testClass​(java.lang.Class<?> javaClass,
                                              TestParameterExpectation testParameter,
                                              java.util.List<TestStepExpectation> steps)
        Constructs a parameterized (single parameter) test class expectation for the given parameters.
        Parameters:
        javaClass - the java class which the test suite should base on
        testParameter - the expected parameter
        steps - the step expectations
        Returns:
        the test class expectation
      • testClass

        public TestClassExpectation testClass​(java.lang.Class<?> javaClass,
                                              java.util.List<TestParameterExpectation> testParameters,
                                              java.lang.Iterable<TestStepExpectation> steps)
        Constructs a parameterized (multiple parameters) test class expectation for the given parameters.
        Parameters:
        javaClass - the java class which the test suite should base on
        testParameters - the expected parameters
        steps - the step expectations
        Returns:
        the test class expectation
      • testStep

        public TestStepExpectation testStep​(java.lang.String name)
        Constructs a test step expectation for the given name.
        Parameters:
        name - Name of the test step
        Returns:
        the test step expectation
      • testStep

        public TestStepExpectation testStep​(java.lang.String name,
                                            TestParameterExpectation testParameter)
        Constructs a parameterized (single parameter) test step expectation for the given name.
        Parameters:
        name - Name of the test step
        testParameter - the expected parameter
        Returns:
        the test step expectation
      • testStep

        public TestStepExpectation testStep​(java.lang.String name,
                                            java.util.List<TestParameterExpectation> testParameters)
        Constructs a parameterized (multiple parameters) test step expectation for the given name.
        Parameters:
        name - Name of the test step
        testParameters - the expected parameters
        Returns:
        the test step expectation
      • testParameter

        public TestParameterExpectation testParameter​(java.lang.String name,
                                                      java.lang.Object value)
        Constructs a test parameter expectation for the given parameters.
        Parameters:
        name - expected name of the parameter
        value - expected value of the parameter
        Returns:
        the test parameter expectation
      • runTest

        public void runTest​(java.lang.Class<?> testClass,
                            java.util.Map<java.lang.String,​java.lang.String> properties,
                            ExecutionPlanExpectation executionPlanExpectation)
        After setting the given properties as JVM System properties the execution plan for given testClass is obtained and asserted against the ExecutionPlanExpectation.
        Parameters:
        testClass - the test class to be executed
        properties - the properties to set
        executionPlanExpectation - the expected execution plan
      • runTest

        public void runTest​(java.lang.Class<?> testClass,
                            ExecutionPlanExpectation executionPlanExpectation)
        Obtains the execution plan for given testClass and asserts it against the ExecutionPlanExpectation.
        Parameters:
        testClass - the test class to be executed
        executionPlanExpectation - the expected execution plan