I have following validation in scalatest based unit test:
response shouldBe Some(any[Long])
I just need to check that response is of type Some containing any long value.
But it fails as:
Expected :Some(null)
Actual :Some(1635758033586)
What is correct way of doing it?
It seems that you are combining mockito matchers with scala-test matchers. It won't work in this case.
If your value of long
is different in each test run, you could just assert its presence.
response.isDefined shouldBe true
If value of the long
is the same, assert it with a literal
response shouldEqual Some(1635758033586)