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

Let Testable annotation target any declaration element type #2392

Merged
merged 1 commit into from
Sep 9, 2020

Conversation

sormuras
Copy link
Member

@sormuras sormuras commented Aug 23, 2020

Closes #2391

Overview


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


Definition of Done

@sormuras sormuras requested a review from mmerdes August 23, 2020 06:17
@codecov
Copy link

codecov bot commented Aug 23, 2020

Codecov Report

❗ No coverage uploaded for pull request base (main@68bb2e3). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2392   +/-   ##
=======================================
  Coverage        ?   89.84%           
  Complexity      ?     4549           
=======================================
  Files           ?      397           
  Lines           ?    11250           
  Branches        ?      908           
=======================================
  Hits            ?    10108           
  Misses          ?      864           
  Partials        ?      278           
Impacted Files Coverage Δ Complexity Δ
...t/platform/console/tasks/FlatPrintingListener.java 94.59% <0.00%> (ø) 16.00% <0.00%> (?%)
.../params/converter/ArgumentConversionException.java 50.00% <0.00%> (ø) 1.00% <0.00%> (?%)
...iter/params/provider/CsvFileArgumentsProvider.java 92.42% <0.00%> (ø) 9.00% <0.00%> (?%)
.../jupiter/api/condition/DisabledOnJreCondition.java 100.00% <0.00%> (ø) 3.00% <0.00%> (?%)
...jupiter/params/provider/EnumArgumentsProvider.java 100.00% <0.00%> (ø) 15.00% <0.00%> (?%)
...n/java/org/junit/jupiter/api/DynamicContainer.java 100.00% <0.00%> (ø) 5.00% <0.00%> (?%)
.../java/org/junit/platform/commons/function/Try.java 89.28% <0.00%> (ø) 7.00% <0.00%> (?%)
...nit/jupiter/engine/execution/MethodInvocation.java 100.00% <0.00%> (ø) 6.00% <0.00%> (?%)
...gine/discovery/predicates/IsTestFactoryMethod.java 100.00% <0.00%> (ø) 1.00% <0.00%> (?%)
...a/org/junit/platform/commons/util/ClassFilter.java 100.00% <0.00%> (ø) 8.00% <0.00%> (?%)
... and 387 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 68bb2e3...9163cd2. Read the comment docs.

@sormuras
Copy link
Member Author

Note to myself: add test class with many @Testable usages ... for every valid annotatable element.

@sormuras sormuras marked this pull request as ready for review September 9, 2020 08:55
@sormuras sormuras removed the request for review from mmerdes September 9, 2020 09:03
Prior to this commit the usage of `@Testable` was restricted to
declarations of types, methods, and fields. As custom test engines
may use different element types as their "testable constructs",
this restriction is lifted in backward and future-compatible manner.
By dropping the `@Target` annotation, the default behaviour as
defined by the Java Language Specification applies:

  If an annotation of type java.lang.annotation.Target is not present
  on the declaration of an annotation type T, then T is applicable in
  all declaration contexts except type parameter declarations, and in
  no type contexts.

https://docs.oracle.com/javase/specs/jls/se8/html/jls-9.html#jls-9.6.4.1

Closes #2391
@sormuras sormuras force-pushed the issues/2391-testable-for-all branch from 8a3ea31 to 9163cd2 Compare September 9, 2020 10:52
@sormuras sormuras requested a review from marcphilipp September 9, 2020 10:53
@sormuras sormuras merged commit a245da0 into main Sep 9, 2020
@sormuras sormuras deleted the issues/2391-testable-for-all branch September 9, 2020 14:36
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.

Let @Testable target any declaration element type
2 participants