title: Mockito stubbing method with value class argument fails with NullPointerException
body: <p>Using typed value classes as IDs is a common pattern in Scala. However, it seems Mockito has an issue when stubbing methods that take value classes as arguments. In the example below, the first stub, with an actual value works just fine, but the second one, that uses an argument matcher throws NullPointerException.</p>
  
  <p>The only reference to this I've found is <a href="https://stackoverflow.com/questions/27289757/mockito-matchers-scala-value-class-and-nullpointerexception">this question</a> but the solution shown there does not work. Anyone knows a solution to this, or a work-around?</p>
  
  <p>Versions are: <strong>org.mockito:mockito-all:1.10.19</strong> and <strong>org.specs2:specs2_2.11:2.4.15</strong></p>
  
  <pre class="lang-scala prettyprint-override"><code>import org.specs2.mutable.Specification
  import org.specs2.matcher.Matchers
  import org.specs2.mock.Mockito
  
  case class ID[T](val id:Long) extends AnyVal
  
  trait DAO[T]{
    def get(id:ID[T]):T
  }
  
  class MockitoIDStubTest extends Specification with Mockito with Matchers{
    "Mockito" should{
      "properly stub with argument value" in {
        val m = mock[DAO[String]
        m.get(ID[String](1)).returns("abc")
        m.get(ID[String](1)) must_== "abc"
      }
      "properly stub with argument matcher" in {
        val m = mock[DAO[String]
        m.get(any[ID[String]]).returns("abc")
        m.get(ID[String](1)) must_== "abc"
      }
    }
  }
  </code></pre>
  
  <blockquote>
    <p>[info] Mockito should</p>
    
    <p>[info] + properly stub with argument value</p>
    
    <p>[info] ! properly stub with argument matcher</p>
    
    <p>[error] NullPointerException:(MockitoIDStubTest.scala:20)</p>
    
    <p>[error] MockitoIDStubTest$$anonfun$1$$anonfun$apply$5$$anonfun$apply$6.apply( MockitoIDStubTest.scala:20)</p>
  </blockquote>