scala无法构造scala选项
我在cucumber的专题中有以下数据:scala无法构造scala选项,scala,cucumber,Scala,Cucumber,我在cucumber的专题中有以下数据: | deal | mir | stp1 | stp2 | date | mnt | | 1255 | 120 | 1 | 1 | 2018-01-01 | 120 | 我在那个案例课上读到的 case class test1 (deal : String, mir: String, stp1:String, stp2: String, date: Sttring, mnt:Option[String]) 在我的步骤定义中,我是
| deal | mir | stp1 | stp2 | date | mnt |
| 1255 | 120 | 1 | 1 | 2018-01-01 | 120 |
我在那个案例课上读到的
case class test1 (deal : String, mir: String, stp1:String, stp2: String, date: Sttring, mnt:Option[String])
在我的步骤定义中,我是这样理解的:
Given("""^I have this data$""") {dt: DataTable =>
val dt_lists = dt.asList(classOf[test1 ])
}
| deal | mir | stp1 | stp2 | date | mnt |
| 1255 | 120 | 1 | 1 | 2018-01-01 | 120 |
问题:当我在我的数据中放入选项[String]的“mnt”时,如下所示:
Given("""^I have this data$""") {dt: DataTable =>
val dt_lists = dt.asList(classOf[test1 ])
}
| deal | mir | stp1 | stp2 | date | mnt |
| 1255 | 120 | 1 | 1 | 2018-01-01 | 120 |
我有一个错误:cucumber.runtime.CucumberException:cucumber.deps.com.thoughtworks.xstream.ConversionException:无法构造scala.Option:scala.Option:无法构造scala.Option
当我从数据中检索“mnt”时:
| deal | mir | stp1 | stp2 | date |
| 1255 | 120 | 1 | 1 | 2018-01-01 |
在这种情况下,程序工作正常
欢迎提供任何帮助,谢谢我很惊讶您为什么要将
数据表
转换为案例类
。如果您打算使用每个字段,您可以这样做
`