Skip to:
The idea is to map the ExamplesTable rows to match a business object.
So, instead of having a method like this:
@Given("some $table") public void givenAnExamplesTable(ExamplesTable table){ ... }
We'd have something like this:
@Given("some $table") public void givenACustomBusinessObject(MyCustomObject myObject){ ... }
Or a List of business objects: @Given("some $table") public void givenACustomBusinessObject(List<MyCustomObject> myObjectList){ ... }
This can be done in two ways:
Annotation-based mapping:
@AsParameters public class MyCustomObject{ @Parameter(name="column1") private String col1;
@Parameter(name="column2") private Boolean col2; }
Named-based mapping, using the name of the field as the parameter name.
The idea is to map the ExamplesTable rows to match a business object.
So, instead of having a method like this:
@Given("some $table")
public void givenAnExamplesTable(ExamplesTable table){ ... }
We'd have something like this:
@Given("some $table")
public void givenACustomBusinessObject(MyCustomObject myObject){ ... }
Or a List of business objects:
@Given("some $table")
public void givenACustomBusinessObject(List<MyCustomObject> myObjectList){ ... }
This can be done in two ways:
Annotation-based mapping:
@AsParameters
public class MyCustomObject{
@Parameter(name="column1")
private String col1;
@Parameter(name="column2")
private Boolean col2;
}
Named-based mapping, using the name of the field as the parameter name.