title: Cannot mock WSRequest.post() using scalamock
body: <p>I am writing unit tests for Play application using Scalamock and Scalatest.</p>
  
  <p>My original code looks like:</p>
  
  <pre><code>// Here ws is an injected WSClient
  val req = Json.toJson(someRequestObject)
  val resp: Future[WSResponse] = ws.url(remoteURL).post(Json.toJson(req))
  </code></pre>
  
  <p>In a part I have to mock external calls to a web service, which I am trying to do using scalamock:</p>
  
  <pre><code>ws = stub[WSClient]
  wsReq = stub[WSRequest]
  wsResp = stub[WSResponse]
  
  ws.url _ when(*) returns wsReq
  wsReq.withRequestTimeout _ when(*) returns wsReq
  (wsReq.post (_: java.io.File)).when(*) returns Future(wsResp)
  </code></pre>
  
  <p>I am successfully able to mock post requests using a file, but I cannot mock post requests using JSON.</p>
  
  <p>I tried putting stub function references separately like:</p>
  
  <pre><code>val f: StubFunction1[java.io.File, Future[WSResponse]] = wsReq.post (_: java.io.File)
  
  val j: StubFunction1[JsValue, Future[WSResponse]] = wsReq.post(_: JsValue)
  </code></pre>
  
  <p>I get the compile error for second line: <code>Unable to resolve overloaded method post</code></p>
  
  <p>What am I missing here? Why cannot I mock one overloaded method but not the other one?</p>