[Core] Generate valid parameter names in snippets #2029
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Parameter names were taken directly form the parameter names used in the
cucumber expression. By passing these through the identifier generator
we can ensure that these are valid identifiers.
To reflect this new usage the
FunctionNameGeneratorwas renamed toIdentifierGenerator. The identifier generator uses a strategy pattern to joinwords into method and parameter names.
Parameter names are always generated using the camel case strategy. While
long sentence like method names may be more readable in snake case, it is
expected that people will still want to follow the java conventions for
parameters.
To avoid issues where a parameter name were already in camel case or underscore
case sentences are also split on camel case and underscores (in addition to
whitespace). This also required using all lower case in the
UnderscoreJoinerwhich has since been renamed to
SnakeCaseJoiner.Fixes: #2028