I had an issue a couple of weeks ago while migrating some code from using bare Map[String, String]
to a value class surrounding that map (HttpHeaders), and ran into issues with Mockito (even with the Specs2 helpers).
Long story short I was able to fix it with the following changes:
-any[HttpHeaders] +Matchers.any(classOf[Map[_, _]]).asInstanceOf[HttpHeaders])
-when(request.headers) - .thenReturn(HttpHeaders.empty) +when(request.headers.underlying) + .thenReturn(Map.empty[HttpHeader[_], Vector[String]])