Questions tagged [mockito-scala]

Mockito Scala is an open source mocking framework for Scala test development. It is a rewrite of the Mockito framework for Java.

Mockito Scala is an open source mocking framework for Scala test development. It is a rewrite of the Mockito framework for Java.

20 questions
0
votes
1 answer

Stubbing multi parameters method with mockito-scala

I am trying to stub a method with three parameters to return different responses regarding one of those parameters: val mocked = mock[MyService] mocked.someInitialization returns mock[State] mocked.complexMethod(*, *, *) answers { (_:State,…
gervais.b
  • 2,294
  • 2
  • 22
  • 46
0
votes
2 answers

Mockito: 0 matchers expected, 1 recorded

I have the folliwng PlaySpec: "Service A" must { "do the following" in { val mockServiceA = mock[ServiceA] val mockServiceB = mock[ServiceB] when(mockServiceA.applyRewrite(any[ClassA])).thenReturn(resultA) // case A …
Niko
  • 616
  • 4
  • 20
0
votes
1 answer

Scala Cats spy a method with mockito-scala-cats

I am trying to mock a method with mockito-scala-cats For example this is my class class MyService { def getProperty(property: String): Either[Future, String, ExternalUser] = ??? } and the test class class MyServiceSpec extends FunSpec with…
agusgambina
  • 6,229
  • 14
  • 54
  • 94
0
votes
1 answer

How to mock fields of inner singleton objects?

Given the following code snippet class Config { private val conf = ConfigFactory.load() object Http { val host = conf.getString("http.host") val port = conf.getInt("http.port") } } how can host and port fields of inner singleton…
Mario Galic
  • 47,285
  • 6
  • 56
  • 98
-2
votes
1 answer

Getting Null Pointer Exception while mocking a class in scala using MockitoSugar

When I mock a class in scala using MockitoSugar and try to access that mock object, I am getting Null Pointer Exception. import org.apache.hadoop.hbase.util.Pair; class JobSpec extends FunSpec with MockitoSugar { var pairType:…
shrishyl47
  • 161
  • 1
  • 1
  • 13
1
2