Class OperationTest

    • Field Detail

      • EXPECTED_RESULT_COUNT

        protected static final int EXPECTED_RESULT_COUNT
        See Also:
        Constant Field Values
    • Constructor Detail

      • OperationTest

        protected OperationTest​(OperationType operationType,
                                String objectTypeId)
        Creates an instance of an operation test.

        Intended to be used as part of a Parameterized test but can be run as a single test instance by invoking this constructor from the no argument constructor of the implementing class.

        Parameters:
        operationType - the operation under test
        objectTypeId - the object type id under test
      • OperationTest

        protected OperationTest​(OperationType operationType,
                                String objectTypeId,
                                OptionalTestInput optionalTestInput)
        Creates an instance of an operation test.

        Intended to be used as part of a Parameterized test but can be run as a single test instance by invoking this constructor from the no argument constructor of the implementing class.

        Parameters:
        operationType - the operation under test
        objectTypeId - the object type id under test
        optionalTestInput - optional input for the test
    • Method Detail

      • prepareForOperation

        public final void prepareForOperation()
        Setup method for operation tests

        This method will set the object type and object type id in the test context. It will also verify that any ObjectDefinitionRole cookies have been loaded.

      • testOperation

        public final void testOperation()
                                 throws Exception
        Test method to verify the successful execution of the target operation

        The test will execute the operation specified by the implementing class and verify the SimpleOperationResult. Successful operations are assumed to have only a single result as the test only supports a single input value. The operation status and presence of payloads will be verified against expectedOperationStatus and expectedEmptyPayloads. The expected values are specified by OptionalTestInput and default to OperationStatus.SUCCESS and false, respectively. If payloads are expected, they should not be null.

        Throws:
        Exception - exception testing the operation
      • afterOperation

        protected void afterOperation​(List<SimpleOperationResult> results)
                               throws Exception
        This method can be overridden to provide additional verification beyond the base verifications performed by testOperation(). This method will only execute after other verifications have passed. The default behavior of this method is to pass the first item in the list to afterOperation(SimpleOperationResult).
        Parameters:
        results - list of results created by executing the operation
        Throws:
        Exception - execption validating the operation results
      • afterOperation

        protected void afterOperation​(SimpleOperationResult result)
                               throws Exception
        This method can be overridden to provide additional verification beyond the base verifications performed by testOperation(). This method will only execute after other verifications have passed. If afterOperation(SimpleOperationResult) has also been overridden, then it is the responsibility of the overriding class to ensure that this method is called (if needed).
        Parameters:
        result - SimpleOperationResult created by executing the operation
        Throws:
        Exception - exception validating the operation result