Home > Software engineering >  IntelliJ does not recognize parameters in cucumber step definitions - Number expected
IntelliJ does not recognize parameters in cucumber step definitions - Number expected

Time:10-16

All of my cucumber test steps show errors when I use a parameter in them. This is one of the examples of the steps that I have in the my code:

 @And("the date is {date}")
public void theDateIs(LocalDate date) {
    testObject.setDateParams(date.toString());
}

IntelliJ shows the following error: enter image description here

While this does not prevent it from running, it is extremely annoying to see my step definition files with loads of red lines and sometimes makes it hard to find actual errors. I looked at my coworkers intelliJ's and they dont seem to be having the same problem.

Cucumber version being used is 6.8.0

IntelliJ Idea Ultimate 2021.2.2

Gherkin plugin 212.5284.40 (pre-installed with intelliJ)

Cucumber for java plugin 212.5284.40 (pre-installed with intelliJ)

CodePudding user response:

It looks like you have you have RegExp language support injected in the string literal, because it appears to be a RegExp error. Invoke Alt Enter on a literal with the error and the action Check RegExp should be in the list. In this case you should invoke Uninject Language or Reference in the same list to fix the problem.

  • Related