Skip to content

Arity mismatch Java8 Step Definition error #852

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

Closed
drcoelho opened this issue Apr 11, 2015 · 5 comments
Closed

Arity mismatch Java8 Step Definition error #852

drcoelho opened this issue Apr 11, 2015 · 5 comments

Comments

@drcoelho
Copy link
Contributor

When I define my step by using cucumber Java8 feature, I get this exception:

cucumber.runtime.CucumberException: Arity mismatch: Step Definition 'MyStepsDef.java:16' with pattern [^I have a list of numbers:$] is declared with 0 parameters. However, the gherkin step has 1 arguments [Table:[[11], [3], [7]]]. 

But If I use the Given annotation in a class method, with the same step definition works fine.

MyStepsDef.java
public MyStepsDef() {
        Given("^I have a list of numbers:$", (DataTable t) -> {
            List<Integer> numbers = t.asList(Integer.class);
            // do something here
        });
}
myfeature.feature
Given I have a list of numbers:
      | 11 |
      | 3  |
      | 7  |
Dependencies
cucumber-java:1.2.2
cucumber-java8:1.2.2
@karimnabli
Copy link

I have the same problem too.

@brasmusson
Copy link
Contributor

@DavidCoelho Is this issue fixed by PR #847 that you opened a week ago?

@drcoelho
Copy link
Contributor Author

@brasmusson yes. After I coded, I tried to find an issue about this problem, but I didn't find it.. So I thought was better to create this issue...

@dayatang
Copy link

I have the same problem too.

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants