Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-11692

Assertions for joining gateways

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Fixed
    • Icon: L3 - Default L3 - Default
    • assert-6.0.0
    • None
    • assert
    • None

      What is the problem?

      I've modeled a process with nested joining or gateways. I want to write a JUnit test aginst it and test, if the process instance is waiting at a joining gateway.

      assertThat(processInstance).isWaitingAt(gatewayId) return false, as a joining gateway is not an active activity.

      What would be the expected behavior:

      I would like to write

      assertThat(processInstance).isWaitingForJoinAt(gatewayId);
      

      Hints (optional):

      this is a rough implementation:

        public boolean isWaitingforJoin(String activityId, ProcessInstance processInstance) {
          ActivityInstance activityInstance = runtimeService().getActivityInstance(processInstance.getId());
          ActivityInstance[] joiningGateways = activityInstance.getActivityInstances(activityId);
          Assertions.assertThat(joiningGateways).overridingErrorMessage("Expecting list of joining gateways not to be null, not to be empty and not to contain null values: %s."
              , Lists.newArrayList(joiningGateways))
          .isNotNull().isNotEmpty().doesNotContainNull();
          System.out.println(joiningGateways.length);
          for (int i = 0; i < joiningGateways.length; i++) {
            System.out.println(joiningGateways[i].getActivityId());
          }
          
          return joiningGateways[0].getActivityId().equals(activityId);
        }
      

      Attached you find process models to test with.

        This is the controller panel for Smart Panels app

              thorben.lindhauer Thorben Lindhauer
              ingo.richtsmeier Ingo Richtsmeier
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: