I want to create a custom datatable transformer in a cucumber. This is what my function looks like:
Given board
| o | _ | _ |
| o | _ | _ |
| o | _ | _ |
And I want to put it in a custom object. Let's say it looks like this:
class Board {
private List<List<String>> board;
public Board(List<List<String>> board) {
this.board = board;
}
}
My step definition should look like this:
@Given("^board$")
public void board(Board board) throws Throwable {
}
The step definition works fine for the class DataTableandList<List<String>>
@Given("^board$")
public void board(DataTable board) throws Throwable {
}
And it also works great
@Given("^board$")
public void board(List<List<String>> board) throws Throwable {
}
I tried to find a solution on the Internet, but to no avail. I also tried creating Transformer, but as I see it only works fine for strings (I want to use Datatable or List> in the input):
class BoardTransformer extends Transformer<Board> {
@Override
public Board transform(String value) {
return null;
}
}
source
share