Package org.camunda.community.bpmndt.api
Class UserTaskHandler
java.lang.Object
org.camunda.community.bpmndt.api.UserTaskHandler
Fluent API to handle user tasks. Please note: a user task is completed by default.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcomplete()Completes the user task, when the process instance is waiting at the corresponding element, using specified variables.customize(Consumer<UserTaskHandler> customizer) Customizes the handler, using the givenConsumerfunction.voidexecute(BiConsumer<io.camunda.zeebe.client.ZeebeClient, Long> action) Completes the user task using a custom action, when the process instance is waiting at the corresponding element.voidthrowBpmnError(String errorCode, String errorMessage) Throws an BPMN error using the given error code and message as well as the specified variables.Verifies the user task's waiting state.verifyAssignee(String expectedAssignee) Verifies that the user task has a specific assignee.verifyAssignee(Consumer<String> assigneeConsumer) Verifies that the user task has a specific assignee, using a consumer.verifyAssigneeExpression(Consumer<String> assigneeExpressionConsumer) Verifies that the user task has a specific assignee FEEL expression (see "Assignment" section), using a consumer function.verifyCandidateGroups(Consumer<List<String>> candidateGroupsConsumer) Verifies that the user task has specific candidate groups, using a consumer.verifyCandidateGroups(List<String> expectedCandidateGroups) Verifies that the user task has specific candidate groups.verifyCandidateGroupsExpression(Consumer<String> candidateGroupsExpressionConsumer) Verifies that the user task has specific candidate groups FEEL expression (see "Assignment" section), using a consumer function.verifyCandidateUsers(Consumer<List<String>> candidateUsersConsumer) Verifies that the user task has specific candidate users, using a consumer.verifyCandidateUsers(List<String> expectedCandidateUsers) Verifies that the user task has specific candidate users.verifyCandidateUsersExpression(Consumer<String> candidateUsersExpressionConsumer) Verifies that the user task has specific candidate users FEEL expression (see "Assignment" section), using a consumer function.verifyDueDate(Consumer<String> dueDateConsumer) Verifies that the user task has a specific due date, using a consumer.verifyDueDateExpression(Consumer<String> dueDateExpressionConsumer) Verifies that the user task has a specific due date FEEL expression (see "Assignment" section), using a consumer function.verifyFollowUpDate(Consumer<String> followUpDateConsumer) Verifies that the user task has a specific follow-up date, using a consumer.verifyFollowUpDateExpression(Consumer<String> followUpDateExpressionConsumer) Verifies that the user task has a specific follow-up date FEEL expression (see "Assignment" section), using a consumer function.verifyFormKey(String expectedFormKey) Verifies that the user task has a specific form key (see "Form" section).verifyFormKey(Consumer<String> formKeyConsumer) Verifies that the user task has a specific form key (see "Form" section), using a consumer function.voidApplies no action at the wait state.withVariable(String name, Object value) Sets a variable that is used to complete the user task.withVariableMap(Map<String, Object> variableMap) Sets variables that are used to complete the user task.withVariables(Object variables) Sets an object as variables that is used to complete the user task.
-
Constructor Details
-
UserTaskHandler
-
UserTaskHandler
-
-
Method Details
-
complete
public void complete()Completes the user task, when the process instance is waiting at the corresponding element, using specified variables.- See Also:
-
customize
Customizes the handler, using the givenConsumerfunction. This method can be used to apply a common customization needed for different test cases.tc.handleUserTask().customize(this::prepare);
- Parameters:
customizer- A function that accepts aUserTaskHandler.- Returns:
- The handler.
-
execute
Completes the user task using a custom action, when the process instance is waiting at the corresponding element.- Parameters:
action- A specific action that accepts aZeebeClientand the related job key.- See Also:
-
throwBpmnError
Throws an BPMN error using the given error code and message as well as the specified variables.- See Also:
-
verify
public UserTaskHandler verify(Consumer<io.camunda.zeebe.process.test.assertions.ProcessInstanceAssert> verifier) Verifies the user task's waiting state.- Parameters:
verifier- Verifier that accepts anProcessInstanceAssertinstance.- Returns:
- The handler.
-
verifyAssignee
Verifies that the user task has a specific assignee.- Parameters:
expectedAssignee- The expected assignee.- Returns:
- The handler.
-
verifyAssignee
Verifies that the user task has a specific assignee, using a consumer.- Parameters:
assigneeConsumer- A consumer asserting the assignee.- Returns:
- The handler.
-
verifyAssigneeExpression
Verifies that the user task has a specific assignee FEEL expression (see "Assignment" section), using a consumer function.- Parameters:
assigneeExpressionConsumer- A consumer asserting the assignee expression.- Returns:
- The handler.
-
verifyCandidateGroups
Verifies that the user task has specific candidate groups.- Parameters:
expectedCandidateGroups- The expected candidate groups.- Returns:
- The handler.
-
verifyCandidateGroups
Verifies that the user task has specific candidate groups, using a consumer.- Parameters:
candidateGroupsConsumer- A consumer asserting the candidate groups - a list ofStrings.- Returns:
- The handler.
-
verifyCandidateGroupsExpression
public UserTaskHandler verifyCandidateGroupsExpression(Consumer<String> candidateGroupsExpressionConsumer) Verifies that the user task has specific candidate groups FEEL expression (see "Assignment" section), using a consumer function.- Parameters:
candidateGroupsExpressionConsumer- A consumer asserting the candidate groups expression.- Returns:
- The handler.
-
verifyCandidateUsers
Verifies that the user task has specific candidate users.- Parameters:
expectedCandidateUsers- The expected candidate users.- Returns:
- The handler.
-
verifyCandidateUsers
Verifies that the user task has specific candidate users, using a consumer.- Parameters:
candidateUsersConsumer- A consumer asserting the candidate users - a list ofStrings.- Returns:
- The handler.
-
verifyCandidateUsersExpression
public UserTaskHandler verifyCandidateUsersExpression(Consumer<String> candidateUsersExpressionConsumer) Verifies that the user task has specific candidate users FEEL expression (see "Assignment" section), using a consumer function.- Parameters:
candidateUsersExpressionConsumer- A consumer asserting the candidate users expression.- Returns:
- The handler.
-
verifyDueDate
Verifies that the user task has a specific due date, using a consumer.- Parameters:
dueDateConsumer- A consumer asserting the due date.- Returns:
- The handler.
-
verifyDueDateExpression
Verifies that the user task has a specific due date FEEL expression (see "Assignment" section), using a consumer function.- Parameters:
dueDateExpressionConsumer- A consumer asserting the due date expression.- Returns:
- The handler.
-
verifyFollowUpDate
Verifies that the user task has a specific follow-up date, using a consumer.- Parameters:
followUpDateConsumer- A consumer asserting the follow-up date.- Returns:
- The handler.
-
verifyFollowUpDateExpression
public UserTaskHandler verifyFollowUpDateExpression(Consumer<String> followUpDateExpressionConsumer) Verifies that the user task has a specific follow-up date FEEL expression (see "Assignment" section), using a consumer function.- Parameters:
followUpDateExpressionConsumer- A consumer asserting the follow-up date expression.- Returns:
- The handler.
-
verifyFormKey
Verifies that the user task has a specific form key (see "Form" section).- Parameters:
expectedFormKey- The expected form key.- Returns:
- The handler.
-
verifyFormKey
Verifies that the user task has a specific form key (see "Form" section), using a consumer function.- Parameters:
formKeyConsumer- A consumer asserting the form key.- Returns:
- The handler.
-
waitForBoundaryEvent
public void waitForBoundaryEvent()Applies no action at the wait state. This is required when waiting for events (e.g. message, signal or timer events) that are attached as boundary events on the element itself or on the surrounding scope (e.g. embedded subprocess). -
withVariable
Sets a variable that is used to complete the user task.- Parameters:
name- The name of the variable.value- The variable's value.- Returns:
- The handler.
- See Also:
-
withVariables
Sets an object as variables that is used to complete the user task.- Parameters:
variables- The variables as POJO.- Returns:
- The handler.
- See Also:
-
withVariableMap
Sets variables that are used to complete the user task.- Parameters:
variableMap- A map of variables.- Returns:
- The handler.
- See Also:
-