mardi 14 août 2018

How to convert Cucumber DataTable with more than two collumns to changeable list of lists?

I've got Cucumber DataTable like that:

Do something:
  | example | of            | datatable |
  | for     | stackoverflow | com       |

There is my java code:

public void someMethod(DataTable dataTable) {
    List<List<String>> rows = new ArrayList(dataTable.asLists(String.class));
    ...

List "rows" is changeable now, but sublists are unchanheable. How could i make them changeable without creating new fields? I want to be able to set values to sublist elements, like that:

rows.get(0).set(0, "new value");

Now this code throws UnsupportedOperationException

Aucun commentaire:

Enregistrer un commentaire