title: Arity mismatch with Java Cucumber data tables
body: <p>I've been learning Cucumber for Java using <a href="http://blog.czeczotka.com/2014/07/22/cucumber-jvm-with-maven-in-minutes/" rel="nofollow noreferrer">Jakub Czeczótka's great blog</a>.  But he lost me when describing data tables.<br>
  I made a calculator class with addition, subtraction, multiplication, and division.  Individual tests of each of those methods pass.  When I try to use a table, I get an arity mismatch error from Gherkin:  </p>
  
  <pre><code>cucumber.runtime.CucumberException: Arity mismatch: Step Definition 'com.test.bdd.steps.CalculatorSteps.iWantToPerformADataTableCalculation(DataTable) in file: .../Code/Java/CucumberTest/target/test-classes/' with pattern [^I want to perform a data table calculation$] is declared with 1 parameters. However, the gherkin step has 0 arguments [].
  </code></pre>
  
  <p>Here are the relevant files and paths:</p>
  
  <pre><code>src/main/java/com/test/bdd/calculator/
  package com.test.bdd.calculator;
  public class Calculator
  {
  
      private int result;
      public void divide( int a, int b )
      {
          result = a / b;
      }
      public int getResult()
      {
          return result;
      }
  }
  
  
  src/test/resources/cucumber/
    Scenario: Division
      Given I want to perform a calculation
      When I divide 14 by 2
      Then the result should be 7
  
    Scenario Outline: Division Data Table
      Given I want to perform a data table calculation
      When I divide &lt;Numerator&gt; by &lt;Divisor&gt;
      Then the result should be &lt;Result&gt;
      Examples:
        | Numerator | Divisor | Result |
        | 100       | 2       | 50     |
        | 100       | 4       | 25     |
        | 1000      | 200     | 5      |
  
  
  src/test/java/com/test/bdd/steps/
  package com.test.bdd.steps;
  public class CalculatorSteps
  {
      private Calculator calculator;
      @Before
      public void setUp()
      {
          calculator = new Calculator();
      }
  
      @When( "^I divide &lt;Numerator&gt; by &lt;Divisor&gt;$" )
      public void iDivideNumeratorByDivisor()
      {
          // Write code here that turns the phrase above into concrete actions
          calculator.divide( 4, 3 );
      }
  
  
      @Then( "^the result should be &lt;Result&gt;$" )
      public void theResultShouldBeResult()
      {
          // Write code here that turns the phrase above into concrete actions
          assertEquals( 1, calculator.getResult() );
      }
  
  
      @Given( "^I want to perform a data table calculation$" )
      public void iWantToPerformADataTableCalculation( DataTable table )
      {
          if( table != null )
          {
              for ( Map&lt;String, Integer&gt; map : table.asMaps( String.class, Integer.class ) )
              {
                  Integer numerator = map.get( "Numerator" );
                  Integer divisor = map.get( "Divisor" );
                  Integer result = map.get( "Result" );
                  System.out.println( format( "Dividing %d by %d yields %d", numerator, divisor, result ) );
              }
          }
      }
  }
  
  
  package com.test.bdd.runner;
  @RunWith( Cucumber.class )
  @CucumberOptions(
      glue = "com.test.bdd.steps",
      features = "classpath:cucumber/calculator.feature" )
  
  
  public class RunCalculatorTests
  {
  }
  </code></pre>
  
  <p>So my table does not seem to be getting to Gherkin.  I presume my map has problems as well, but will deal with that when I get past the arity issue.<br>
  What do I need to do to resolve this arity mismatch?</p>