Class FluentMock<T,P extends org.camunda.bpm.engine.delegate.VariableScope>
java.lang.Object
org.camunda.community.mockito.mock.FluentMock<T,P>
- 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 Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFluentMock(T mock, Class<P> parameterType) Creates a new instance for given mock. -
Method Summary
Modifier and TypeMethodDescriptionprotected Pany()protected static org.camunda.bpm.engine.variable.VariableMap[]combineVariableMaps(org.camunda.bpm.engine.variable.VariableMap variableMap, org.camunda.bpm.engine.variable.VariableMap... values) getMock()<V> voidonExecutionSetVariable(io.holunda.camunda.bpm.data.factory.VariableFactory<V> variable, V value) voidonExecutionSetVariable(String key, Object value) voidonExecutionSetVariables(Map<String, Object> variables) final voidSets consecutive return values to be returned when the method is called.abstract voidonExecutionSetVariables(org.camunda.bpm.engine.variable.VariableMap variableMap) abstract voidonExecutionSetVariables(org.camunda.bpm.engine.variable.VariableMap variableMap, org.camunda.bpm.engine.variable.VariableMap... values) Sets consecutive return values to be returned when the method is called.voidonExecutionThrowBpmnError(String errorCode) The mock will throw a BpmnError with given errorCode.voidonExecutionThrowBpmnError(String errorCode, String message) The mock will throw a BpmnError with given errorCode and message.abstract voidonExecutionThrowBpmnError(org.camunda.bpm.engine.delegate.BpmnError bpmnError) The implementation of throw-bpmn-error depends on the concrete type.abstract voidonExecutionThrowException(Exception exception) The mock will throw the given exception on execution.protected voidsetVariables(org.camunda.bpm.engine.delegate.VariableScope variableScope, Map<String, Object> variables) protected voidsetVariablesForMultipleInvocations(org.camunda.bpm.engine.variable.VariableMap[] variables, String invocationCountVariableName, org.camunda.bpm.engine.delegate.VariableScope variableScope)
-
Field Details
-
mock
-
parameterType
-
-
Constructor Details
-
FluentMock
Creates a new instance for given mock.- Parameters:
mock- the mocked delegate or listenerparameterType- the parameter type (DelegateExecution, DelegateTask)
-
-
Method Details
-
setVariables
-
combineVariableMaps
protected static org.camunda.bpm.engine.variable.VariableMap[] combineVariableMaps(org.camunda.bpm.engine.variable.VariableMap variableMap, org.camunda.bpm.engine.variable.VariableMap... values) -
setVariablesForMultipleInvocations
protected void setVariablesForMultipleInvocations(org.camunda.bpm.engine.variable.VariableMap[] variables, String invocationCountVariableName, org.camunda.bpm.engine.delegate.VariableScope variableScope) -
onExecutionSetVariables
public abstract void onExecutionSetVariables(org.camunda.bpm.engine.variable.VariableMap variableMap) - Parameters:
variableMap- the process variables this delegate sets when executed
-
onExecutionSetVariables
public abstract void onExecutionSetVariables(org.camunda.bpm.engine.variable.VariableMap variableMap, org.camunda.bpm.engine.variable.VariableMap... values) Sets consecutive return values to be returned when the method is called. E.g:
Last return value in the sequence (in example: variableMap3) determines the behavior of further consecutive calls.mock.onExecutionSetVariables(variableMap1, variableMap2, variableMap3);- Parameters:
variableMap- first variables that will be returnedvalues- next variables that will be return
-
onExecutionSetVariable
- Parameters:
key- of the process variables this delegate sets when executedvalue- of the process variables this delegate sets when executed
-
onExecutionSetVariable
public <V> void onExecutionSetVariable(io.holunda.camunda.bpm.data.factory.VariableFactory<V> variable, V value) - Type Parameters:
V- the payload type of the variable- Parameters:
variable- the VariableFactory declartion (name and type of variable)value- the value to set. Type safe.- See Also:
-
onExecutionSetVariables
@SafeVarargs public final void onExecutionSetVariables(Map<String, Object> variables, Map<String, Object>... values) Sets consecutive return values to be returned when the method is called. E.g:
Last return value in the sequence (in example: Map.of("bar", "foo")) determines the behavior of further consecutive calls.mock.onExecutionSetVariables(Map.of("foo", "bar"), Map.of("bar", "foo"));- Parameters:
variables- first variables that will be returnedvalues- next variables that will be return
-
onExecutionSetVariables
- Parameters:
variables- the process variables this delegate sets when executed
-
onExecutionThrowBpmnError
The mock will throw a BpmnError with given errorCode.- Parameters:
errorCode- the error code
-
onExecutionThrowBpmnError
The mock will throw a BpmnError with given errorCode and message.- Parameters:
errorCode- the error codemessage- 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
The mock will throw the given exception on execution.- Parameters:
exception- the exception instance
-
getMock
- Returns:
- the internal mock
-
any
- Returns:
- any(P) for use in Mockito when/doAnswer
-