Closed krichter722 closed 5 years ago
This is because the someMethod
is non-open - thus final - making it impossible for Mockito to stub the implementation. The pure Java project probably doesn't have the final
modifier for someMethod
, making it succeed there.
Either make it open
, use the 'all-open' plugin, or Mockito's mock-maker-inline.
In a test
testing
and
the verification fails because
someMethod
is invoked with an empty string, probably taken instead ofanyString
inverify(someService).someMethod(anyString())
.The verification should succeed because the method has been invoked with a non-blank string. It does so when using Mockito 2.27.0 in a pure Java project.
An SSCCE can be found at https://gitlab.com/krichter/mockito-kotlin-verify-mock-method-invoked/ (CI output at https://gitlab.com/krichter/mockito-kotlin-verify-mock-method-invoked/-/jobs/214957830).
experienced with 2.1.0