How to convert cucumber.api.Dable to a <MyClass> list with more than 2 col in datatable
Hunter Statement:
And Instruments,Shareprice,Quantities to be added are |name |sal |address| |xyz |100 |Greek | |abc |200 |Italy | Def step:
@Given("My emp details are $") public void my_emp_details_are(DataTable arg1) throws Throwable { List<EMP> lstemp= arg1.asList(EMP.class); } Exception: cucumber.runtime.CucumberException: There is no such field data structure .EMP.emps
EMP is a class with three fields:
Hi, I am new to Java, I saw asList () Documentation, I did not understand the open list asList (class itemType)
Enter parameters: T - type of list items Parameters: itemType - type of list items
0
Sagar varule
source share1 answer
Alternatively, you can get the list as an input parameter without further conversion.
@Given("My emp details are $") public void my_emp_details_are(List<EMP> lstemp) throws Throwable {} if you EMP has 3 fields (using setter methods) name, sal and address
+3
Miguel puyol
source share