我更新了我的问题,删除了旧文本以使其更易于阅读。
scalaVersion := "2.10.1"
"org.specs2" %% "specs2" % "1.13" % "test"
我的spec2测试:
package com.mycompany.dataminer.parser
import org.specs2.mutable.Specification
case class Product(productID:String)
class SimpleTest extends Specification {
"product" should {
"have id = 123" in {
var product1 = Product("123")
product1 must not beNull
product1.productID must_== "123"
var product2 = Product("123")
product2 must not beNull
product2.productID must_== "123"
var product3 = Product("123")
product3 must not beNull
product3.productID must_== "123"
}
}
}
结果:
scala: type mismatch;
found : String
required: org.specs2.matcher.Matcher[com.mycompany.dataminer.parser.Product]
product1.productID must_== "123"
^
一旦我编写了这段代码,它就可以工作,直到我添加以下行:
product1 must not beNull
product2 must not beNull
product3 must not beNull