Skip to content

Conversation

@sghill
Copy link
Contributor

@sghill sghill commented Aug 9, 2016

Recent versions of Mockito break with mockito-kotlin because of changes in mockito/mockito#404:

  • org.mockito.internal.util.MockUtil is now a static utility class
  • org.mockito.Mockito#stub has been removed in favor of #when

This change updates mockito-kotlin to not instantiate MockUtil and aliases com.nhaarman.mockito_kotlin.stub to com.nhaarman.mockito_kotlin.whenever, which was suggested by the docs.

I think it may be better to remove the stub method all together, since Mockito has chosen to do that, but figured this was a safer starting point. Happy to update the PR if that's the better route.


Thank you for submitting a pull request! But first:

  • Can you back your code up with tests? Underlying Mockito API changes; all existing tests pass
  • Keep your commits clean: squash your commits if necessary.
  • Make sure you're targeting the dev branch with the PR.

@nhaarman
Copy link
Collaborator

Thanks!

Merely replacing the stub call by whenever will still break any client's code since their return types differ.

Since this library is essentially a wrapper for the original Mockito library, I think we should indeed remove the stub method and keep the api one-on-one.

* org.mockito.internal.util.MockUtil is now a static utility class
* org.mockito.Mockito#stub has been removed in favor of #when
@sghill sghill force-pushed the mockito-2.0.99-beta branch from 26f36c3 to 2f94f52 Compare August 11, 2016 20:17
@sghill
Copy link
Contributor Author

sghill commented Aug 11, 2016

Sounds good to me -- PR has been updated to remove stub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants