如何将cucumber.api.Datable转换为List ,并在数据表中包含2个以上的col

Gherkin声明是:

And Instruments,Shareprice,Quantities to be added are |name |sal |address| |xyz |100 |Greek | |abc |200 |Italy | 

步骤def是:

 @Given("My emp details are $") public void my_emp_details_are(DataTable arg1) throws Throwable { List lstemp= arg1.asList(EMP.class); } 

生成exception:cucumber.runtime.CucumberException:没有这样的字段datastructure.EMP.emps

EMP是3个领域的class级:

嘿,我是Java新手我看过asList()文档我不理解公共列表asList(Class itemType)

类型参数:T – 列表项的类型参数:itemType – 列表项的类型

作为替代方案,您可以将List作为输入参数而无需进一步转换。

 @Given("My emp details are $") public void my_emp_details_are(List lstemp) throws Throwable {} 

如果您的EMP有3个字段(使用setter方法)名称,sal和地址