Class UserTaskHandler

java.lang.Object
org.camunda.community.bpmndt.api.UserTaskHandler

public class UserTaskHandler extends Object
Fluent API to handle user tasks. Please note: a user task is completed by default.
  • Constructor Details

  • 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

      public UserTaskHandler customize(Consumer<UserTaskHandler> customizer)
      Customizes the handler, using the given Consumer function. 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 a UserTaskHandler.
      Returns:
      The handler.
    • execute

      public void execute(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.
      Parameters:
      action - A specific action that accepts a ZeebeClient and the related job key.
      See Also:
      • JobClient.newCompleteCommand(long)
    • throwBpmnError

      public void throwBpmnError(String errorCode, String errorMessage)
      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 an ProcessInstanceAssert instance.
      Returns:
      The handler.
    • verifyAssignee

      public UserTaskHandler verifyAssignee(String expectedAssignee)
      Verifies that the user task has a specific assignee.
      Parameters:
      expectedAssignee - The expected assignee.
      Returns:
      The handler.
    • verifyAssignee

      public UserTaskHandler verifyAssignee(Consumer<String> assigneeConsumer)
      Verifies that the user task has a specific assignee, using a consumer.
      Parameters:
      assigneeConsumer - A consumer asserting the assignee.
      Returns:
      The handler.
    • verifyAssigneeExpression

      public UserTaskHandler verifyAssigneeExpression(Consumer<String> assigneeExpressionConsumer)
      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

      public UserTaskHandler verifyCandidateGroups(List<String> expectedCandidateGroups)
      Verifies that the user task has specific candidate groups.
      Parameters:
      expectedCandidateGroups - The expected candidate groups.
      Returns:
      The handler.
    • verifyCandidateGroups

      public UserTaskHandler verifyCandidateGroups(Consumer<List<String>> candidateGroupsConsumer)
      Verifies that the user task has specific candidate groups, using a consumer.
      Parameters:
      candidateGroupsConsumer - A consumer asserting the candidate groups - a list of Strings.
      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

      public UserTaskHandler verifyCandidateUsers(List<String> expectedCandidateUsers)
      Verifies that the user task has specific candidate users.
      Parameters:
      expectedCandidateUsers - The expected candidate users.
      Returns:
      The handler.
    • verifyCandidateUsers

      public UserTaskHandler verifyCandidateUsers(Consumer<List<String>> candidateUsersConsumer)
      Verifies that the user task has specific candidate users, using a consumer.
      Parameters:
      candidateUsersConsumer - A consumer asserting the candidate users - a list of Strings.
      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

      public UserTaskHandler verifyDueDate(Consumer<String> dueDateConsumer)
      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

      public UserTaskHandler verifyDueDateExpression(Consumer<String> dueDateExpressionConsumer)
      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

      public UserTaskHandler verifyFollowUpDate(Consumer<String> followUpDateConsumer)
      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

      public UserTaskHandler verifyFormKey(String expectedFormKey)
      Verifies that the user task has a specific form key (see "Form" section).
      Parameters:
      expectedFormKey - The expected form key.
      Returns:
      The handler.
    • verifyFormKey

      public UserTaskHandler verifyFormKey(Consumer<String> formKeyConsumer)
      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

      public UserTaskHandler withVariable(String name, Object value)
      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

      public UserTaskHandler withVariables(Object variables)
      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

      public UserTaskHandler withVariableMap(Map<String,Object> variableMap)
      Sets variables that are used to complete the user task.
      Parameters:
      variableMap - A map of variables.
      Returns:
      The handler.
      See Also: