Skip to content

Commit

Permalink
[Fix #3733] Adding transition check
Browse files Browse the repository at this point in the history
  • Loading branch information
fjtirado committed Oct 30, 2024
1 parent 44e8f2f commit 666b2b3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,12 @@ protected final void handleTransition(RuleFlowNodeContainerFactory<?, ?> factory
targetState.connectSource(actionNode);
}
} else {
callback.ifPresent(HandleTransitionCallBack::onEmptyTarget);
callback.ifPresentOrElse(HandleTransitionCallBack::onEmptyTarget,
() -> {
if (transition != null) {
parserContext.addValidationError(String.format("There is no state for transition %s originated in %s", transition.getNextState(), state.getName()));
}
});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ void testValidationError() throws IOException {
StaticWorkflowApplication application = StaticWorkflowApplication.create()) {
Workflow workflow = getWorkflow(reader, WorkflowFormat.JSON);
ValidationException validationException = catchThrowableOfType(() -> application.process(workflow), ValidationException.class);
assertThat(validationException.getErrors()).hasSizeGreaterThanOrEqualTo(3);
assertThat(validationException).hasMessageContaining("error").hasMessageContaining("function").hasMessageContaining("connect");
assertThat(validationException.getErrors()).hasSizeGreaterThanOrEqualTo(4);
assertThat(validationException).hasMessageContaining("error").hasMessageContaining("function").hasMessageContaining("connect").hasMessageContaining("transition");
}
}

Expand Down

0 comments on commit 666b2b3

Please sign in to comment.