Hello Cucumber folks,
I'm trying to understand glue code resolution in the presence of step
definitions using Cucumber Expressions and Regular Expressions.
io.cucumber.cucumberexpressions.RegularExpression implements a step
definition lookup which prioritises matching custom parameter type
regexes over the type hint taken from the type of the method
arguments. This seems backwards. It means that we can't define
parameter types which use the same regex.
The argument can be made that there should not be more than one
parameter type with the same regex; but it's actually a very common
use-case. For example: there are many ways to convert quoted strings
to data types. It should be possible to define all of these ways using
a parameter type annotation like:
@ParameterType("\"([^\"]+)\"")
It seems arbitrary that whichever one is defined first and happens to
occupy `parameterTypesByRegexp` in `ParameterTypeRegistry` will then
commandeer every regular-expression-step-definition which wants to
accept a quoted string.
I'm guessing that this functionality makes sense for JVM languages
which have untyped glue definitions; but it seems to me that the type
hint, if present, should definitely take precedence over a regex which
just happens to match.
Are you open to a PR which adjusts the behaviour?
Finally, thanks for a great tool! We are getting a lot of mileage out
of Cucumber.
Shannon
PS: The posting rules link is dead.