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

Document Mockito.after() method #91

Closed
mockitoguy opened this issue Sep 29, 2014 · 5 comments
Closed

Document Mockito.after() method #91

mockitoguy opened this issue Sep 29, 2014 · 5 comments

Comments

@mockitoguy
Copy link
Member

mockitoguy commented Sep 29, 2014

Document Mockito.after() method. Add TODO that we should rename it in 2.0 into 'during'

@bric3
Copy link
Contributor

bric3 commented Sep 30, 2014

I still like the after method, can't we just keep it as an alias ?

@mockitoguy
Copy link
Member Author

In this case, I'd rather have a single opinionated method (unless I'm convinced otherwise :).

How about this:

mock(foo, after(10).times(2)).bar()
VS
mock(foo, during(10).times(2)).bar()

It feels that 'after' has higher chance of producing ambiguous looking test code.

@mockitoguy
Copy link
Member Author

Also, 'after' can be interpreted as:

  1. wait given amount of time
  2. then validate invocations that happen after the time period (e.g. excluding invocations that happened during the time).

AFAIR the implementation does not work this way. The impl expects the invocation(s) 'during' this time :)

@bric3
Copy link
Contributor

bric3 commented Sep 30, 2014

ok I agree, I now remember what this call did. Never mind my original comment.

However, looking at your example, it would feel better if an alias could support TimeUnit.

mock(foo, during(10).times(2)).bar()
mock(foo, during(10, SECONDS).times(2)).bar()

@mockitoguy
Copy link
Member Author

Yeah, this kind of alias makes perfect sense.

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

No branches or pull requests

2 participants