I've found only three ways how to enable STRICT_STUBS in Mockito (See documemantation)
-
MockitoJunitRunner -
MockitoJUnit.rule().strictness(Strictness.STRICT_STUBS) -
Mockito.mockitoSession() .initMocks(this) .strictness(Strictness.STRICT_STUBS) .startMocking()
All of them require to declare stubs via annotations (@Mock lateinit var api: MyApi ). But I'm using mockito-kotlin and declare stubs like that:
val api: MyApi = mock()
or like that:
val api:MyApi = mock{
on { call("expected-param") } doReturn something
}
Under the hood it uses Mockit.mock method.
Question 1: how can I enable STRICT_STUBS when I use Mockit.mock ?
Question 2: Perhaps it's possible to enable STRICT_STUBS for everything regardless how mock is defined?
Aucun commentaire:
Enregistrer un commentaire