Environment: Java/IntelliJ/Cucumber
Lately, I'v experienced several times that IntelliJ claims an ambiguous step definition when there doesn't appear to be one.
cucumber.runtime.AmbiguousStepDefinitionsException: "that "saken" is a
rejected case in kommune "5000"" matches more than one step definition:
"^that "([^"]*)" is a rejected case" in SakSteps.isARejectedCase(String)
"^that "([^"]*)" is a rejected case in kommune "([^"]*)"$" in
SakSteps.isARejectedCaseInKommune(String,String)
The "Given" step text is not the same, although the first 6 strings match:
"^that "([^"]*)" is a rejected case"
"^that "([^"]*)" is a rejected case in kommune "([^"]*)"$"
The method names are not at all similar:
isARejectedCase(String)
isARejectedCaseInKommune(String,String)
How come IntelliJ/Cucumber claims that these are ambiguous?
This code did work before. There may have been some plugin update or other in between, but I don't see why it should behave like this?
"^that "([^"]*)" is a rejected case") is a sub-case of the second ("^that "([^"]*)" is a rejected case in kommune "([^"]*)"$"). What I usually do is find a different wording to distinguish them. Maybe you could also add$at the end of the first, to indicate the end of the sentence. - hotzst