Mockito matchers, scala value class and NullPointerException

后端 未结 6 1933
遇见更好的自我
遇见更好的自我 2020-12-15 04:16

I\'m using mockito with scalatest. I have following problem when using matcher with value class.

import org.scalat         


        
6条回答
  •  时光取名叫无心
    2020-12-15 05:06

    If you have shapeless in your dependencies you could consider my little helper method: https://gist.github.com/Fristi/bbc9d0e04557278f8d19976188a0b733

    Instead of writing

    UserId(is(context.userId.value))

    You can write

    isAnyVal(context.userId)

    Which is a bit more convenient :-)

提交回复
热议问题