Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added stub extension function #158

Merged
merged 2 commits into from
Apr 1, 2017
Merged

Added stub extension function #158

merged 2 commits into from
Apr 1, 2017

Conversation

pbochenski
Copy link

@pbochenski pbochenski commented Mar 30, 2017

with this method one can define mock for class

val someMock = mock<Object>()

and then define stubs in test

someMock.stub { on { something } doReturn somethingElse }

It is useful when some tests reuse mock object but with different stubbing

with this method one can define mock for class

val someMock = mock<Object>()

and then define stubs in test

someMock.stub {
	on { something } doReturn somethingElse
}

It is useful when some tests reuse mock object but with different stubbing
@nhaarman
Copy link
Collaborator

Nice idea! Could you perhaps add some regression tests, like https://github.com/nhaarman/mockito-kotlin/blob/master/mockito-kotlin/src/test/kotlin/test/MockitoTest.kt#L375 ?

@nhaarman nhaarman changed the base branch from master to dev March 31, 2017 19:02
@pbochenski
Copy link
Author

please let me know if this is enough, or should I add all variants of stubbing to this.

@nhaarman
Copy link
Collaborator

nhaarman commented Apr 1, 2017

Spot on, thanks!

@nhaarman nhaarman merged commit 0b22ec3 into mockito:dev Apr 1, 2017
@nhaarman nhaarman mentioned this pull request Apr 1, 2017
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