5
나는 아주 간단한 테스트를하고 있으며 나는 특성을 조롱하려고 노력하고있다. 테스트가 실행되지 않고 초기화 오류로 실패합니다. java.lang.IllegalArgumentException : 요구 사항 실패 : withExpectations를 사용하여 기억 했습니까? 여기ScalaMock 프록시 모의를 사용하려면 어떻게해야합니까?
내 아주 간단한 테스트입니다 :
당신이 resetMocks를 호출 할 필요가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)
}
}
}