I want to create custom datatable transformer in cucumber. This is how my feature looks like:
Given board
| o | _ | _ |
| o | _ | _ |
| o | _ | _ |
And I want to put it into custom object. Let's say that 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 {
// todo
}
Step definition works fine for DataTable
class and List<List<String>>
@Given("^board$")
public void board(DataTable board) throws Throwable {
// this works fine
}
And this also works fine
@Given("^board$")
public void board(List<List<String>> board) throws Throwable {
// this also works fine
}
I tried to find a solution on the internet but without any success. I also tried to create Transformer
but, as I see, it works fine only for strings (I want to use Datatable or List> at the input):
class BoardTransformer extends Transformer<Board> {
@Override
public Board transform(String value) {
// TODO Auto-generated method stub
return null;
}
}