Class FluentMock<T,​P extends org.camunda.bpm.engine.delegate.VariableScope>

  • Type Parameters:
    T - type of mock (JavaDelegate, ExecutionListener, TaskListener)
    P - type of method argument (DelegateExecution, DelegateTask)
    Direct Known Subclasses:
    FluentExecutionListenerMock, FluentJavaDelegateMock, FluentTaskListenerMock

    public abstract class FluentMock<T,​P extends org.camunda.bpm.engine.delegate.VariableScope>
    extends Object
    Common super class for all fluent mocks.
    • Field Detail

      • mock

        protected final T mock
      • parameterType

        protected final Class<P extends org.camunda.bpm.engine.delegate.VariableScope> parameterType
    • Constructor Detail

      • FluentMock

        protected FluentMock​(T mock,
                             Class<P> parameterType)
        Creates a new instance for given mock.
        Parameters:
        mock - the mocked delegate or listener
        parameterType - the parameter type (DelegateExecution, DelegateTask)
    • Method Detail

      • setVariables

        protected void setVariables​(org.camunda.bpm.engine.delegate.VariableScope variableScope,
                                    Map<String,​Object> variables)
      • onExecutionSetVariables

        public abstract void onExecutionSetVariables​(org.camunda.bpm.engine.variable.VariableMap variableMap)
        Parameters:
        variableMap - the process variables this delegate sets when executed
      • onExecutionSetVariable

        public void onExecutionSetVariable​(String key,
                                           Object value)
        Parameters:
        key - of the process variables this delegate sets when executed
        value - of the process variables this delegate sets when executed
      • onExecutionSetVariables

        public void onExecutionSetVariables​(Map<String,​Object> variables)
        Parameters:
        variables - the process variables this delegate sets when executed
      • onExecutionThrowBpmnError

        public void onExecutionThrowBpmnError​(String errorCode)
        The mock will throw a BpmnError with given errorCode.
        Parameters:
        errorCode - the error code
      • onExecutionThrowBpmnError

        public void onExecutionThrowBpmnError​(String errorCode,
                                              String message)
        The mock will throw a BpmnError with given errorCode and message.
        Parameters:
        errorCode - the error code
        message - the error message
      • onExecutionThrowBpmnError

        public abstract void onExecutionThrowBpmnError​(org.camunda.bpm.engine.delegate.BpmnError bpmnError)
        The implementation of throw-bpmn-error depends on the concrete type.
        Parameters:
        bpmnError - the error instance
      • onExecutionThrowException

        public abstract void onExecutionThrowException​(Exception exception)
        The mock will throw the given exception on execution.
        Parameters:
        exception - the exception instance
      • getMock

        public T getMock()
        Returns:
        the internal mock
      • any

        protected P any()
        Returns:
        any(P) for use in Mockito when/doAnswer