我有一个非常简单的测试,我正在尝试模拟一个特征。测试甚至没有运行,它失败并出现初始化错误:java.lang.IllegalArgumentException:需求失败:你记得使用 withExpectations 吗?
这是我非常简单的测试:
import org.scalatest._
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.matchers.ShouldMatchers
import org.scalamock.ProxyMockFactory
import org.scalamock.scalatest.MockFactory
@RunWith(classOf[JUnitRunner])
class TurtleSpec extends FunSpec with MockFactory with ProxyMockFactory {
trait Turtle {
def turn(angle: Double)
}
val m = mock[Turtle]
m expects 'turn withArgs (10.0)
describe("A turtle-tester") {
it("should test the turtle") {
m.turn(10.0)
}
}
}