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

Replace @InjectMock with @Mock in MockitoExtension #5

Closed
smoyer64 opened this issue Jun 18, 2016 · 4 comments
Closed

Replace @InjectMock with @Mock in MockitoExtension #5

smoyer64 opened this issue Jun 18, 2016 · 4 comments

Comments

@smoyer64
Copy link
Contributor

smoyer64 commented Jun 18, 2016

It would be cleaner to use @Mock instead of JUnit's custom @InjectMock annotation to request mock creation for both FIELD and PARAMETER declarations.

This feature request is currently blocked by mockito/mockito#438.

@sbrannen
Copy link
Member

@smoyer64, thanks so much for raising the issue with the Mockito team! 👍

That's something we've been meaning to do for almost half a year now but kept forgetting to follow up on. 😉

@smoyer64
Copy link
Contributor Author

smoyer64 commented Jun 18, 2016

No problem ... until I'm competent with the core JUnit 5 code, I figure there are other ways I can help. Since you've stated several times that the MockitoExtension is not production code, I figured there had been compromises ... if it bugs me, it probably bugs other people.

In any case, JUnitParams and Mockito are two libraries I use in almost every project - and they have been able to run together since mock injection could be done via a @rule (JUnitParams has to be a runner to overcome the prohibition against test methods having parameters). In any case, I'd also love to create a JUnitParamsExtension but JUnit 5 isn't quite ready for it. I'm working on a proposal with a corresponding PoC for a couple callbacks that will make the JUnitParamsExtension possible:

  • AfterAllDiscoveryCallback
  • AfterEachDiscoveryCallback

It's not completely altruistic - I also need something like this for upREST.

@sbrannen
Copy link
Member

Sounds good. Keep us posted on your progress!

@sbrannen
Copy link
Member

Resolved in 039d920.

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

No branches or pull requests

2 participants