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

Add existing MockitoExtension prototype #43

Closed
smoyer64 opened this issue May 9, 2017 · 8 comments
Closed

Add existing MockitoExtension prototype #43

smoyer64 opened this issue May 9, 2017 · 8 comments
Assignees
Labels
⚙️ component: Jupiter Issues coming from (internal/official) Jupiter features etc. 📖 theme: extensions 🏗️ type: enhancement

Comments

@smoyer64
Copy link
Member

smoyer64 commented May 9, 2017

I'm using the MockitoExtension code in several of my projects but since it's not published anywhere and it's not included in Mockito, I'm copying and pasting it into each project. The MockitoExtension is currently slated for inclusion in Mockito 3. Adding the prototype MockitoExtension to Pioneer would provide the following benefits:

  1. Provide a maintained version of MockitoExtension that's available via Maven Central.
  2. Provide more experience with Mockito and JUnit 5 (currently we don't know how the MockitoExtension is being altered by those using it - hopefully there would be issues/PRs submitted against a maintained version.

References mockito/mockito#445 and mockito/mockito#438.

@nipafx
Copy link
Member

nipafx commented May 12, 2017

That's a good idea.

If I remember correctly we wanted to adopt upstream's @Api annotation, so I don't think a designated package is necessary. However we decide, since it's not a hard requirement, I'll remove it from the title.

@nipafx nipafx changed the title Add MockitoExtension to an experimental package Add existing MockitoExtension prototype May 12, 2017
@sormuras
Copy link
Member

In case you're referring to @API mentioned junit-team/junit5#436 -- we're considering the move that annotation to a top-level project (maybe under the https://github.com/ota4j-team umbrella).

@smoyer64
Copy link
Member Author

@sormuras - I've been following that issue and intend to adopt @API in UpREST. Since I'm also planning to move upREST here, I think we'll end up with some nice consistency.

@nipafx
Copy link
Member

nipafx commented May 12, 2017

@sormuras Yes, that @API. Having it in OTA4J would be great!

@smoyer64
Copy link
Member Author

Looking at this a little more closely, adding the MockitoExtension to the core junit-pioneer project would violate our "no-dependencies" rule as there are a few Mockito classes that need to be included. Mockito is specified as a test-scoped dependency so if we're going to do this we'll need a separate project OR we'll need to relax that rule.

@nipafx
Copy link
Member

nipafx commented Aug 26, 2017

Looking at this a little more closely, adding the MockitoExtension to the core junit-pioneer project would violate our "no-dependencies" rule as there are a few Mockito classes that need to be included.

True, I overlooked that as well.

Mockito is specified as a test-scoped dependency so if we're going to do this we'll need a separate project OR we'll need to relax that rule.

I see a third option: We can make the dependency compileOnly, so Pioneer would not pull in Mockito but still work with it. Of course this creates the risk that people not using Mockito start using Pioneer's Mockito-related features (thus crashing their test execution), but I think in this case that's acceptable because (a) it is not very likely and (b) it would fail very fast and loud.

@smoyer64
Copy link
Member Author

True ... we should also be able to check to see if the needed classes are loaded instead of crashing.

@nipafx nipafx added 🏗️ type: enhancement ⚙️ component: Jupiter Issues coming from (internal/official) Jupiter features etc. labels May 2, 2018
@Bukama
Copy link
Member

Bukama commented Jul 20, 2020

This is a quite old issue and after reading through the linked issues (and there linked issues again) I think this here can be closed.

Mockito 3.x was released long time ago and provides very good JUnit5 integration. There were several feature requests raised by @smoyer64 in the Mockito project to improve the integration and they were all implemented. The JUnit team (especially @marcphilipp and @sbrannen) where also very active there.

Should I have overseen something we can still reopen this.

@Bukama Bukama closed this as completed Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚙️ component: Jupiter Issues coming from (internal/official) Jupiter features etc. 📖 theme: extensions 🏗️ type: enhancement
Projects
None yet
Development

No branches or pull requests

4 participants