Hey I am trying to test the following class :
Class Foo {
def f: Int = 4+g()
def g: Int = 2
}
My test is the following:
class FooSpec extends PlaySpec with MockFactory {
val foo = new Foo()
"Foo" must {
"Call function f" in {
(foo.g())
.expects()
.once()
.returns(5)
foo.f must be (9)
}
}
}
My test is failing saying that :
java.lang.NoSuchMethodException: Foo.mock$g$0()
java.lang.Class.getMethod(Unknown Source)
...
I am not sure to see why ...
I am using scalatest and scalamock :
"org.scalatestplus.play" %% "scalatestplus-play" % "1.5.0" % "test"
"org.scalamock" %% "scalamock-scalatest-support" % "3.2.2" % "test"
Aucun commentaire:
Enregistrer un commentaire