@Override public void verify(final Node node) { final String[] response = node.execute(transaction); assertThat(response).hasSize(3); assertThat(response).doesNotContainNull(); } }
private ProcessInstanceAssert isWaitingAt(final String[] activityIds, boolean exactly) { ProcessInstance current = getExistingCurrent(); Assertions.assertThat(activityIds) .overridingErrorMessage("Expecting list of activityIds not to be null, not to be empty and not to contain null values: %s." , Lists.newArrayList(activityIds)) .isNotNull().isNotEmpty().doesNotContainNull(); final List<String> activeActivityIds = runtimeService().getActiveActivityIds(actual.getId()); ListAssert<String> assertion = Assertions.assertThat(activeActivityIds) .overridingErrorMessage("Expecting %s to be waiting at '%s' but it is actually waiting at %s", toString(current), Lists.newArrayList(activityIds), activeActivityIds); if (exactly) { String[] sorted = activityIds.clone(); Arrays.sort(sorted); assertion.containsExactly(sorted); } else { assertion.contains(activityIds); } return this; }
/** * Verifies the expectation that the {@link ProcessInstance} has passed one or * more specified activities. * * @param activityIds the id's of the activities expected to have been passed * @return this {@link ProcessInstanceAssert} */ public ProcessInstanceAssert hasPassed(final String... activityIds) { isNotNull(); Assertions.assertThat(activityIds) .overridingErrorMessage("Expecting list of activityIds not to be null, not to be empty and not to contain null values: %s." , Lists.newArrayList(activityIds)) .isNotNull().isNotEmpty().doesNotContainNull(); List<HistoricActivityInstance> finishedInstances = historicActivityInstanceQuery().finished().orderByActivityId().asc().list(); List<String> finished = new ArrayList<String>(finishedInstances.size()); for (HistoricActivityInstance instance: finishedInstances) { finished.add(instance.getActivityId()); } final String message = "Expecting %s to have passed activities %s at least once, but actually " + "we instead we found that it passed %s. (Please make sure you have set the history service of the engine to at least " + "'activity' or a higher level before making use of this assertion!)"; ListAssert<String> assertion = Assertions.assertThat(finished) .overridingErrorMessage(message, actual, Lists.newArrayList(activityIds), Lists.newArrayList(finished) ); assertion.contains(activityIds); return this; }