-
Notifications
You must be signed in to change notification settings - Fork 81
Make reading of scenario steps more flexible #8980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
A PR to allow scenario steps to be more flexible by supporting skipped step numbers and steps starting with a '0'. Key changes include:
- Updating tests in ScenarioTest.java to expect an increased number of steps.
- Refactoring Scenario.java#getSteps to filter, sort, and validate steps using a regex-based approach and a custom StepSorter.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
larva/src/test/java/org/frankframework/larva/ScenarioTest.java | Updated test assertions to reflect flexible step numbering and support for a '0'-prefixed step. |
larva/src/main/java/org/frankframework/larva/Scenario.java | Refactored step filtering, sorting, and duplicate validation with regex matching and a custom comparator. |
public int compare(String o1, String o2) { | ||
int step1Nr = getStepNr(o1); | ||
int step2Nr = getStepNr(o2); | ||
return step1Nr - step2Nr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider using Integer.compare(step1Nr, step2Nr) instead of subtraction for clarity and to avoid potential integer overflow in edge cases.
return step1Nr - step2Nr; | |
return Integer.compare(step1Nr, step2Nr); |
Copilot uses AI. Check for mistakes.
Nice, this will make it a lot easier to write and test Larva scenarios! |
|
Scenario step numbers can now skip steps, so you can comment out a single step without having to renumber all following steps.
Step numbers can also start with a '0' to align step numbers nicely in the file.