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

Introduce InvocationInterceptor extension API #1852

Merged
merged 1 commit into from
Apr 14, 2019

Conversation

marcphilipp
Copy link
Member

@marcphilipp marcphilipp commented Apr 8, 2019

Overview

The new extension API allows intercepting the invocation of test class
constructors, lifecycle methods, testable methods, and dynamic tests.
It validates that an invocation is asked to proceed exactly once. The
user guide is updated with an example that executes all test methods in
Swing's EDT.

Resolves #157.


I hereby agree to the terms of the JUnit Contributor License Agreement.


Definition of Done

Copy link
Member

@sbrannen sbrannen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this and submitting the PR!

I think this is coming along very nicely.

I haven't reviewed it yet in an IDE, so my comments here are based solely on what I can see in the browser.

@marcphilipp
Copy link
Member Author

FYI The JaCoCo issue was caused by InvocationInterceptor being the first Extension interface with default methods.

@sbrannen
Copy link
Member

FYI The JaCoCo issue was caused by InvocationInterceptor being the first Extension interface with default methods.

Ahhhh.... nice detective work!

And... I saw your commit to fix it... exactly like I'd have done. 😉

So glad they added Predicate.negate() in Java 11.

@sbrannen
Copy link
Member

But... wait!

Didn't TestWatcher originally have default methods?

Speaking of that, @junit-team/junit-lambda, why does TestWatcher not have empty default methods? 🤔

@marcphilipp
Copy link
Member Author

I was wondering that, too. It looks like it had default methods in the initial proposal but they were removed later in the PR.

@marcphilipp
Copy link
Member Author

@geo-m Do you remember?

@sbrannen
Copy link
Member

I was wondering that, too. It looks like it had default methods in the initial proposal but they were removed later in the PR.

That would explain why the same JaCoCo problem appeared and then magically disappeared back then.

In any case, I think we should make those methods default methods again.

I realize I'm hijacking this PR on this topic now, but...

@junit-team/junit-lambda, any objections to making that change?

@marcphilipp
Copy link
Member Author

None from me.

@sbrannen
Copy link
Member

None from me.

Good, 'cause I've already made the change on my machine. 😇

@codecov
Copy link

codecov bot commented Apr 13, 2019

Codecov Report

Merging #1852 into master will decrease coverage by 0.14%.
The diff coverage is 79.71%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1852      +/-   ##
============================================
- Coverage     91.55%   91.41%   -0.15%     
- Complexity     4097     4119      +22     
============================================
  Files           344      348       +4     
  Lines          9773     9876     +103     
  Branches        798      801       +3     
============================================
+ Hits           8948     9028      +80     
- Misses          630      651      +21     
- Partials        195      197       +2
Impacted Files Coverage Δ Complexity Δ
...piter/engine/descriptor/JupiterTestDescriptor.java 89.28% <ø> (+0.76%) 23 <0> (-1) ⬇️
...t/jupiter/api/extension/InvocationInterceptor.java 0% <0%> (ø) 0 <0> (?)
...r/engine/descriptor/TestFactoryTestDescriptor.java 94.73% <100%> (+0.09%) 20 <1> (ø) ⬇️
...it/jupiter/engine/execution/ExecutableInvoker.java 94.28% <100%> (+3.37%) 21 <4> (+1) ⬆️
...nit/jupiter/engine/execution/MethodInvocation.java 100% <100%> (ø) 6 <6> (?)
...scriptor/TestTemplateInvocationTestDescriptor.java 100% <100%> (ø) 7 <2> (+1) ⬆️
...er/engine/descriptor/TestMethodTestDescriptor.java 96.94% <100%> (+0.07%) 43 <0> (ø) ⬇️
...r/engine/descriptor/DynamicTestTestDescriptor.java 100% <100%> (ø) 6 <4> (+3) ⬆️
...r/engine/descriptor/DynamicNodeTestDescriptor.java 100% <100%> (ø) 4 <1> (ø) ⬇️
...ter/engine/descriptor/DynamicExtensionContext.java 33.33% <33.33%> (ø) 2 <2> (?)
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7160ab7...bb79507. Read the comment docs.

The new extension API allows intercepting the invocation of test class
constructors, lifecycle methods, testable methods, and dynamic tests.
It validates that an invocation is asked to proceed exactly once. The
user guide is updated with an example that executes all test methods in
Swing's EDT.

Resolves #157.
@marcphilipp marcphilipp force-pushed the issues/157-invocation-interceptor branch from 3fc8eb5 to bb79507 Compare April 14, 2019 13:01
@marcphilipp marcphilipp merged commit bb79507 into master Apr 14, 2019
@marcphilipp marcphilipp deleted the issues/157-invocation-interceptor branch April 14, 2019 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce extension API for executing test in user-defined thread
3 participants