lundi 1 février 2016

scala mockito, verify args - Wanted but not invoked MockitoSugar

 class MockitoTest extends MockitoSugar {

  val serviceMock = mock[Service]

  @Test
  def test(): Unit = {

    import org.mockito.Matchers.{eq => eqTo, _} 

    val serviceMock = mock[Service]

    when( serviceMock.call("one") ).
              thenReturn("123")

    verify( serviceMock, times(1) ).call( eqTo("one") )

    val result1 = serviceMock.call("one")
    ...

I end up having:

Wanted but not invoked: service.call("one"); -> at mockito.MockitoTest.test(MockitoTest.scala:34) Actually, there were zero interactions with this mock.

Do I miss something?

Aucun commentaire:

Enregistrer un commentaire