You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can't see any equivalent way of doing this in mockito-kotlin when using the mock() helper. Which leads us to generally just call reset in our @After method.
val mockFoo:Foo= mock()
val mockBar:Bar= mock()
@After
funtearDown() {
reset(
mockFoo,
mockBar
)
}
The problem is, we always get problems where people (usually me) add extra mocks and then forget to update the reset.
I am wondering if mockito-kotlin supports this use case, or could do so? If there is no existing solution, I was wondering if using Kotlin property delegates could help, as we could use them to register the mock with some object on assignment, and then call that object to reset all the mocks.
The text was updated successfully, but these errors were encountered:
In Java code, when declaring mocks with annotations, it's possible to reset all mocks at once, like this:
I can't see any equivalent way of doing this in mockito-kotlin when using the
mock()
helper. Which leads us to generally just callreset
in our@After
method.The problem is, we always get problems where people (usually me) add extra mocks and then forget to update the reset.
I am wondering if mockito-kotlin supports this use case, or could do so? If there is no existing solution, I was wondering if using Kotlin property delegates could help, as we could use them to register the mock with some object on assignment, and then call that object to reset all the mocks.
The text was updated successfully, but these errors were encountered: