Mocking in scala generates a java.lang.NoSuchMethodException
<p>Hey I am trying to test the following class :</p>

<pre><code>class Foo {
 def f: Int = 4 + g

 def g: Int = 2
}
</code></pre>

<p>My test is the following:</p>

<pre><code>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)
     }
   }
}
</code></pre>

<p>My test is failing saying that :</p>

<pre><code>java.lang.NoSuchMethodException: Foo.mock$g$0()
java.lang.Class.getMethod(Unknown Source)
...
</code></pre>

<p>I am not sure to see why ...</p>

<p>I am using scalatest and scalamock :</p>

<pre><code>"org.scalatestplus.play" %% "scalatestplus-play" % "1.5.0" % "test"
"org.scalamock" %% "scalamock-scalatest-support" % "3.2.2" % "test"
</code></pre>