These are chat archives for etorreborre/specs2

8th
Aug 2016
Adelbert Chang
@adelbertc
Aug 08 2016 21:23
has anyone observed NPE from using a matcher with a value class?
everything compiles if its not a value class, doing something like there was one(mockClient).someMethod(Matchers.eq(foo))
then i change it to a value class and get NPE
Eric Torreborre
@etorreborre
Aug 08 2016 21:24
yes this is an instance of this I think: https://issues.scala-lang.org/browse/SI-8097
Adelbert Chang
@adelbertc
Aug 08 2016 21:24
following http://stackoverflow.com/questions/27289757/mockito-matchers-scala-value-class-and-nullpointerexception i tried Matchers.eq(foo.value).asInstanceOf[Foo] but still NPE
@etorreborre does that mean im out of luck
Eric Torreborre
@etorreborre
Aug 08 2016 21:26
any[Object].asInstanceOf[ProductId] is working for us
Adelbert Chang
@adelbertc
Aug 08 2016 21:26
what if theres a specific value i want to match on
Eric Torreborre
@etorreborre
Aug 08 2016 21:26
but it's not using eq
Adelbert Chang
@adelbertc
Aug 08 2016 21:26
i have case class Filename(value: String) extends AnyVal
boooo. guess i wont match with eq then
while i have you , do you know what benefit you get of doing any over any[SomeType] ?
Eric Torreborre
@etorreborre
Aug 08 2016 21:28
they should be the same I think with any inferring any[SomeType]
I'm not sure would have to check the code
yes I think so
Adelbert Chang
@adelbertc
Aug 08 2016 21:29
gotcha
ok so now im just matching on any and its still NPEing. if i make it not a value class it works. there was one(mockClient).someMethod(any)
i also tried adding another (any) at the end since someMethod takes an implicit executioncontext
(sorry i know this isnt the Mockito IRC but i figured you might know something about it having implemented a wrapper around it)
Eric Torreborre
@etorreborre
Aug 08 2016 21:31
and any[Object].asInstanceOf[SomeType] doesn't work?
Adelbert Chang
@adelbertc
Aug 08 2016 21:31
nope
let me try again to make sure
Eric Torreborre
@etorreborre
Aug 08 2016 21:32
then I have no clue. This made us wonder for a while, until we realized that it was a compiler bug
but the workaroud above worked for us
Adelbert Chang
@adelbertc
Aug 08 2016 21:32
still NPE sigh
alright thanks
will dig some more
Eric Torreborre
@etorreborre
Aug 08 2016 21:32
good luck