From 0e478b2419ab4fc09159a008c992164dae9d1f37 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 14 Aug 2024 11:41:36 +0200 Subject: [PATCH 001/611] Back to snapshots for further development --- gradle.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 64c03b28007a..1ea6fe5cdd9c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,13 +1,13 @@ group = org.junit -version = 5.11.0 +version = 5.12.0-SNAPSHOT jupiterGroup = org.junit.jupiter platformGroup = org.junit.platform -platformVersion = 1.11.0 +platformVersion = 1.12.0-SNAPSHOT vintageGroup = org.junit.vintage -vintageVersion = 5.11.0 +vintageVersion = 5.12.0-SNAPSHOT # We need more metaspace due to apparent memory leak in Asciidoctor/JRuby # The exports are needed due to https://github.com/diffplug/spotless/issues/834 From f47aabe0202db22bc26ceb1191c9241ed9aedd4c Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 8 Aug 2024 10:31:13 +0200 Subject: [PATCH 002/611] Add initial 5.12.0-M1 release notes from template --- .../docs/asciidoc/release-notes/index.adoc | 2 + .../release-notes-5.12.0-M1.adoc | 67 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc diff --git a/documentation/src/docs/asciidoc/release-notes/index.adoc b/documentation/src/docs/asciidoc/release-notes/index.adoc index 13488c0b0177..2bfebc61c8d9 100644 --- a/documentation/src/docs/asciidoc/release-notes/index.adoc +++ b/documentation/src/docs/asciidoc/release-notes/index.adoc @@ -17,6 +17,8 @@ authors as well as build tool and IDE vendors. include::{includedir}/link-attributes.adoc[] +include::{basedir}/release-notes-5.12.0-M1.adoc[] + include::{basedir}/release-notes-5.11.0.adoc[] include::{basedir}/release-notes-5.10.2.adoc[] diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc new file mode 100644 index 000000000000..89a1753a5280 --- /dev/null +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -0,0 +1,67 @@ +[[release-notes-5.12.0-M1]] +== 5.12.0-M1 + +*Date of Release:* ❓ + +*Scope:* ❓ + +For a complete list of all _closed_ issues and pull requests for this release, consult the +link:{junit5-repo}+/milestone/75?closed=1+[5.12.0-M1] milestone page in the +JUnit repository on GitHub. + + +[[release-notes-5.12.0-M1-junit-platform]] +=== JUnit Platform + +[[release-notes-5.12.0-M1-junit-platform-bug-fixes]] +==== Bug Fixes + +* ❓ + +[[release-notes-5.12.0-M1-junit-platform-deprecations-and-breaking-changes]] +==== Deprecations and Breaking Changes + +* ❓ + +[[release-notes-5.12.0-M1-junit-platform-new-features-and-improvements]] +==== New Features and Improvements + +* ❓ + + +[[release-notes-5.12.0-M1-junit-jupiter]] +=== JUnit Jupiter + +[[release-notes-5.12.0-M1-junit-jupiter-bug-fixes]] +==== Bug Fixes + +* ❓ + +[[release-notes-5.12.0-M1-junit-jupiter-deprecations-and-breaking-changes]] +==== Deprecations and Breaking Changes + +* ❓ + +[[release-notes-5.12.0-M1-junit-jupiter-new-features-and-improvements]] +==== New Features and Improvements + +* ❓ + + +[[release-notes-5.12.0-M1-junit-vintage]] +=== JUnit Vintage + +[[release-notes-5.12.0-M1-junit-vintage-bug-fixes]] +==== Bug Fixes + +* ❓ + +[[release-notes-5.12.0-M1-junit-vintage-deprecations-and-breaking-changes]] +==== Deprecations and Breaking Changes + +* ❓ + +[[release-notes-5.12.0-M1-junit-vintage-new-features-and-improvements]] +==== New Features and Improvements + +* ❓ From 3bec90c4148873a55aa12ab056335b60dd641667 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 14 Aug 2024 12:00:36 +0200 Subject: [PATCH 003/611] Truncate release notes for 5.12 --- .../docs/asciidoc/release-notes/index.adoc | 6 - .../release-notes/release-notes-5.10.0.adoc | 25 --- .../release-notes/release-notes-5.10.1.adoc | 60 ------ .../release-notes/release-notes-5.10.2.adoc | 63 ------ .../release-notes/release-notes-5.10.3.adoc | 41 ---- .../release-notes/release-notes-5.11.0.adoc | 181 +----------------- 6 files changed, 2 insertions(+), 374 deletions(-) delete mode 100644 documentation/src/docs/asciidoc/release-notes/release-notes-5.10.0.adoc delete mode 100644 documentation/src/docs/asciidoc/release-notes/release-notes-5.10.1.adoc delete mode 100644 documentation/src/docs/asciidoc/release-notes/release-notes-5.10.2.adoc delete mode 100644 documentation/src/docs/asciidoc/release-notes/release-notes-5.10.3.adoc diff --git a/documentation/src/docs/asciidoc/release-notes/index.adoc b/documentation/src/docs/asciidoc/release-notes/index.adoc index 2bfebc61c8d9..91912975cf2a 100644 --- a/documentation/src/docs/asciidoc/release-notes/index.adoc +++ b/documentation/src/docs/asciidoc/release-notes/index.adoc @@ -20,9 +20,3 @@ include::{includedir}/link-attributes.adoc[] include::{basedir}/release-notes-5.12.0-M1.adoc[] include::{basedir}/release-notes-5.11.0.adoc[] - -include::{basedir}/release-notes-5.10.2.adoc[] - -include::{basedir}/release-notes-5.10.1.adoc[] - -include::{basedir}/release-notes-5.10.0.adoc[] diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.10.0.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.10.0.adoc deleted file mode 100644 index 1c3d7952307f..000000000000 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.10.0.adoc +++ /dev/null @@ -1,25 +0,0 @@ -[[release-notes-5.10.0]] -== 5.10.0 - -*Date of Release:* July 23, 2023 - -*Scope:* - -* Promotion of various experimental APIs to stable -* New `LauncherInterceptor` SPI -* New `testfeed` details mode for `ConsoleLauncher` -* New `ConsoleLauncher` subcommand for test discovery without execution -* Dry-run mode for test execution -* New `NamespacedHierarchicalStore` for use in third-party test engines -* Stacktrace pruning to hide internal JUnit calls -* New `@SelectMethod` support in test `@Suite` classes. -* New `TempDirFactory` SPI for customizing how temporary directories are created -* Failure threshold for `@RepeatedTest` -* New convenience base classes for implementing `ArgumentsProvider` and `ArgumentConverter` -* Custom class loader support for class/method selectors, `@MethodSource`, `@EnabledIf`, - and `@DisabledIf` -* Improved configurability of parallel execution -* Numerous bug fixes and minor improvements - -For complete details consult the -https://junit.org/junit5/docs/5.10.0/release-notes/index.html[5.10.0 Release Notes] online. diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.10.1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.10.1.adoc deleted file mode 100644 index af0ac43916b4..000000000000 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.10.1.adoc +++ /dev/null @@ -1,60 +0,0 @@ -[[release-notes-5.10.1]] -== 5.10.1 - -*Date of Release:* November 5, 2023 - -*Scope:* minor bug fixes and improvements since 5.10.0. - -For a complete list of all _closed_ issues and pull requests for this release, consult the -link:{junit5-repo}+/milestone/72?closed=1+[5.10.1] milestone page in the -JUnit repository on GitHub. - - -[[release-notes-5.10.1-junit-platform]] -=== JUnit Platform - -==== Bug Fixes - -* Field predicates are now applied while searching the type hierarchy. This fixes bugs in - `findFields(...)` and `streamFields(...)` in `ReflectionSupport` as well as - `findAnnotatedFields(...)` and `findAnnotatedFieldValues(...)` in `AnnotationSupport`. - - See link:https://github.com/junit-team/junit5/issues/3532[issue 3532] for details. -* Method predicates are now applied while searching the type hierarchy. This fixes bugs - in `findMethods(...)` and `streamMethods(...)` in `ReflectionSupport` as well as - `findAnnotatedMethods(...)` in `AnnotationSupport`. - - See link:https://github.com/junit-team/junit5/issues/3498[issue 3498] for details. - - -[[release-notes-5.10.1-junit-jupiter]] -=== JUnit Jupiter - -==== Bug Fixes - -* A package-private static field annotated with `@TempDir` is no longer _shadowed_ by a - non-static field annotated with `@TempDir` when the non-static field resides in a - different package and has the same name as the static field. - - See link:https://github.com/junit-team/junit5/issues/3532[issue 3532] for details. -* A package-private class-level lifecycle method annotated with `@BeforeAll` or - `@AfterAll` is no longer _shadowed_ by a method-level lifecycle method annotated with - `@BeforeEach` or `@AfterEach` when the method-level lifecycle method resides in a - different package and has the same name as the class-level lifecycle method. - - See link:https://github.com/junit-team/junit5/issues/3498[issue 3498] for details. -* The `ON_SUCCESS` cleanup mode of `@TempDir` now takes into account failures of test - methods and nested tests when it's declared on the class level, e.g. as a static field. -* The `RandomNumberExtension` example in the - <<../user-guide/index.adoc#extensions-RandomNumberExtension, User Guide>> has been - updated to properly support `Integer` types as well as non-static field injection. - -==== New Features and Improvements - -* Improved Javadoc for `Assertions.assertTimeoutPreemptively` regarding thread interrupt. -* Documentation for `@Disabled` and conditional annotations now explicitly explains that - such annotations are not inherited by subclasses. - - -[[release-notes-5.10.1-junit-vintage]] -=== JUnit Vintage - -==== Bug Fixes - -* Fixed reporting for JUnit 3 test classes that use JUnit 4's `@Ignored` annotation. diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.10.2.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.10.2.adoc deleted file mode 100644 index 1558506cb03c..000000000000 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.10.2.adoc +++ /dev/null @@ -1,63 +0,0 @@ -[[release-notes-5.10.2]] -== 5.10.2 - -*Date of Release:* February 4, 2024 - -*Scope:* minor bug fixes and changes since 5.10.1. - -For a complete list of all _closed_ issues and pull requests for this release, consult the -link:{junit5-repo}+/milestone/73?closed=1+[5.10.2] milestone page in the JUnit repository -on GitHub. - - -[[release-notes-5.10.2-junit-platform]] -=== JUnit Platform - -==== Bug Fixes - -* The `junit-platform-launcher` may now be used as a Java module when - `junit.platform.launcher.interceptors.enabled` is set to `true`. - - See issue link:https://github.com/junit-team/junit5/issues/3561[#3561] for details. - -==== Deprecations and Breaking Changes - -* Field predicates are no longer applied eagerly while searching the type hierarchy. - - This reverts changes made in 5.10.1 that affected `findFields(...)` and - `streamFields(...)` in `ReflectionSupport` as well as `findAnnotatedFields(...)` and - `findAnnotatedFieldValues(...)` in `AnnotationSupport`. - - See issue link:https://github.com/junit-team/junit5/issues/3638[#3638] for details. -* Method predicates are no longer applied eagerly while searching the type hierarchy. - - This reverts changes made in 5.10.1 that affected `findMethods(...)` and - `streamMethods(...)` in `ReflectionSupport` as well as `findAnnotatedMethods(...)` in - `AnnotationSupport`. - - See issue link:https://github.com/junit-team/junit5/issues/3600[#3600] for details. - - -[[release-notes-5.10.2-junit-jupiter]] -=== JUnit Jupiter - -==== Bug Fixes - -* JUnit Jupiter once again properly detects when a `@Test` method is overridden in a - subclass. - - See issue link:https://github.com/junit-team/junit5/issues/3600[#3600] for details. - -==== Deprecations and Breaking Changes - -* A package-private static field annotated with `@TempDir` is once again _shadowed_ by a - non-static field annotated with `@TempDir` when the non-static field resides in a - different package and has the same name as the static field. - - This reverts changes made in 5.10.1. - - See issue link:https://github.com/junit-team/junit5/issues/3638[#3638] for details. -* A package-private class-level lifecycle method annotated with `@BeforeAll` or - `@AfterAll` is once again _shadowed_ by a method-level lifecycle method annotated with - `@BeforeEach` or `@AfterEach` when the method-level lifecycle method resides in a - different package and has the same name as the class-level lifecycle method. - - This reverts changes made in 5.10.1. - - See issue link:https://github.com/junit-team/junit5/issues/3600[#3600] for details. - - -[[release-notes-5.10.2-junit-vintage]] -=== JUnit Vintage - -No changes. diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.10.3.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.10.3.adoc deleted file mode 100644 index f98b8fd062f7..000000000000 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.10.3.adoc +++ /dev/null @@ -1,41 +0,0 @@ -[[release-notes-5.10.3]] -== 5.10.3 - -*Date of Release:* June 27, 2024 - -*Scope:* Bug fixes and enhancements since 5.10.2 - -For a complete list of all _closed_ issues and pull requests for this release, consult the -link:{junit5-repo}+/milestone/78?closed=1+[5.10.3] milestone page in the JUnit repository -on GitHub. - - -[[release-notes-5.10.3-junit-platform]] -=== JUnit Platform - -==== Bug Fixes - -* The `junit-platform-suite-engine` now includes configuration provided via - `@ConfigurationParameter` when selecting tests by `UniqueId`. -* In order to support using `@EnabledInNativeImage` on test classes, - `UniqueIdTrackingListener` now tracks descendants of skipped test containers. -* Attempting to deserialize a `TestIdentifier` no longer causes a `NullPointerException` - when there is no parent identifier. See - link:https://github.com/junit-team/junit5/issues/3819[issue 3819]. - - -[[release-notes-5.10.3-junit-jupiter]] -=== JUnit Jupiter - -==== Bug Fixes - -* `TempDir` suppresses `NoSuchFileException` when deleting files that may have been deleted - by another thread or process. -* `MethodOrderer.Random` and `ClassOrderer.Random` now use the same default seed that is - generated during class initialization. - - -[[release-notes-5.10.3-junit-vintage]] -=== JUnit Vintage - -No changes. diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.0.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.0.adoc index 862e81213d53..19fdbc72dfa0 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.0.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.0.adoc @@ -15,182 +15,5 @@ * Classpath resource scanning support for engines * Numerous bug fixes and enhancements regarding field and method search algorithms -For a complete list of all _closed_ issues and pull requests for this release, consult the -link:{junit5-repo}+/milestone/68?closed=1+[5.11.0-M1], -link:{junit5-repo}+/milestone/74?closed=1+[5.11.0-M2], -link:{junit5-repo}+/milestone/77?closed=1+[5.11.0-RC1], and -link:{junit5-repo}+/milestone/76?closed=1+[5.11.0] milestone pages in the JUnit repository -on GitHub. - - -[[release-notes-5.11.0-overall-improvements]] -=== Overall Improvements - -[[release-notes-5.11.0-overall-new-features-and-improvements]] -==== New Features and Improvements - -* Java classes in published artifacts are now compiled with the `-parameters` option of - `javac` and thus now contain metadata for reflection on parameters such as their names. - - -[[release-notes-5.11.0-junit-platform]] -=== JUnit Platform - -[[release-notes-5.11.0-junit-platform-bug-fixes]] -==== Bug Fixes - -* Field and method search algorithms now adhere to standard Java semantics regarding - whether a given field or method is visible or overridden according to the rules of the - Java language. See the new - <<../user-guide/index.adoc#extensions-supported-utilities-search-semantics, Field and - Method Search Semantics>> section of the User Guide for details. -* `ReflectionSupport.findFields(...)` now returns a distinct set of fields. -* Fixed parsing of recursive jar URIs which allows the JUnit Platform Launcher to be used - inside Spring Boot executable jars for Spring Boot 3.2 and later. -* The `junit-platform-suite-engine` now includes configuration provided via - `@ConfigurationParameter` when selecting tests by `UniqueId` (backported to 5.10.3). -* In order to support using `@EnabledInNativeImage` on test classes, - `UniqueIdTrackingListener` now tracks descendants of skipped test containers (backported - to 5.10.3). -* Attempting to deserialize a `TestIdentifier` no longer causes a `NullPointerException` - when there is no parent identifier. See - link:https://github.com/junit-team/junit5/issues/3819[issue 3819] (backported to - 5.10.3). - -[[release-notes-5.11.0-junit-platform-deprecations-and-breaking-changes]] -==== Deprecations and Breaking Changes - -* As mentioned in the _Bug Fixes_ section above, field and method search algorithms now - adhere to standard Java semantics regarding whether a given field or method is visible - or overridden according to the rules of the Java language. The changes in the search - algorithms may, however, result in breaking changes for some use cases. In light of - that, it is possible to revert to the previous "legacy semantics". See the new - <<../user-guide/index.adoc#extensions-supported-utilities-search-semantics, Field and - Method Search Semantics>> section of the User Guide for details. - -[[release-notes-5.11.0-junit-platform-new-features-and-improvements]] -==== New Features and Improvements - -* New `ConversionSupport` utility in `junit-platform-commons` which exposes the conversion - logic that was previously private to JUnit Jupiter's `@ParameterizedTest` infrastructure - -- for use in third-party extensions and test engines. -* Error messages for type mismatches in `NamespacedHierarchicalStore` now include the - actual type and value in addition to the required type. -* Updated `open-test-reporting` dependency to `0.1.0-M2`. -* All Platform implementations of `DiscoverySelector` now have a parseable string - representation that can be generated by calling the new - `DiscoverySelector.toIdentifier()` method and `toString()` on the returned - `DiscoverySelectorIdentifier`. This string representation can be used to reconstruct - the original `DiscoverySelector` by calling the new `DiscoverySelectors.parse()` method. - This change will allow build tools and IDEs to provide generic mechanisms for specifying - selectors on the command line or in configuration files without having to support each - selector type individually. - - The Console Launcher supports specifying selectors via their identifiers using the - `--select` option. For example, `--select class:foo.Bar` will run all tests in the - `foo.Bar` class. - - Similarly, the JUnit Platform Suite engine provides a new `@Select("")` - annotation. -* The Console Launcher now provides a `--version` option. -* `NamespacedHierarchicalStore` now throws an `IllegalStateException` for any attempt to - modify or query the store after it has been closed. In addition, an attempt to close a - store that has already been closed will have no effect. - - See link:https://github.com/junit-team/junit5/issues/3614[issue 3614] for details. -* Introduce `@ConfigurationParametersResource` for `@Suite` classes and - `--config-resource` option for ConsoleLauncher that allow specifying additional - properties files on the classpath as sources of configuration parameters. -* New `rootCause()` condition in `TestExecutionResultConditions` that matches if an - exception's _root_ cause matches all supplied conditions, for use with the - `EngineTestKit`. -* `ReflectionSupport` now supports scanning for classpath resources. -* Introduce `@BeforeSuite` and `@AfterSuite` lifecycle methods for `@Suite` classes. - - -[[release-notes-5.11.0-junit-jupiter]] -=== JUnit Jupiter - -[[release-notes-5.11.0-junit-jupiter-bug-fixes]] -==== Bug Fixes - -* Due to changes in the JUnit Platform regarding field and method search algorithms (see - <> above), numerous bugs have been - addressed within JUnit Jupiter, including but not limited to the following. - ** Two `@TempDir` fields with the same name in a superclass and subclass will now both - be injected. - ** Two `@Test` methods with the same signature in a superclass and subclass will now - both be invoked, as long as the `@Test` method in the subclass does not override the - `@Test` method in the superclass, which can occur if the superclass method is `private` - or if the superclass method is package-private and resides in a different package than - the subclass. - *** The same applies to other types of test methods (`@TestFactory`, - `@ParameterizedTest`, etc.) as well as lifecycle methods (`@BeforeAll`, - `@AfterAll`, `@BeforeEach`, and `@AfterEach`). -* `MethodOrderer.Random` and `ClassOrderer.Random` now use the same default seed that is - generated during class initialization (backported to 5.10.3). -* `TestInstancePostProcessor` extensions can now be registered via the `@ExtendWith` - annotation on non-static fields. -* Methods and constructors invoked via `ExecutableInvoker` now use the same extensions as - the context they are invoked from and the same `ExtensionContext` is passed to - registered instances of `ParameterResolver`. -* The `org.junit.jupiter.api.extension.support` package is now exported from the - `org.junit.jupiter.api` module - -[[release-notes-5.11.0-junit-jupiter-deprecations-and-breaking-changes]] -==== Deprecations and Breaking Changes - -* The registration order of extensions was changed to allow non-static fields to be - processed earlier. This change may affect extensions that rely on the order of - registration. -* Kotlin support now depends on Kotlin API and language version 1.6; whereas, it - previously depended on version 1.3. - -[[release-notes-5.11.0-junit-jupiter-new-features-and-improvements]] -==== New Features and Improvements - -* New `@FieldSource` annotation for use with `@ParameterizedTest` methods which allows - you to source arguments from a local field or an external field referenced by - fully qualified field name. This feature is similar to the existing `@MethodSource` - feature. See the - <<../user-guide/index.adoc#writing-tests-parameterized-tests-sources-FieldSource, User - Guide>> for details. -* New `@AutoClose` annotation that can be applied to fields within tests to automatically - close the annotated resource after test execution. See the - <<../user-guide/index.adoc#writing-tests-built-in-extensions-AutoClose, User Guide>> for - details. -* `JAVA_23` and `JAVA_24` have been added to the `JRE` enum for use with JRE-based - execution conditions. -* New <<../user-guide/index.adoc#writing-tests-exceptions, Exception Handling>> - documentation in the User Guide. -* Improved documentation for <<../user-guide/index.adoc#writing-tests-assumptions, - Assumptions>> in the User Guide. -* Improved Javadoc for `assertThrows()` and `assertThrowsExactly()` to make it clear that - the supplied message is not the _expected message_ of the thrown exception. -* Improved documentation for semantics of a disabled test regarding class-level lifecycle - methods and callbacks. -* `@..Source` annotations for parameterized tests can now be used as repeatable - annotations. See the - <<../user-guide/index.adoc#writing-tests-parameterized-repeatable-sources, User Guide>> - for details. -* New `argumentSet()` factory method for providing a custom name for an entire set of - arguments for a `@ParameterizedTest`. See the - <<../user-guide/index.adoc#writing-tests-parameterized-tests-display-names, User Guide>> - for details. -* New `assertInstanceOf` methods added for Kotlin following up with similar Java - `assertInstanceOf` methods introduced in `5.8` version. -* New generators in `DynamicTest` that take a `Stream`/`Iterator` of `Named` - along with a convenient `NamedExecutable` interface that can simplify writing dynamic - tests, in particular in recent versions of Java that support records. -* `@TempDir` now suppresses `NoSuchFileException` when attempting to delete files that may - have been already deleted by another thread or process. -* `@TempDir` now fails fast in case `TempDirFactory::createTempDirectory` returns - `null`, a file, or a symbolic link to a file. -* `@TempDir` now fails fast in case the annotated target is of type `File` and - `TempDirFactory::createTempDirectory` returns a `Path` that does not belong to the - default file system. -* Allow potentially unlimited characters per column in `@CsvSource` and `@CsvFileSource` - by specifying `maxCharsPerColumn = -1`. - - -[[release-notes-5.11.0-junit-vintage]] -=== JUnit Vintage - -No changes. +For complete details consult the +https://junit.org/junit5/docs/5.11.0/release-notes/index.html[5.11.0 Release Notes] online. From 8bcea5228aafc9ccaacd386ea065c6cc3a6ad157 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 14 Aug 2024 12:26:16 +0200 Subject: [PATCH 004/611] Bump version in intro paragraph as well --- documentation/src/docs/asciidoc/release-notes/index.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/src/docs/asciidoc/release-notes/index.adoc b/documentation/src/docs/asciidoc/release-notes/index.adoc index 91912975cf2a..10d9177e3dc0 100644 --- a/documentation/src/docs/asciidoc/release-notes/index.adoc +++ b/documentation/src/docs/asciidoc/release-notes/index.adoc @@ -9,7 +9,7 @@ Stefan Bechtold; Sam Brannen; Johannes Link; Matthias Merdes; Marc Philipp; Juli :last-update-label!: // -This document contains the _change log_ for all JUnit 5 releases since 5.10 GA. +This document contains the _change log_ for all JUnit 5 releases since 5.11 GA. Please refer to the <<../user-guide/index.adoc#user-guide,User Guide>> for comprehensive reference documentation for programmers writing tests, extension authors, and engine From ad5f794be989f81feeeffdfb3c92294e0f68e447 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 15 Aug 2024 11:07:01 +0200 Subject: [PATCH 005/611] Add initial 5.11.1 release notes from template --- .../docs/asciidoc/release-notes/index.adoc | 2 + .../release-notes/release-notes-5.11.1.adoc | 67 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc diff --git a/documentation/src/docs/asciidoc/release-notes/index.adoc b/documentation/src/docs/asciidoc/release-notes/index.adoc index 10d9177e3dc0..52572c188572 100644 --- a/documentation/src/docs/asciidoc/release-notes/index.adoc +++ b/documentation/src/docs/asciidoc/release-notes/index.adoc @@ -19,4 +19,6 @@ include::{includedir}/link-attributes.adoc[] include::{basedir}/release-notes-5.12.0-M1.adoc[] +include::{basedir}/release-notes-5.11.1.adoc[] + include::{basedir}/release-notes-5.11.0.adoc[] diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc new file mode 100644 index 000000000000..c5f702c82096 --- /dev/null +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc @@ -0,0 +1,67 @@ +[[release-notes-5.11.1]] +== 5.11.1 + +*Date of Release:* ❓ + +*Scope:* ❓ + +For a complete list of all _closed_ issues and pull requests for this release, consult the +link:{junit5-repo}+/milestone/79?closed=1+[5.11.1] milestone page in the +JUnit repository on GitHub. + + +[[release-notes-5.11.1-junit-platform]] +=== JUnit Platform + +[[release-notes-5.11.1-junit-platform-bug-fixes]] +==== Bug Fixes + +* ❓ + +[[release-notes-5.11.1-junit-platform-deprecations-and-breaking-changes]] +==== Deprecations and Breaking Changes + +* ❓ + +[[release-notes-5.11.1-junit-platform-new-features-and-improvements]] +==== New Features and Improvements + +* ❓ + + +[[release-notes-5.11.1-junit-jupiter]] +=== JUnit Jupiter + +[[release-notes-5.11.1-junit-jupiter-bug-fixes]] +==== Bug Fixes + +* ❓ + +[[release-notes-5.11.1-junit-jupiter-deprecations-and-breaking-changes]] +==== Deprecations and Breaking Changes + +* ❓ + +[[release-notes-5.11.1-junit-jupiter-new-features-and-improvements]] +==== New Features and Improvements + +* ❓ + + +[[release-notes-5.11.1-junit-vintage]] +=== JUnit Vintage + +[[release-notes-5.11.1-junit-vintage-bug-fixes]] +==== Bug Fixes + +* ❓ + +[[release-notes-5.11.1-junit-vintage-deprecations-and-breaking-changes]] +==== Deprecations and Breaking Changes + +* ❓ + +[[release-notes-5.11.1-junit-vintage-new-features-and-improvements]] +==== New Features and Improvements + +* ❓ From 0ad7214f18b82d1d12ea55f7ea915d57dbefe86b Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 15 Aug 2024 11:08:08 +0200 Subject: [PATCH 006/611] Define scope --- .../src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc index c5f702c82096..cfeb3559c0f4 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc @@ -3,7 +3,7 @@ *Date of Release:* ❓ -*Scope:* ❓ +*Scope:* minor bug fixes and improvements since 5.11.0 For a complete list of all _closed_ issues and pull requests for this release, consult the link:{junit5-repo}+/milestone/79?closed=1+[5.11.1] milestone page in the From 2569dcff16e4a20d4af88bdd90d01fbfabba975a Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 15 Aug 2024 13:27:18 +0200 Subject: [PATCH 007/611] Introduce supported alternative for ReflectionUtils.makeAccessible Resolves #3925. --- .../release-notes/release-notes-5.11.1.adoc | 3 ++- .../jupiter/engine/extension/TempDirectory.java | 2 +- .../rules/member/TestRuleAnnotatedField.java | 2 +- .../commons/support/ReflectionSupport.java | 17 +++++++++++++++++ ...RegistrationViaParametersAndFieldsTests.java | 2 +- .../ProgrammaticExtensionRegistrationTests.java | 2 +- 6 files changed, 23 insertions(+), 5 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc index cfeb3559c0f4..48a5c8fdf324 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc @@ -26,7 +26,8 @@ JUnit repository on GitHub. [[release-notes-5.11.1-junit-platform-new-features-and-improvements]] ==== New Features and Improvements -* ❓ +* Introduce `ReflectionSupport.makeAccessible(Field)` for third-party use rather than + calling the internal `ReflectionUtils.makeAccessible(Field)` method directly. [[release-notes-5.11.1-junit-jupiter]] diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java index ac5831d88329..3949e3f39b87 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java @@ -15,9 +15,9 @@ import static org.junit.jupiter.api.io.CleanupMode.DEFAULT; import static org.junit.jupiter.api.io.CleanupMode.NEVER; import static org.junit.jupiter.api.io.CleanupMode.ON_SUCCESS; +import static org.junit.platform.commons.support.ReflectionSupport.makeAccessible; import static org.junit.platform.commons.util.AnnotationUtils.findAnnotatedFields; import static org.junit.platform.commons.util.AnnotationUtils.findAnnotation; -import static org.junit.platform.commons.util.ReflectionUtils.makeAccessible; import java.io.File; import java.io.IOException; diff --git a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/TestRuleAnnotatedField.java b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/TestRuleAnnotatedField.java index ef277f590fcd..339c9ed47df4 100644 --- a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/TestRuleAnnotatedField.java +++ b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/TestRuleAnnotatedField.java @@ -11,7 +11,7 @@ package org.junit.jupiter.migrationsupport.rules.member; import static org.apiguardian.api.API.Status.INTERNAL; -import static org.junit.platform.commons.util.ReflectionUtils.makeAccessible; +import static org.junit.platform.commons.support.ReflectionSupport.makeAccessible; import java.lang.reflect.Field; diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ReflectionSupport.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ReflectionSupport.java index 6d63e015fccc..af578f1ff4ff 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ReflectionSupport.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ReflectionSupport.java @@ -652,4 +652,21 @@ public static Stream> streamNestedClasses(Class clazz, PredicateIf you're looking for similar functionality for constructors or + * methods, consider using {@link #newInstance(Class, Object...)} or + * {@link #invokeMethod(Method, Object, Object...)}. + * + * @param field the field to make accessible; never {@code null} + * @return the supplied field + * @since 1.11.1 + * @see Field#setAccessible(boolean) + */ + @API(status = EXPERIMENTAL, since = "1.11.1") + public static Field makeAccessible(Field field) { + return ReflectionUtils.makeAccessible(Preconditions.notNull(field, "field must not be null")); + } + } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistrationViaParametersAndFieldsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistrationViaParametersAndFieldsTests.java index 2a748e280283..982ced8e1569 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistrationViaParametersAndFieldsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistrationViaParametersAndFieldsTests.java @@ -15,8 +15,8 @@ import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.DynamicTest.dynamicTest; import static org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT; +import static org.junit.platform.commons.support.ReflectionSupport.makeAccessible; import static org.junit.platform.commons.util.AnnotationUtils.findAnnotatedFields; -import static org.junit.platform.commons.util.ReflectionUtils.makeAccessible; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; import static org.junit.platform.testkit.engine.EventConditions.finishedWithFailure; diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ProgrammaticExtensionRegistrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ProgrammaticExtensionRegistrationTests.java index 23e4cc9ec564..ce9be391a7a4 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ProgrammaticExtensionRegistrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ProgrammaticExtensionRegistrationTests.java @@ -16,7 +16,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS; -import static org.junit.platform.commons.util.ReflectionUtils.makeAccessible; +import static org.junit.platform.commons.support.ReflectionSupport.makeAccessible; import static org.junit.platform.testkit.engine.EventConditions.finishedWithFailure; import static org.junit.platform.testkit.engine.TestExecutionResultConditions.cause; import static org.junit.platform.testkit.engine.TestExecutionResultConditions.instanceOf; From a5edcbf11299ef7fc3f6d45ab61d1960d3163908 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 15 Aug 2024 14:01:47 +0200 Subject: [PATCH 008/611] Prefer AnnotationSupport over AnnotationUtils Instead of calling methods of the internal AnnotationUtils class, internal code now uses equivalent methods of AnnotationSupport, where possible. This is important since internal code often serves as an example when looking to implement custom extensions. --- .../java/org/junit/jupiter/api/DisplayNameGenerator.java | 8 +++++--- .../api/condition/AbstractOsBasedExecutionCondition.java | 2 +- .../condition/AbstractRepeatableAnnotationCondition.java | 2 +- .../jupiter/api/condition/BooleanExecutionCondition.java | 2 +- .../junit/jupiter/api/condition/MethodBasedCondition.java | 2 +- .../junit/jupiter/engine/descriptor/DisplayNameUtils.java | 6 +++--- .../junit/jupiter/engine/descriptor/ExtensionUtils.java | 4 ++-- .../jupiter/engine/descriptor/JupiterTestDescriptor.java | 4 ++-- .../jupiter/engine/descriptor/LifecycleMethodUtils.java | 4 ++-- .../engine/descriptor/TestInstanceLifecycleUtils.java | 4 ++-- .../discovery/AbstractAnnotatedDescriptorWrapper.java | 8 ++++---- .../jupiter/engine/discovery/ClassOrderingVisitor.java | 4 ++-- .../engine/discovery/predicates/IsNestedTestClass.java | 2 +- .../engine/discovery/predicates/IsTestableMethod.java | 2 +- .../jupiter/engine/extension/AutoCloseExtension.java | 8 ++++---- .../junit/jupiter/engine/extension/DisabledCondition.java | 2 +- .../jupiter/engine/extension/RepeatedTestExtension.java | 6 +++--- .../org/junit/jupiter/engine/extension/TempDirectory.java | 4 ++-- .../migrationsupport/conditions/IgnoreCondition.java | 2 +- .../jupiter/migrationsupport/rules/TestRuleSupport.java | 4 ++-- .../junit/jupiter/params/ParameterizedTestExtension.java | 6 +++--- .../jupiter/params/ParameterizedTestMethodContext.java | 8 ++++---- .../params/ParameterizedTestParameterResolver.java | 4 ++-- .../jupiter/params/provider/MethodArgumentsProvider.java | 2 +- .../params/support/AnnotationConsumerInitializer.java | 8 ++++---- .../org/junit/platform/runner/JUnitPlatformTestTree.java | 4 ++-- .../commons/SuiteLauncherDiscoveryRequestBuilder.java | 4 ++-- .../junit/platform/suite/engine/LifecycleMethodUtils.java | 4 ++-- .../junit/platform/suite/engine/SuiteTestDescriptor.java | 2 +- .../junit/jupiter/engine/TestInstanceLifecycleTests.java | 2 +- .../ExtensionRegistrationViaParametersAndFieldsTests.java | 2 +- .../extension/ProgrammaticExtensionRegistrationTests.java | 4 ++-- .../engine/extension/sub/SystemPropertyCondition.java | 2 +- .../junit/platform/commons/util/AnnotationUtilsTests.java | 8 ++++---- .../support/descriptor/DemoClassTestDescriptor.java | 2 +- .../support/descriptor/DemoMethodTestDescriptor.java | 2 +- 36 files changed, 73 insertions(+), 71 deletions(-) diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayNameGenerator.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayNameGenerator.java index f396ce850c7d..b778e6c9de99 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayNameGenerator.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayNameGenerator.java @@ -11,14 +11,15 @@ package org.junit.jupiter.api; import static org.apiguardian.api.API.Status.STABLE; +import static org.junit.platform.commons.support.AnnotationSupport.findAnnotation; import static org.junit.platform.commons.support.ModifierSupport.isStatic; -import static org.junit.platform.commons.util.AnnotationUtils.findAnnotation; import java.lang.reflect.Method; import java.util.Optional; import java.util.function.Predicate; import org.apiguardian.api.API; +import org.junit.platform.commons.support.SearchOption; import org.junit.platform.commons.util.ClassUtils; import org.junit.platform.commons.util.Preconditions; import org.junit.platform.commons.util.ReflectionUtils; @@ -332,7 +333,7 @@ private static DisplayNameGenerator getGeneratorFor(Class testClass) { * @return an {@code Optional} containing the annotation, potentially empty if not found */ private static Optional findDisplayNameGeneration(Class testClass) { - return findAnnotation(testClass, DisplayNameGeneration.class, true); + return findAnnotation(testClass, DisplayNameGeneration.class, SearchOption.INCLUDE_ENCLOSING_CLASSES); } /** @@ -344,7 +345,8 @@ private static Optional findDisplayNameGeneration(Class findIndicativeSentencesGeneration(Class testClass) { - return findAnnotation(testClass, IndicativeSentencesGeneration.class, true); + return findAnnotation(testClass, IndicativeSentencesGeneration.class, + SearchOption.INCLUDE_ENCLOSING_CLASSES); } private static Predicate> not(Class clazz) { diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/AbstractOsBasedExecutionCondition.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/AbstractOsBasedExecutionCondition.java index b27d52c7332d..93ec01c659ea 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/AbstractOsBasedExecutionCondition.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/AbstractOsBasedExecutionCondition.java @@ -11,7 +11,7 @@ package org.junit.jupiter.api.condition; import static org.junit.jupiter.api.extension.ConditionEvaluationResult.enabled; -import static org.junit.platform.commons.util.AnnotationUtils.findAnnotation; +import static org.junit.platform.commons.support.AnnotationSupport.findAnnotation; import java.lang.annotation.Annotation; diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/AbstractRepeatableAnnotationCondition.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/AbstractRepeatableAnnotationCondition.java index 2e29da7e653b..fd15a61bf6be 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/AbstractRepeatableAnnotationCondition.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/AbstractRepeatableAnnotationCondition.java @@ -11,7 +11,7 @@ package org.junit.jupiter.api.condition; import static java.lang.String.format; -import static org.junit.platform.commons.util.AnnotationUtils.findRepeatableAnnotations; +import static org.junit.platform.commons.support.AnnotationSupport.findRepeatableAnnotations; import java.lang.annotation.Annotation; import java.lang.annotation.Repeatable; diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/BooleanExecutionCondition.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/BooleanExecutionCondition.java index 3d84af41b40b..0793e795380b 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/BooleanExecutionCondition.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/BooleanExecutionCondition.java @@ -12,7 +12,7 @@ import static org.junit.jupiter.api.extension.ConditionEvaluationResult.disabled; import static org.junit.jupiter.api.extension.ConditionEvaluationResult.enabled; -import static org.junit.platform.commons.util.AnnotationUtils.findAnnotation; +import static org.junit.platform.commons.support.AnnotationSupport.findAnnotation; import java.lang.annotation.Annotation; import java.util.function.Function; diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/MethodBasedCondition.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/MethodBasedCondition.java index f06738d1eea2..3c2b381167fa 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/MethodBasedCondition.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/MethodBasedCondition.java @@ -13,7 +13,7 @@ import static java.lang.String.format; import static org.junit.jupiter.api.extension.ConditionEvaluationResult.disabled; import static org.junit.jupiter.api.extension.ConditionEvaluationResult.enabled; -import static org.junit.platform.commons.util.AnnotationUtils.findAnnotation; +import static org.junit.platform.commons.support.AnnotationSupport.findAnnotation; import java.lang.annotation.Annotation; import java.lang.reflect.Method; diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DisplayNameUtils.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DisplayNameUtils.java index ec36ab6fb881..4a451a755282 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DisplayNameUtils.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DisplayNameUtils.java @@ -10,7 +10,7 @@ package org.junit.jupiter.engine.descriptor; -import static org.junit.platform.commons.util.AnnotationUtils.findAnnotation; +import static org.junit.platform.commons.support.AnnotationSupport.findAnnotation; import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; @@ -28,7 +28,7 @@ import org.junit.jupiter.engine.config.JupiterConfiguration; import org.junit.platform.commons.logging.Logger; import org.junit.platform.commons.logging.LoggerFactory; -import org.junit.platform.commons.util.AnnotationUtils; +import org.junit.platform.commons.support.SearchOption; import org.junit.platform.commons.util.Preconditions; import org.junit.platform.commons.util.ReflectionUtils; import org.junit.platform.commons.util.StringUtils; @@ -122,7 +122,7 @@ private static Supplier createDisplayNameSupplier(Class testClass, Ju private static Optional findDisplayNameGenerator(Class testClass) { Preconditions.notNull(testClass, "Test class must not be null"); - return AnnotationUtils.findAnnotation(testClass, DisplayNameGeneration.class, true) // + return findAnnotation(testClass, DisplayNameGeneration.class, SearchOption.INCLUDE_ENCLOSING_CLASSES) // .map(DisplayNameGeneration::value) // .map(displayNameGeneratorClass -> { if (displayNameGeneratorClass == Standard.class) { diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExtensionUtils.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExtensionUtils.java index 9cc9c64cf849..ca315bbd9271 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExtensionUtils.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExtensionUtils.java @@ -11,9 +11,9 @@ package org.junit.jupiter.engine.descriptor; import static java.util.stream.Collectors.toList; -import static org.junit.platform.commons.util.AnnotationUtils.findAnnotation; +import static org.junit.platform.commons.support.AnnotationSupport.findAnnotation; +import static org.junit.platform.commons.support.AnnotationSupport.isAnnotated; import static org.junit.platform.commons.util.AnnotationUtils.findRepeatableAnnotations; -import static org.junit.platform.commons.util.AnnotationUtils.isAnnotated; import static org.junit.platform.commons.util.ReflectionUtils.HierarchyTraversalMode.TOP_DOWN; import static org.junit.platform.commons.util.ReflectionUtils.getDeclaredConstructor; import static org.junit.platform.commons.util.ReflectionUtils.streamFields; diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.java index 4d975ce4b684..e96c36333fcb 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.java @@ -15,8 +15,8 @@ import static java.util.stream.Collectors.toSet; import static org.apiguardian.api.API.Status.INTERNAL; import static org.junit.jupiter.engine.descriptor.DisplayNameUtils.determineDisplayName; -import static org.junit.platform.commons.util.AnnotationUtils.findAnnotation; -import static org.junit.platform.commons.util.AnnotationUtils.findRepeatableAnnotations; +import static org.junit.platform.commons.support.AnnotationSupport.findAnnotation; +import static org.junit.platform.commons.support.AnnotationSupport.findRepeatableAnnotations; import java.lang.reflect.AnnotatedElement; import java.util.Collections; diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtils.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtils.java index 2d4cea214f3d..fc382b2c2ce0 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtils.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtils.java @@ -10,7 +10,7 @@ package org.junit.jupiter.engine.descriptor; -import static org.junit.platform.commons.util.AnnotationUtils.findAnnotatedMethods; +import static org.junit.platform.commons.support.AnnotationSupport.findAnnotatedMethods; import static org.junit.platform.commons.util.ReflectionUtils.returnsPrimitiveVoid; import java.lang.annotation.Annotation; @@ -22,8 +22,8 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.platform.commons.JUnitException; +import org.junit.platform.commons.support.HierarchyTraversalMode; import org.junit.platform.commons.util.ReflectionUtils; -import org.junit.platform.commons.util.ReflectionUtils.HierarchyTraversalMode; /** * Collection of utilities for working with test lifecycle methods. diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestInstanceLifecycleUtils.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestInstanceLifecycleUtils.java index 56378f766684..3620b735b55b 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestInstanceLifecycleUtils.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestInstanceLifecycleUtils.java @@ -15,7 +15,7 @@ import org.apiguardian.api.API; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.engine.config.JupiterConfiguration; -import org.junit.platform.commons.util.AnnotationUtils; +import org.junit.platform.commons.support.AnnotationSupport; import org.junit.platform.commons.util.Preconditions; /** @@ -37,7 +37,7 @@ static TestInstance.Lifecycle getTestInstanceLifecycle(Class testClass, Jupit Preconditions.notNull(configuration, "configuration must not be null"); // @formatter:off - return AnnotationUtils.findAnnotation(testClass, TestInstance.class) + return AnnotationSupport.findAnnotation(testClass, TestInstance.class) .map(TestInstance::value) .orElseGet(configuration::getDefaultTestInstanceLifecycle); // @formatter:on diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/AbstractAnnotatedDescriptorWrapper.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/AbstractAnnotatedDescriptorWrapper.java index 73ad78fe1d93..da665f1e9731 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/AbstractAnnotatedDescriptorWrapper.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/AbstractAnnotatedDescriptorWrapper.java @@ -15,7 +15,7 @@ import java.util.List; import java.util.Optional; -import org.junit.platform.commons.util.AnnotationUtils; +import org.junit.platform.commons.support.AnnotationSupport; import org.junit.platform.commons.util.Preconditions; import org.junit.platform.engine.TestDescriptor; @@ -49,17 +49,17 @@ public final String getDisplayName() { public final boolean isAnnotated(Class annotationType) { Preconditions.notNull(annotationType, "annotationType must not be null"); - return AnnotationUtils.isAnnotated(getAnnotatedElement(), annotationType); + return AnnotationSupport.isAnnotated(getAnnotatedElement(), annotationType); } public final Optional findAnnotation(Class annotationType) { Preconditions.notNull(annotationType, "annotationType must not be null"); - return AnnotationUtils.findAnnotation(getAnnotatedElement(), annotationType); + return AnnotationSupport.findAnnotation(getAnnotatedElement(), annotationType); } public final List findRepeatableAnnotations(Class annotationType) { Preconditions.notNull(annotationType, "annotationType must not be null"); - return AnnotationUtils.findRepeatableAnnotations(getAnnotatedElement(), annotationType); + return AnnotationSupport.findRepeatableAnnotations(getAnnotatedElement(), annotationType); } } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassOrderingVisitor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassOrderingVisitor.java index 142f7f2c08e0..10f0490b0721 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassOrderingVisitor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassOrderingVisitor.java @@ -19,7 +19,7 @@ import org.junit.jupiter.engine.config.JupiterConfiguration; import org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor; import org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor; -import org.junit.platform.commons.util.AnnotationUtils; +import org.junit.platform.commons.support.AnnotationSupport; import org.junit.platform.commons.util.ReflectionUtils; import org.junit.platform.engine.TestDescriptor; @@ -57,7 +57,7 @@ protected DescriptorWrapperOrderer getDescriptorWrapperOrderer( AbstractAnnotatedDescriptorWrapper descriptorWrapper) { AnnotatedElement annotatedElement = descriptorWrapper.getAnnotatedElement(); - return AnnotationUtils.findAnnotation(annotatedElement, TestClassOrder.class)// + return AnnotationSupport.findAnnotation(annotatedElement, TestClassOrder.class)// .map(TestClassOrder::value)// . map(ReflectionUtils::newInstance)// .map(this::createDescriptorWrapperOrderer)// diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsNestedTestClass.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsNestedTestClass.java index 0039082f1609..5b8176fa6f0d 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsNestedTestClass.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsNestedTestClass.java @@ -11,7 +11,7 @@ package org.junit.jupiter.engine.discovery.predicates; import static org.apiguardian.api.API.Status.INTERNAL; -import static org.junit.platform.commons.util.AnnotationUtils.isAnnotated; +import static org.junit.platform.commons.support.AnnotationSupport.isAnnotated; import java.util.function.Predicate; diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestableMethod.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestableMethod.java index 7796a047a5f5..20a51753ec0c 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestableMethod.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestableMethod.java @@ -10,7 +10,7 @@ package org.junit.jupiter.engine.discovery.predicates; -import static org.junit.platform.commons.util.AnnotationUtils.isAnnotated; +import static org.junit.platform.commons.support.AnnotationSupport.isAnnotated; import static org.junit.platform.commons.util.ReflectionUtils.isAbstract; import static org.junit.platform.commons.util.ReflectionUtils.isPrivate; import static org.junit.platform.commons.util.ReflectionUtils.isStatic; diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/AutoCloseExtension.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/AutoCloseExtension.java index 331f591b6d88..56c0ae2efc9a 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/AutoCloseExtension.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/AutoCloseExtension.java @@ -10,7 +10,7 @@ package org.junit.jupiter.engine.extension; -import static org.junit.platform.commons.util.ReflectionUtils.HierarchyTraversalMode.BOTTOM_UP; +import static org.junit.platform.commons.support.HierarchyTraversalMode.BOTTOM_UP; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -23,7 +23,7 @@ import org.junit.jupiter.api.extension.TestInstancePreDestroyCallback; import org.junit.platform.commons.logging.Logger; import org.junit.platform.commons.logging.LoggerFactory; -import org.junit.platform.commons.util.AnnotationUtils; +import org.junit.platform.commons.support.AnnotationSupport; import org.junit.platform.commons.util.Preconditions; import org.junit.platform.commons.util.ReflectionUtils; import org.junit.platform.commons.util.StringUtils; @@ -59,12 +59,12 @@ public void afterAll(ExtensionContext context) { private static void closeFields(Class testClass, Object testInstance, ThrowableCollector throwableCollector) { Predicate predicate = (testInstance == null ? ReflectionUtils::isStatic : ReflectionUtils::isNotStatic); - AnnotationUtils.findAnnotatedFields(testClass, AutoClose.class, predicate, BOTTOM_UP).forEach( + AnnotationSupport.findAnnotatedFields(testClass, AutoClose.class, predicate, BOTTOM_UP).forEach( field -> throwableCollector.execute(() -> closeField(field, testInstance))); } private static void closeField(Field field, Object testInstance) throws Exception { - String methodName = AnnotationUtils.findAnnotation(field, AutoClose.class).get().value(); + String methodName = AnnotationSupport.findAnnotation(field, AutoClose.class).get().value(); Class fieldType = field.getType(); checkCondition(StringUtils.isNotBlank(methodName), "@AutoClose on field %s must specify a method name.", field); diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DisabledCondition.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DisabledCondition.java index 0d06023adfde..519aa7617d94 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DisabledCondition.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DisabledCondition.java @@ -10,7 +10,7 @@ package org.junit.jupiter.engine.extension; -import static org.junit.platform.commons.util.AnnotationUtils.findAnnotation; +import static org.junit.platform.commons.support.AnnotationSupport.findAnnotation; import java.lang.reflect.AnnotatedElement; diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepeatedTestExtension.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepeatedTestExtension.java index 3ecc984c5106..bb9d5d3f2c2b 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepeatedTestExtension.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepeatedTestExtension.java @@ -10,7 +10,8 @@ package org.junit.jupiter.engine.extension; -import static org.junit.platform.commons.util.AnnotationUtils.isAnnotated; +import static org.junit.platform.commons.support.AnnotationSupport.findAnnotation; +import static org.junit.platform.commons.support.AnnotationSupport.isAnnotated; import java.lang.reflect.Method; import java.util.concurrent.atomic.AtomicInteger; @@ -21,7 +22,6 @@ import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.TestTemplateInvocationContext; import org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider; -import org.junit.platform.commons.util.AnnotationUtils; import org.junit.platform.commons.util.Preconditions; /** @@ -41,7 +41,7 @@ public boolean supportsTestTemplate(ExtensionContext context) { public Stream provideTestTemplateInvocationContexts(ExtensionContext context) { Method testMethod = context.getRequiredTestMethod(); String displayName = context.getDisplayName(); - RepeatedTest repeatedTest = AnnotationUtils.findAnnotation(testMethod, RepeatedTest.class).get(); + RepeatedTest repeatedTest = findAnnotation(testMethod, RepeatedTest.class).get(); int totalRepetitions = totalRepetitions(repeatedTest, testMethod); AtomicInteger failureCount = new AtomicInteger(); int failureThreshold = failureThreshold(repeatedTest, testMethod); diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java index 3949e3f39b87..243114949da2 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java @@ -15,9 +15,9 @@ import static org.junit.jupiter.api.io.CleanupMode.DEFAULT; import static org.junit.jupiter.api.io.CleanupMode.NEVER; import static org.junit.jupiter.api.io.CleanupMode.ON_SUCCESS; +import static org.junit.platform.commons.support.AnnotationSupport.findAnnotatedFields; +import static org.junit.platform.commons.support.AnnotationSupport.findAnnotation; import static org.junit.platform.commons.support.ReflectionSupport.makeAccessible; -import static org.junit.platform.commons.util.AnnotationUtils.findAnnotatedFields; -import static org.junit.platform.commons.util.AnnotationUtils.findAnnotation; import java.io.File; import java.io.IOException; diff --git a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/conditions/IgnoreCondition.java b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/conditions/IgnoreCondition.java index c1fa55f955e9..ca3e97d348d5 100644 --- a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/conditions/IgnoreCondition.java +++ b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/conditions/IgnoreCondition.java @@ -11,7 +11,7 @@ package org.junit.jupiter.migrationsupport.conditions; import static org.apiguardian.api.API.Status.STABLE; -import static org.junit.platform.commons.util.AnnotationUtils.findAnnotation; +import static org.junit.platform.commons.support.AnnotationSupport.findAnnotation; import java.lang.reflect.AnnotatedElement; diff --git a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/TestRuleSupport.java b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/TestRuleSupport.java index 90026b7a1bd4..9357468bc691 100644 --- a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/TestRuleSupport.java +++ b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/TestRuleSupport.java @@ -11,8 +11,8 @@ package org.junit.jupiter.migrationsupport.rules; import static java.util.Collections.unmodifiableList; -import static org.junit.platform.commons.util.AnnotationUtils.findPublicAnnotatedFields; -import static org.junit.platform.commons.util.AnnotationUtils.isAnnotated; +import static org.junit.platform.commons.support.AnnotationSupport.findPublicAnnotatedFields; +import static org.junit.platform.commons.support.AnnotationSupport.isAnnotated; import static org.junit.platform.commons.util.ReflectionUtils.findMethods; import java.lang.reflect.Field; diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java index aa7cd4251720..359052a28b43 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java @@ -10,9 +10,9 @@ package org.junit.jupiter.params; -import static org.junit.platform.commons.util.AnnotationUtils.findAnnotation; -import static org.junit.platform.commons.util.AnnotationUtils.findRepeatableAnnotations; -import static org.junit.platform.commons.util.AnnotationUtils.isAnnotated; +import static org.junit.platform.commons.support.AnnotationSupport.findAnnotation; +import static org.junit.platform.commons.support.AnnotationSupport.findRepeatableAnnotations; +import static org.junit.platform.commons.support.AnnotationSupport.isAnnotated; import java.lang.reflect.Method; import java.util.concurrent.atomic.AtomicLong; diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java index 3e20899dddfc..a42e1bae8925 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java @@ -12,7 +12,7 @@ import static org.junit.jupiter.params.ParameterizedTestMethodContext.ResolverType.AGGREGATOR; import static org.junit.jupiter.params.ParameterizedTestMethodContext.ResolverType.CONVERTER; -import static org.junit.platform.commons.util.AnnotationUtils.isAnnotated; +import static org.junit.platform.commons.support.AnnotationSupport.isAnnotated; import java.lang.reflect.Method; import java.lang.reflect.Parameter; @@ -30,8 +30,8 @@ import org.junit.jupiter.params.converter.ConvertWith; import org.junit.jupiter.params.converter.DefaultArgumentConverter; import org.junit.jupiter.params.support.AnnotationConsumerInitializer; +import org.junit.platform.commons.support.AnnotationSupport; import org.junit.platform.commons.support.ReflectionSupport; -import org.junit.platform.commons.util.AnnotationUtils; import org.junit.platform.commons.util.ReflectionUtils; import org.junit.platform.commons.util.StringUtils; @@ -179,7 +179,7 @@ enum ResolverType { @Override Resolver createResolver(ParameterContext parameterContext) { try { // @formatter:off - return AnnotationUtils.findAnnotation(parameterContext.getParameter(), ConvertWith.class) + return AnnotationSupport.findAnnotation(parameterContext.getParameter(), ConvertWith.class) .map(ConvertWith::value) .map(clazz -> (ArgumentConverter) ReflectionUtils.newInstance(clazz)) .map(converter -> AnnotationConsumerInitializer.initialize(parameterContext.getParameter(), converter)) @@ -196,7 +196,7 @@ Resolver createResolver(ParameterContext parameterContext) { @Override Resolver createResolver(ParameterContext parameterContext) { try { // @formatter:off - return AnnotationUtils.findAnnotation(parameterContext.getParameter(), AggregateWith.class) + return AnnotationSupport.findAnnotation(parameterContext.getParameter(), AggregateWith.class) .map(AggregateWith::value) .map(clazz -> (ArgumentsAggregator) ReflectionSupport.newInstance(clazz)) .map(Aggregator::new) diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestParameterResolver.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestParameterResolver.java index 634405d4a5ce..f4ea4a177ec6 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestParameterResolver.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestParameterResolver.java @@ -23,7 +23,7 @@ import org.junit.jupiter.api.extension.ParameterContext; import org.junit.jupiter.api.extension.ParameterResolutionException; import org.junit.jupiter.api.extension.ParameterResolver; -import org.junit.platform.commons.util.AnnotationUtils; +import org.junit.platform.commons.support.AnnotationSupport; /** * @since 5.0 @@ -81,7 +81,7 @@ public Object resolveParameter(ParameterContext parameterContext, ExtensionConte */ @Override public void afterTestExecution(ExtensionContext context) { - ParameterizedTest parameterizedTest = AnnotationUtils.findAnnotation(context.getRequiredTestMethod(), + ParameterizedTest parameterizedTest = AnnotationSupport.findAnnotation(context.getRequiredTestMethod(), ParameterizedTest.class).get(); if (!parameterizedTest.autoCloseArguments()) { return; diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/MethodArgumentsProvider.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/MethodArgumentsProvider.java index 5915602fba95..9a7f1b8ca10e 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/MethodArgumentsProvider.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/MethodArgumentsProvider.java @@ -13,7 +13,7 @@ import static java.lang.String.format; import static java.util.Arrays.stream; import static java.util.stream.Collectors.toList; -import static org.junit.platform.commons.util.AnnotationUtils.isAnnotated; +import static org.junit.platform.commons.support.AnnotationSupport.isAnnotated; import static org.junit.platform.commons.util.CollectionUtils.isConvertibleToStream; import java.lang.reflect.Method; diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/support/AnnotationConsumerInitializer.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/support/AnnotationConsumerInitializer.java index 9296c70deada..3efe78d96319 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/support/AnnotationConsumerInitializer.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/support/AnnotationConsumerInitializer.java @@ -13,10 +13,10 @@ import static java.util.Arrays.asList; import static java.util.Collections.emptyList; import static org.apiguardian.api.API.Status.INTERNAL; -import static org.junit.platform.commons.util.AnnotationUtils.findAnnotation; -import static org.junit.platform.commons.util.AnnotationUtils.findRepeatableAnnotations; -import static org.junit.platform.commons.util.ReflectionUtils.HierarchyTraversalMode.BOTTOM_UP; -import static org.junit.platform.commons.util.ReflectionUtils.findMethods; +import static org.junit.platform.commons.support.AnnotationSupport.findAnnotation; +import static org.junit.platform.commons.support.AnnotationSupport.findRepeatableAnnotations; +import static org.junit.platform.commons.support.HierarchyTraversalMode.BOTTOM_UP; +import static org.junit.platform.commons.support.ReflectionSupport.findMethods; import java.lang.annotation.Annotation; import java.lang.annotation.Repeatable; diff --git a/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatformTestTree.java b/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatformTestTree.java index 96f7239f9227..99f3eef08f4f 100644 --- a/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatformTestTree.java +++ b/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatformTestTree.java @@ -22,7 +22,7 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.junit.platform.commons.util.AnnotationUtils; +import org.junit.platform.commons.support.AnnotationSupport; import org.junit.platform.commons.util.StringUtils; import org.junit.platform.engine.TestSource; import org.junit.platform.engine.UniqueId; @@ -76,7 +76,7 @@ private Description generateSuiteDescription(TestPlan testPlan, Class testCla private String getSuiteDisplayName(Class testClass) { // @formatter:off - return AnnotationUtils.findAnnotation(testClass, SuiteDisplayName.class) + return AnnotationSupport.findAnnotation(testClass, SuiteDisplayName.class) .map(SuiteDisplayName::value) .filter(StringUtils::isNotBlank) .orElse(testClass.getName()); diff --git a/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilder.java b/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilder.java index 23eecf29ce62..610bc0524e8d 100644 --- a/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilder.java +++ b/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilder.java @@ -11,8 +11,8 @@ package org.junit.platform.suite.commons; import static java.util.stream.Collectors.toList; -import static org.junit.platform.commons.util.AnnotationUtils.findAnnotation; -import static org.junit.platform.commons.util.AnnotationUtils.findRepeatableAnnotations; +import static org.junit.platform.commons.support.AnnotationSupport.findAnnotation; +import static org.junit.platform.commons.support.AnnotationSupport.findRepeatableAnnotations; import static org.junit.platform.engine.discovery.ClassNameFilter.STANDARD_INCLUDE_PATTERN; import static org.junit.platform.suite.commons.AdditionalDiscoverySelectors.selectClasspathResource; import static org.junit.platform.suite.commons.AdditionalDiscoverySelectors.selectFile; diff --git a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/LifecycleMethodUtils.java b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/LifecycleMethodUtils.java index b00bca64a131..09098df17d7f 100644 --- a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/LifecycleMethodUtils.java +++ b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/LifecycleMethodUtils.java @@ -10,7 +10,7 @@ package org.junit.platform.suite.engine; -import static org.junit.platform.commons.util.AnnotationUtils.findAnnotatedMethods; +import static org.junit.platform.commons.support.AnnotationSupport.findAnnotatedMethods; import static org.junit.platform.commons.util.ReflectionUtils.returnsPrimitiveVoid; import java.lang.annotation.Annotation; @@ -18,8 +18,8 @@ import java.util.List; import org.junit.platform.commons.JUnitException; +import org.junit.platform.commons.support.HierarchyTraversalMode; import org.junit.platform.commons.util.ReflectionUtils; -import org.junit.platform.commons.util.ReflectionUtils.HierarchyTraversalMode; import org.junit.platform.engine.support.hierarchical.ThrowableCollector; import org.junit.platform.suite.api.AfterSuite; import org.junit.platform.suite.api.BeforeSuite; diff --git a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestDescriptor.java b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestDescriptor.java index ccf40405f7bd..b8e3028b0d29 100644 --- a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestDescriptor.java +++ b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestDescriptor.java @@ -10,7 +10,7 @@ package org.junit.platform.suite.engine; -import static org.junit.platform.commons.util.AnnotationUtils.findAnnotation; +import static org.junit.platform.commons.support.AnnotationSupport.findAnnotation; import static org.junit.platform.suite.commons.SuiteLauncherDiscoveryRequestBuilder.request; import java.lang.reflect.Method; diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleTests.java index 6c8b87fed8f1..b03583f10fab 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleTests.java @@ -19,7 +19,7 @@ import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertSame; -import static org.junit.platform.commons.util.AnnotationUtils.isAnnotated; +import static org.junit.platform.commons.support.AnnotationSupport.isAnnotated; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistrationViaParametersAndFieldsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistrationViaParametersAndFieldsTests.java index 982ced8e1569..e8fa7685ef5a 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistrationViaParametersAndFieldsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistrationViaParametersAndFieldsTests.java @@ -15,8 +15,8 @@ import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.DynamicTest.dynamicTest; import static org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT; +import static org.junit.platform.commons.support.AnnotationSupport.findAnnotatedFields; import static org.junit.platform.commons.support.ReflectionSupport.makeAccessible; -import static org.junit.platform.commons.util.AnnotationUtils.findAnnotatedFields; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; import static org.junit.platform.testkit.engine.EventConditions.finishedWithFailure; diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ProgrammaticExtensionRegistrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ProgrammaticExtensionRegistrationTests.java index ce9be391a7a4..2a55678fa219 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ProgrammaticExtensionRegistrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ProgrammaticExtensionRegistrationTests.java @@ -16,6 +16,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS; +import static org.junit.platform.commons.support.AnnotationSupport.findAnnotatedFields; import static org.junit.platform.commons.support.ReflectionSupport.makeAccessible; import static org.junit.platform.testkit.engine.EventConditions.finishedWithFailure; import static org.junit.platform.testkit.engine.TestExecutionResultConditions.cause; @@ -47,7 +48,6 @@ import org.junit.jupiter.engine.JupiterTestEngine; import org.junit.jupiter.engine.execution.injection.sample.LongParameterResolver; import org.junit.platform.commons.PreconditionViolationException; -import org.junit.platform.commons.util.AnnotationUtils; import org.junit.platform.commons.util.ExceptionUtils; import org.junit.platform.testkit.engine.EngineExecutionResults; @@ -704,7 +704,7 @@ private static class ExtensionInjector implements TestInstancePostProcessor { @Override public void postProcessTestInstance(Object testInstance, ExtensionContext context) { // @formatter:off - AnnotationUtils.findAnnotatedFields(testInstance.getClass(), RegisterExtension.class, isCrystalBall).stream() + findAnnotatedFields(testInstance.getClass(), RegisterExtension.class, isCrystalBall).stream() .findFirst() .ifPresent(field -> { try { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/sub/SystemPropertyCondition.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/sub/SystemPropertyCondition.java index a4336b4b5d14..a05ccd37e014 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/sub/SystemPropertyCondition.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/sub/SystemPropertyCondition.java @@ -10,7 +10,7 @@ package org.junit.jupiter.engine.extension.sub; -import static org.junit.platform.commons.util.AnnotationUtils.findAnnotation; +import static org.junit.platform.commons.support.AnnotationSupport.findAnnotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/AnnotationUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/AnnotationUtilsTests.java index 7360a9505eee..db22575efaa3 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/AnnotationUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/AnnotationUtilsTests.java @@ -389,8 +389,8 @@ void findAnnotatedMethodsForAnnotationUsedInClassAndSuperclassHierarchyDown() th assertThat(methods.subList(1, 3)).containsOnly(method1, method3); } - /** - * @see https://github.com/junit-team/junit5/issues/3553 + /* + * see https://github.com/junit-team/junit5/issues/3553 */ @Test void findAnnotatedMethodsDoesNotAllowInstanceMethodToHideStaticMethod() throws Exception { @@ -523,8 +523,8 @@ private List findShadowingAnnotatedFields(Class an return values.stream().map(String::valueOf).toList(); } - /** - * @see https://github.com/junit-team/junit5/issues/3553 + /* + * see https://github.com/junit-team/junit5/issues/3553 */ @Test void findAnnotatedFieldsDoesNotAllowInstanceFieldToHideStaticField() throws Exception { diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DemoClassTestDescriptor.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DemoClassTestDescriptor.java index 5f4e67153a52..048e26e1bd5c 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DemoClassTestDescriptor.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DemoClassTestDescriptor.java @@ -11,7 +11,7 @@ package org.junit.platform.engine.support.descriptor; import static java.util.stream.Collectors.toCollection; -import static org.junit.platform.commons.util.AnnotationUtils.findRepeatableAnnotations; +import static org.junit.platform.commons.support.AnnotationSupport.findRepeatableAnnotations; import java.util.LinkedHashSet; import java.util.Set; diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DemoMethodTestDescriptor.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DemoMethodTestDescriptor.java index 85f25606424c..ac226663d796 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DemoMethodTestDescriptor.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DemoMethodTestDescriptor.java @@ -11,7 +11,7 @@ package org.junit.platform.engine.support.descriptor; import static java.util.stream.Collectors.toCollection; -import static org.junit.platform.commons.util.AnnotationUtils.findRepeatableAnnotations; +import static org.junit.platform.commons.support.AnnotationSupport.findRepeatableAnnotations; import java.lang.reflect.Method; import java.util.LinkedHashSet; From c24d9a630282a57bf210539b1591115bd988e19a Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 15 Aug 2024 15:00:14 +0200 Subject: [PATCH 009/611] Prefer Reflection/ModifierSupport over ReflectionUtils Instead of calling methods of the internal ReflectionUtils class, internal code now uses equivalent methods of ReflectionSupport or ModifierSupport, where possible. This is important since internal code often serves as an example when looking to implement custom extensions. --- .../org/junit/jupiter/api/DisplayNameGenerator.java | 4 ++-- .../jupiter/api/condition/MethodBasedCondition.java | 9 +++++---- .../main/org/junit/jupiter/api/condition/JRE.java.jte | 6 +++--- .../InstantiatingConfigurationParameterConverter.java | 6 +++--- .../jupiter/engine/descriptor/DisplayNameUtils.java | 4 ++-- .../jupiter/engine/descriptor/ExtensionUtils.java | 3 ++- .../engine/descriptor/LifecycleMethodUtils.java | 6 +++--- .../engine/discovery/ClassOrderingVisitor.java | 4 ++-- .../engine/discovery/ClassSelectorResolver.java | 11 ++++++----- .../junit/jupiter/engine/discovery/MethodFinder.java | 4 ++-- .../engine/discovery/MethodOrderingVisitor.java | 4 ++-- .../engine/discovery/predicates/IsInnerClass.java | 2 +- .../predicates/IsPotentialTestContainer.java | 4 ++-- .../discovery/predicates/IsTestClassWithTests.java | 3 ++- .../engine/discovery/predicates/IsTestableMethod.java | 6 +++--- .../jupiter/engine/execution/MethodInvocation.java | 4 ++-- .../jupiter/engine/extension/AutoCloseExtension.java | 10 ++++++---- .../engine/extension/MutableExtensionRegistry.java | 4 ++-- .../junit/jupiter/engine/extension/TempDirectory.java | 11 ++++++----- .../OpenTest4JAndJUnit4AwareThrowableCollector.java | 4 ++-- .../migrationsupport/rules/TestRuleSupport.java | 5 +++-- .../rules/adapter/AbstractTestRuleAdapter.java | 4 ++-- .../rules/member/TestRuleAnnotatedMethod.java | 4 ++-- .../jupiter/params/ParameterizedTestExtension.java | 4 ++-- .../params/ParameterizedTestMethodContext.java | 3 +-- .../params/provider/FieldArgumentsProvider.java | 6 ++++-- .../conversion/FallbackStringToObjectConverter.java | 10 +++++----- .../support/conversion/StringToClassConverter.java | 4 ++-- .../platform/engine/discovery/ClassSelector.java | 6 +++--- .../platform/engine/discovery/MethodSelector.java | 9 +++++---- .../engine/support/descriptor/ClassSource.java | 4 ++-- .../engine/support/descriptor/MethodSource.java | 8 ++++---- ...DefaultParallelExecutionConfigurationStrategy.java | 6 +++--- .../platform/suite/engine/ClassSelectorResolver.java | 4 ++-- .../suite/engine/IsPotentialTestContainer.java | 4 ++-- .../platform/suite/engine/LifecycleMethodUtils.java | 6 +++--- .../platform/suite/engine/SuiteTestDescriptor.java | 6 +++--- .../vintage/engine/descriptor/TestSourceProvider.java | 6 ++++-- .../engine/discovery/ClassSelectorResolver.java | 4 ++-- .../engine/discovery/IsPotentialJUnit4TestClass.java | 4 ++-- .../engine/descriptor/DescriptionUtilsTests.java | 7 +++---- .../condition/AbstractExecutionConditionTests.java | 11 ++++++----- .../DisabledIfConditionClassLoaderTests.java | 4 ++-- .../condition/EnabledIfConditionClassLoaderTests.java | 4 ++-- .../api/extension/ExtensionComposabilityTests.java | 6 +++--- .../support/TypeBasedParameterResolverTests.java | 4 ++-- .../discovery/DiscoverySelectorResolverTests.java | 6 +++--- .../predicates/IsTestFactoryMethodTests.java | 4 ++-- .../discovery/predicates/IsTestMethodTests.java | 11 ++++++----- .../predicates/IsTestTemplateMethodTests.java | 4 ++-- .../execution/AbstractExecutableInvokerTests.java | 4 +++- .../execution/ParameterResolutionUtilsTests.java | 5 +++-- .../sample/CustomAnnotationParameterResolver.java | 4 ++-- ...ensionRegistrationViaParametersAndFieldsTests.java | 6 +++--- .../jupiter/engine/extension/RepeatedTestTests.java | 6 +++--- .../engine/extension/TestInstanceFactoryTests.java | 8 ++++---- .../extension/TestReporterParameterResolverTests.java | 4 ++-- ...enTest4JAndJUnit4AwareThrowableCollectorTests.java | 5 +++-- .../params/ParameterizedTestNameFormatterTests.java | 4 ++-- .../aggregator/DefaultArgumentsAccessorTests.java | 4 ++-- .../converter/DefaultArgumentConverterTests.java | 6 +++--- .../params/converter/TypedArgumentConverterTests.java | 4 ++-- .../params/provider/FieldArgumentsProviderTests.java | 8 ++++---- .../FallbackStringToObjectConverterTests.java | 2 +- .../junit/platform/console/ConsoleDetailsTests.java | 5 +++-- 65 files changed, 185 insertions(+), 167 deletions(-) diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayNameGenerator.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayNameGenerator.java index b778e6c9de99..11f8b1851da1 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayNameGenerator.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayNameGenerator.java @@ -19,10 +19,10 @@ import java.util.function.Predicate; import org.apiguardian.api.API; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.support.SearchOption; import org.junit.platform.commons.util.ClassUtils; import org.junit.platform.commons.util.Preconditions; -import org.junit.platform.commons.util.ReflectionUtils; /** * {@code DisplayNameGenerator} defines the SPI for generating display names @@ -379,7 +379,7 @@ static DisplayNameGenerator getDisplayNameGenerator(Class generatorClass) { if (generatorClass == IndicativeSentences.class) { return IndicativeSentences.INSTANCE; } - return (DisplayNameGenerator) ReflectionUtils.newInstance(generatorClass); + return (DisplayNameGenerator) ReflectionSupport.newInstance(generatorClass); } } diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/MethodBasedCondition.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/MethodBasedCondition.java index 3c2b381167fa..24db23ec2ae0 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/MethodBasedCondition.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/MethodBasedCondition.java @@ -25,6 +25,7 @@ import org.junit.jupiter.api.extension.ExecutionCondition; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.platform.commons.JUnitException; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.util.ClassLoaderUtils; import org.junit.platform.commons.util.Preconditions; import org.junit.platform.commons.util.ReflectionUtils; @@ -67,13 +68,13 @@ Method getConditionMethod(String fullyQualifiedMethodName, ExtensionContext cont String className = methodParts[0]; String methodName = methodParts[1]; ClassLoader classLoader = ClassLoaderUtils.getClassLoader(testClass); - Class clazz = ReflectionUtils.tryToLoadClass(className, classLoader).getOrThrow( + Class clazz = ReflectionSupport.tryToLoadClass(className, classLoader).getOrThrow( cause -> new JUnitException(format("Could not load class [%s]", className), cause)); return findMethod(clazz, methodName); } private Method findMethod(Class clazz, String methodName) { - return ReflectionUtils.findMethod(clazz, methodName) // + return ReflectionSupport.findMethod(clazz, methodName) // .orElseGet(() -> ReflectionUtils.getRequiredMethod(clazz, methodName, ExtensionContext.class)); } @@ -85,9 +86,9 @@ private boolean invokeConditionMethod(Method method, ExtensionContext context) { Object testInstance = context.getTestInstance().orElse(null); if (method.getParameterCount() == 0) { - return (boolean) ReflectionUtils.invokeMethod(method, testInstance); + return (boolean) ReflectionSupport.invokeMethod(method, testInstance); } - return (boolean) ReflectionUtils.invokeMethod(method, testInstance, context); + return (boolean) ReflectionSupport.invokeMethod(method, testInstance, context); } private boolean acceptsExtensionContextOrNoArguments(Method method) { diff --git a/junit-jupiter-api/src/templates/resources/main/org/junit/jupiter/api/condition/JRE.java.jte b/junit-jupiter-api/src/templates/resources/main/org/junit/jupiter/api/condition/JRE.java.jte index 1a8598d9e980..93479da1378f 100644 --- a/junit-jupiter-api/src/templates/resources/main/org/junit/jupiter/api/condition/JRE.java.jte +++ b/junit-jupiter-api/src/templates/resources/main/org/junit/jupiter/api/condition/JRE.java.jte @@ -15,7 +15,7 @@ import java.util.EnumSet; import org.apiguardian.api.API; import org.junit.platform.commons.logging.Logger; import org.junit.platform.commons.logging.LoggerFactory; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.util.StringUtils; /** @@ -85,9 +85,9 @@ public enum JRE { // that returns an instance of java.lang.Runtime.Version which has the // following method: public int major() Method versionMethod = Runtime.class.getMethod("version"); - Object version = ReflectionUtils.invokeMethod(versionMethod, null); + Object version = ReflectionSupport.invokeMethod(versionMethod, null); Method majorMethod = version.getClass().getMethod("major"); - int major = (int) ReflectionUtils.invokeMethod(majorMethod, version); + int major = (int) ReflectionSupport.invokeMethod(majorMethod, version); switch (major) {<%-- --%>@for(var jre : jres)<%-- --%>@if(jre.getVersion() != 8) diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/InstantiatingConfigurationParameterConverter.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/InstantiatingConfigurationParameterConverter.java index 36727edfd0ad..936dfe093520 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/InstantiatingConfigurationParameterConverter.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/InstantiatingConfigurationParameterConverter.java @@ -16,7 +16,7 @@ import org.junit.platform.commons.function.Try; import org.junit.platform.commons.logging.Logger; import org.junit.platform.commons.logging.LoggerFactory; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.engine.ConfigurationParameters; /** @@ -49,9 +49,9 @@ Supplier> supply(ConfigurationParameters configurationParameters, St } private Supplier> newInstanceSupplier(String className, String key) { - Try> clazz = ReflectionUtils.tryToLoadClass(className); + Try> clazz = ReflectionSupport.tryToLoadClass(className); // @formatter:off - return () -> clazz.andThenTry(ReflectionUtils::newInstance) + return () -> clazz.andThenTry(ReflectionSupport::newInstance) .andThenTry(this.clazz::cast) .ifSuccess(generator -> logSuccessMessage(className, key)) .ifFailure(cause -> logFailureMessage(className, key, cause)) diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DisplayNameUtils.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DisplayNameUtils.java index 4a451a755282..b4cf927b3f97 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DisplayNameUtils.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DisplayNameUtils.java @@ -28,9 +28,9 @@ import org.junit.jupiter.engine.config.JupiterConfiguration; import org.junit.platform.commons.logging.Logger; import org.junit.platform.commons.logging.LoggerFactory; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.support.SearchOption; import org.junit.platform.commons.util.Preconditions; -import org.junit.platform.commons.util.ReflectionUtils; import org.junit.platform.commons.util.StringUtils; /** @@ -137,7 +137,7 @@ private static Optional findDisplayNameGenerator(Class if (displayNameGeneratorClass == IndicativeSentences.class) { return indicativeSentencesGenerator; } - return ReflectionUtils.newInstance(displayNameGeneratorClass); + return ReflectionSupport.newInstance(displayNameGeneratorClass); }); } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExtensionUtils.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExtensionUtils.java index ca315bbd9271..951ea9b82d05 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExtensionUtils.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExtensionUtils.java @@ -36,6 +36,7 @@ import org.junit.jupiter.engine.extension.ExtensionRegistrar; import org.junit.jupiter.engine.extension.MutableExtensionRegistry; import org.junit.platform.commons.PreconditionViolationException; +import org.junit.platform.commons.support.ModifierSupport; import org.junit.platform.commons.util.Preconditions; import org.junit.platform.commons.util.ReflectionUtils; @@ -89,7 +90,7 @@ static MutableExtensionRegistry populateNewExtensionRegistryFromExtendWithAnnota * @since 5.11 */ static void registerExtensionsFromStaticFields(ExtensionRegistrar registrar, Class clazz) { - streamExtensionRegisteringFields(clazz, ReflectionUtils::isStatic) // + streamExtensionRegisteringFields(clazz, ModifierSupport::isStatic) // .forEach(field -> { List> extensionTypes = streamDeclarativeExtensionTypes(field).collect( toList()); diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtils.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtils.java index fc382b2c2ce0..538ea853d7b7 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtils.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtils.java @@ -23,7 +23,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.platform.commons.JUnitException; import org.junit.platform.commons.support.HierarchyTraversalMode; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ModifierSupport; /** * Collection of utilities for working with test lifecycle methods. @@ -81,7 +81,7 @@ private static List findMethodsAndCheckVoidReturnType(Class testClass } private static void assertStatic(Class annotationType, Method method) { - if (ReflectionUtils.isNotStatic(method)) { + if (ModifierSupport.isNotStatic(method)) { throw new JUnitException(String.format( "@%s method '%s' must be static unless the test class is annotated with @TestInstance(Lifecycle.PER_CLASS).", annotationType.getSimpleName(), method.toGenericString())); @@ -89,7 +89,7 @@ private static void assertStatic(Class annotationType, Met } private static void assertNonStatic(Class annotationType, Method method) { - if (ReflectionUtils.isStatic(method)) { + if (ModifierSupport.isStatic(method)) { throw new JUnitException(String.format("@%s method '%s' must not be static.", annotationType.getSimpleName(), method.toGenericString())); } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassOrderingVisitor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassOrderingVisitor.java index 10f0490b0721..fb60bd702019 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassOrderingVisitor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassOrderingVisitor.java @@ -20,7 +20,7 @@ import org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor; import org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor; import org.junit.platform.commons.support.AnnotationSupport; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.engine.TestDescriptor; /** @@ -59,7 +59,7 @@ protected DescriptorWrapperOrderer getDescriptorWrapperOrderer( AnnotatedElement annotatedElement = descriptorWrapper.getAnnotatedElement(); return AnnotationSupport.findAnnotation(annotatedElement, TestClassOrder.class)// .map(TestClassOrder::value)// - . map(ReflectionUtils::newInstance)// + . map(ReflectionSupport::newInstance)// .map(this::createDescriptorWrapperOrderer)// .orElse(inheritedDescriptorWrapperOrderer); } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassSelectorResolver.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassSelectorResolver.java index e63656017ad0..77b6f69aa58c 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassSelectorResolver.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassSelectorResolver.java @@ -13,9 +13,10 @@ import static java.util.function.Predicate.isEqual; import static java.util.stream.Collectors.toCollection; import static org.junit.jupiter.engine.discovery.predicates.IsTestClassWithTests.isTestOrTestFactoryOrTestTemplateMethod; +import static org.junit.platform.commons.support.HierarchyTraversalMode.TOP_DOWN; +import static org.junit.platform.commons.support.ReflectionSupport.findMethods; import static org.junit.platform.commons.support.ReflectionSupport.streamNestedClasses; import static org.junit.platform.commons.util.FunctionUtils.where; -import static org.junit.platform.commons.util.ReflectionUtils.findMethods; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId; import static org.junit.platform.engine.support.discovery.SelectorResolver.Resolution.unresolved; @@ -35,7 +36,7 @@ import org.junit.jupiter.engine.descriptor.NestedClassTestDescriptor; import org.junit.jupiter.engine.discovery.predicates.IsNestedTestClass; import org.junit.jupiter.engine.discovery.predicates.IsTestClassWithTests; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.engine.DiscoverySelector; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.UniqueId; @@ -93,7 +94,7 @@ public Resolution resolve(UniqueIdSelector selector, Context context) { UniqueId.Segment lastSegment = uniqueId.getLastSegment(); if (ClassTestDescriptor.SEGMENT_TYPE.equals(lastSegment.getType())) { String className = lastSegment.getValue(); - return ReflectionUtils.tryToLoadClass(className).toOptional().filter(isTestClassWithTests).map( + return ReflectionSupport.tryToLoadClass(className).toOptional().filter(isTestClassWithTests).map( testClass -> toResolution( context.addToParent(parent -> Optional.of(newClassTestDescriptor(parent, testClass))))).orElse( unresolved()); @@ -103,7 +104,7 @@ public Resolution resolve(UniqueIdSelector selector, Context context) { return toResolution(context.addToParent(() -> selectUniqueId(uniqueId.removeLastSegment()), parent -> { if (parent instanceof ClassBasedTestDescriptor) { Class parentTestClass = ((ClassBasedTestDescriptor) parent).getTestClass(); - return ReflectionUtils.findNestedClasses(parentTestClass, + return ReflectionSupport.findNestedClasses(parentTestClass, isNestedTestClass.and( where(Class::getSimpleName, isEqual(simpleClassName)))).stream().findFirst().flatMap( testClass -> Optional.of(newNestedClassTestDescriptor(parent, testClass))); @@ -133,7 +134,7 @@ private Resolution toResolution(Optional tes testClasses.add(testClass); // @formatter:off return Resolution.match(Match.exact(it, () -> { - Stream methods = findMethods(testClass, isTestOrTestFactoryOrTestTemplateMethod).stream() + Stream methods = findMethods(testClass, isTestOrTestFactoryOrTestTemplateMethod, TOP_DOWN).stream() .map(method -> selectMethod(testClasses, method)); Stream nestedClasses = streamNestedClasses(testClass, isNestedTestClass) .map(nestedClass -> DiscoverySelectors.selectNestedClass(testClasses, nestedClass)); diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodFinder.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodFinder.java index 2b2adf3e12b5..09bfb9d50743 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodFinder.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodFinder.java @@ -15,8 +15,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.util.Preconditions; -import org.junit.platform.commons.util.ReflectionUtils; /** * @since 5.0 @@ -34,7 +34,7 @@ Optional findMethod(String methodSpecPart, Class clazz) { String methodName = matcher.group(1); String parameterTypeNames = matcher.group(2); - return ReflectionUtils.findMethod(clazz, methodName, parameterTypeNames); + return ReflectionSupport.findMethod(clazz, methodName, parameterTypeNames); } } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodOrderingVisitor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodOrderingVisitor.java index f7d997a5a727..44e056fedf36 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodOrderingVisitor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodOrderingVisitor.java @@ -22,7 +22,7 @@ import org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor; import org.junit.jupiter.engine.descriptor.JupiterTestDescriptor; import org.junit.jupiter.engine.descriptor.MethodBasedTestDescriptor; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.engine.TestDescriptor; /** @@ -50,7 +50,7 @@ public void visit(TestDescriptor testDescriptor) { private void orderContainedMethods(ClassBasedTestDescriptor classBasedTestDescriptor, Class testClass) { findAnnotation(testClass, TestMethodOrder.class)// .map(TestMethodOrder::value)// - . map(ReflectionUtils::newInstance)// + . map(ReflectionSupport::newInstance)// .map(Optional::of)// .orElseGet(configuration::getDefaultTestMethodOrderer)// .ifPresent(methodOrderer -> { diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsInnerClass.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsInnerClass.java index 30adff839a04..9417a9b3b4c3 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsInnerClass.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsInnerClass.java @@ -11,8 +11,8 @@ package org.junit.jupiter.engine.discovery.predicates; import static org.apiguardian.api.API.Status.INTERNAL; +import static org.junit.platform.commons.support.ModifierSupport.isPrivate; import static org.junit.platform.commons.util.ReflectionUtils.isInnerClass; -import static org.junit.platform.commons.util.ReflectionUtils.isPrivate; import java.util.function.Predicate; diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsPotentialTestContainer.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsPotentialTestContainer.java index 8e2074445949..2dc5da128be8 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsPotentialTestContainer.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsPotentialTestContainer.java @@ -11,9 +11,9 @@ package org.junit.jupiter.engine.discovery.predicates; import static org.apiguardian.api.API.Status.INTERNAL; -import static org.junit.platform.commons.util.ReflectionUtils.isAbstract; +import static org.junit.platform.commons.support.ModifierSupport.isAbstract; +import static org.junit.platform.commons.support.ModifierSupport.isPrivate; import static org.junit.platform.commons.util.ReflectionUtils.isInnerClass; -import static org.junit.platform.commons.util.ReflectionUtils.isPrivate; import java.util.function.Predicate; diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestClassWithTests.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestClassWithTests.java index 49528f285d6d..162ed3037919 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestClassWithTests.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestClassWithTests.java @@ -16,6 +16,7 @@ import java.util.function.Predicate; import org.apiguardian.api.API; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.util.ReflectionUtils; /** @@ -51,7 +52,7 @@ private boolean hasTestOrTestFactoryOrTestTemplateMethods(Class candidate) { } private boolean hasNestedTests(Class candidate) { - return !ReflectionUtils.findNestedClasses(candidate, isNestedTestClass).isEmpty(); + return !ReflectionSupport.findNestedClasses(candidate, isNestedTestClass).isEmpty(); } } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestableMethod.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestableMethod.java index 20a51753ec0c..c2ff12dcc633 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestableMethod.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestableMethod.java @@ -11,9 +11,9 @@ package org.junit.jupiter.engine.discovery.predicates; import static org.junit.platform.commons.support.AnnotationSupport.isAnnotated; -import static org.junit.platform.commons.util.ReflectionUtils.isAbstract; -import static org.junit.platform.commons.util.ReflectionUtils.isPrivate; -import static org.junit.platform.commons.util.ReflectionUtils.isStatic; +import static org.junit.platform.commons.support.ModifierSupport.isAbstract; +import static org.junit.platform.commons.support.ModifierSupport.isPrivate; +import static org.junit.platform.commons.support.ModifierSupport.isStatic; import static org.junit.platform.commons.util.ReflectionUtils.returnsPrimitiveVoid; import java.lang.annotation.Annotation; diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/MethodInvocation.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/MethodInvocation.java index 22e1345d88e6..302e6dcc556f 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/MethodInvocation.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/MethodInvocation.java @@ -19,7 +19,7 @@ import org.junit.jupiter.api.extension.InvocationInterceptor.Invocation; import org.junit.jupiter.api.extension.ReflectiveInvocationContext; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ReflectionSupport; class MethodInvocation implements Invocation, ReflectiveInvocationContext { @@ -57,7 +57,7 @@ public List getArguments() { @Override @SuppressWarnings("unchecked") public T proceed() { - return (T) ReflectionUtils.invokeMethod(this.method, this.target.orElse(null), this.arguments); + return (T) ReflectionSupport.invokeMethod(this.method, this.target.orElse(null), this.arguments); } } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/AutoCloseExtension.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/AutoCloseExtension.java index 56c0ae2efc9a..453e637701b0 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/AutoCloseExtension.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/AutoCloseExtension.java @@ -24,6 +24,8 @@ import org.junit.platform.commons.logging.Logger; import org.junit.platform.commons.logging.LoggerFactory; import org.junit.platform.commons.support.AnnotationSupport; +import org.junit.platform.commons.support.ModifierSupport; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.util.Preconditions; import org.junit.platform.commons.util.ReflectionUtils; import org.junit.platform.commons.util.StringUtils; @@ -58,7 +60,7 @@ public void afterAll(ExtensionContext context) { } private static void closeFields(Class testClass, Object testInstance, ThrowableCollector throwableCollector) { - Predicate predicate = (testInstance == null ? ReflectionUtils::isStatic : ReflectionUtils::isNotStatic); + Predicate predicate = (testInstance == null ? ModifierSupport::isStatic : ModifierSupport::isNotStatic); AnnotationSupport.findAnnotatedFields(testClass, AutoClose.class, predicate, BOTTOM_UP).forEach( field -> throwableCollector.execute(() -> closeField(field, testInstance))); } @@ -71,7 +73,7 @@ private static void closeField(Field field, Object testInstance) throws Exceptio checkCondition(!fieldType.isPrimitive(), "@AutoClose is not supported on primitive field %s.", field); checkCondition(!fieldType.isArray(), "@AutoClose is not supported on array field %s.", field); - Object fieldValue = ReflectionUtils.tryToReadFieldValue(field, testInstance).get(); + Object fieldValue = ReflectionSupport.tryToReadFieldValue(field, testInstance).get(); if (fieldValue == null) { logger.warn(() -> String.format("Cannot @AutoClose field %s because it is null.", getQualifiedName(field))); } @@ -88,13 +90,13 @@ private static void invokeCloseMethod(Field field, Object target, String methodN } Class targetType = target.getClass(); - Method closeMethod = ReflectionUtils.findMethod(targetType, methodName).orElseThrow( + Method closeMethod = ReflectionSupport.findMethod(targetType, methodName).orElseThrow( () -> new ExtensionConfigurationException( String.format("Cannot @AutoClose field %s because %s does not define method %s().", getQualifiedName(field), targetType.getName(), methodName))); closeMethod = ReflectionUtils.getInterfaceMethodIfPossible(closeMethod, targetType); - ReflectionUtils.invokeMethod(closeMethod, target); + ReflectionSupport.invokeMethod(closeMethod, target); } private static void checkCondition(boolean condition, String messageFormat, Field field) { diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/MutableExtensionRegistry.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/MutableExtensionRegistry.java index b7b3f43034dd..5a719f8b2817 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/MutableExtensionRegistry.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/MutableExtensionRegistry.java @@ -35,9 +35,9 @@ import org.junit.jupiter.engine.config.JupiterConfiguration; import org.junit.platform.commons.logging.Logger; import org.junit.platform.commons.logging.LoggerFactory; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.util.ClassLoaderUtils; import org.junit.platform.commons.util.Preconditions; -import org.junit.platform.commons.util.ReflectionUtils; /** * Default, mutable implementation of {@link ExtensionRegistry}. @@ -148,7 +148,7 @@ public Stream stream(Class extensionType) { @Override public void registerExtension(Class extensionType) { if (!isAlreadyRegistered(extensionType)) { - registerLocalExtension(ReflectionUtils.newInstance(extensionType)); + registerLocalExtension(ReflectionSupport.newInstance(extensionType)); } } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java index 243114949da2..cf066e21a3ca 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java @@ -61,9 +61,10 @@ import org.junit.platform.commons.PreconditionViolationException; import org.junit.platform.commons.logging.Logger; import org.junit.platform.commons.logging.LoggerFactory; +import org.junit.platform.commons.support.ModifierSupport; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.util.ExceptionUtils; import org.junit.platform.commons.util.Preconditions; -import org.junit.platform.commons.util.ReflectionUtils; import org.junit.platform.commons.util.ToStringBuilder; /** @@ -126,11 +127,11 @@ private static void installFailureTracker(ExtensionContext context) { } private void injectStaticFields(ExtensionContext context, Class testClass) { - injectFields(context, null, testClass, ReflectionUtils::isStatic); + injectFields(context, null, testClass, ModifierSupport::isStatic); } private void injectInstanceFields(ExtensionContext context, Object instance) { - injectFields(context, instance, instance.getClass(), ReflectionUtils::isNotStatic); + injectFields(context, instance, instance.getClass(), ModifierSupport::isNotStatic); } private void injectFields(ExtensionContext context, Object testInstance, Class testClass, @@ -233,11 +234,11 @@ private TempDirFactory determineTempDirFactory(TempDir tempDir, Scope scope) { return factory == TempDirFactory.class // ? this.configuration.getDefaultTempDirFactorySupplier().get() - : ReflectionUtils.newInstance(factory); + : ReflectionSupport.newInstance(factory); } private void assertNonFinalField(Field field) { - if (ReflectionUtils.isFinal(field)) { + if (ModifierSupport.isFinal(field)) { throw new ExtensionConfigurationException("@TempDir field [" + field + "] must not be declared as final."); } } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/support/OpenTest4JAndJUnit4AwareThrowableCollector.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/support/OpenTest4JAndJUnit4AwareThrowableCollector.java index bcaffa8f6503..938ffca39d23 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/support/OpenTest4JAndJUnit4AwareThrowableCollector.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/support/OpenTest4JAndJUnit4AwareThrowableCollector.java @@ -15,7 +15,7 @@ import org.junit.platform.commons.logging.Logger; import org.junit.platform.commons.logging.LoggerFactory; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.util.UnrecoverableExceptions; import org.junit.platform.engine.support.hierarchical.ThrowableCollector; import org.opentest4j.TestAbortedException; @@ -49,7 +49,7 @@ private static Predicate createAbortedExecutionPredicate() { // Additionally support JUnit 4's AssumptionViolatedException? try { - Class clazz = ReflectionUtils.tryToLoadClass(ASSUMPTION_VIOLATED_EXCEPTION).get(); + Class clazz = ReflectionSupport.tryToLoadClass(ASSUMPTION_VIOLATED_EXCEPTION).get(); if (clazz != null) { return otaPredicate.or(clazz::isInstance); } diff --git a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/TestRuleSupport.java b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/TestRuleSupport.java index 9357468bc691..7b6697e1f44f 100644 --- a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/TestRuleSupport.java +++ b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/TestRuleSupport.java @@ -13,7 +13,8 @@ import static java.util.Collections.unmodifiableList; import static org.junit.platform.commons.support.AnnotationSupport.findPublicAnnotatedFields; import static org.junit.platform.commons.support.AnnotationSupport.isAnnotated; -import static org.junit.platform.commons.util.ReflectionUtils.findMethods; +import static org.junit.platform.commons.support.HierarchyTraversalMode.TOP_DOWN; +import static org.junit.platform.commons.support.ReflectionSupport.findMethods; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -81,7 +82,7 @@ private List findAnnotatedMethods(Object testInstance) { Predicate isRuleMethod = method -> isAnnotated(method, Rule.class); Predicate hasCorrectReturnType = method -> TestRule.class.isAssignableFrom(method.getReturnType()); - return findMethods(testInstance.getClass(), isRuleMethod.and(hasCorrectReturnType)); + return findMethods(testInstance.getClass(), isRuleMethod.and(hasCorrectReturnType), TOP_DOWN); } private List findAnnotatedFields(Object testInstance) { diff --git a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/AbstractTestRuleAdapter.java b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/AbstractTestRuleAdapter.java index 219c24a90b55..9f82e6637b55 100644 --- a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/AbstractTestRuleAdapter.java +++ b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/AbstractTestRuleAdapter.java @@ -11,8 +11,8 @@ package org.junit.jupiter.migrationsupport.rules.adapter; import static org.apiguardian.api.API.Status.INTERNAL; -import static org.junit.platform.commons.util.ReflectionUtils.findMethod; -import static org.junit.platform.commons.util.ReflectionUtils.invokeMethod; +import static org.junit.platform.commons.support.ReflectionSupport.findMethod; +import static org.junit.platform.commons.support.ReflectionSupport.invokeMethod; import java.lang.reflect.Method; diff --git a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/TestRuleAnnotatedMethod.java b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/TestRuleAnnotatedMethod.java index 13042a928da6..78eac29ca94f 100644 --- a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/TestRuleAnnotatedMethod.java +++ b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/TestRuleAnnotatedMethod.java @@ -15,7 +15,7 @@ import java.lang.reflect.Method; import org.apiguardian.api.API; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.rules.TestRule; /** @@ -25,7 +25,7 @@ public final class TestRuleAnnotatedMethod extends AbstractTestRuleAnnotatedMember { public TestRuleAnnotatedMethod(Object testInstance, Method method) { - super((TestRule) ReflectionUtils.invokeMethod(method, testInstance)); + super((TestRule) ReflectionSupport.invokeMethod(method, testInstance)); } } diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java index 359052a28b43..f625faac7f17 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java @@ -27,9 +27,9 @@ import org.junit.jupiter.params.provider.ArgumentsSource; import org.junit.jupiter.params.support.AnnotationConsumerInitializer; import org.junit.platform.commons.JUnitException; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.util.ExceptionUtils; import org.junit.platform.commons.util.Preconditions; -import org.junit.platform.commons.util.ReflectionUtils; /** * @since 5.0 @@ -100,7 +100,7 @@ public Stream provideTestTemplateInvocationContex @SuppressWarnings("ConstantConditions") private ArgumentsProvider instantiateArgumentsProvider(Class clazz) { try { - return ReflectionUtils.newInstance(clazz); + return ReflectionSupport.newInstance(clazz); } catch (Exception ex) { if (ex instanceof NoSuchMethodException) { diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java index a42e1bae8925..1b88b3a14467 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java @@ -32,7 +32,6 @@ import org.junit.jupiter.params.support.AnnotationConsumerInitializer; import org.junit.platform.commons.support.AnnotationSupport; import org.junit.platform.commons.support.ReflectionSupport; -import org.junit.platform.commons.util.ReflectionUtils; import org.junit.platform.commons.util.StringUtils; /** @@ -181,7 +180,7 @@ Resolver createResolver(ParameterContext parameterContext) { try { // @formatter:off return AnnotationSupport.findAnnotation(parameterContext.getParameter(), ConvertWith.class) .map(ConvertWith::value) - .map(clazz -> (ArgumentConverter) ReflectionUtils.newInstance(clazz)) + .map(clazz -> (ArgumentConverter) ReflectionSupport.newInstance(clazz)) .map(converter -> AnnotationConsumerInitializer.initialize(parameterContext.getParameter(), converter)) .map(Converter::new) .orElse(Converter.DEFAULT); diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/FieldArgumentsProvider.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/FieldArgumentsProvider.java index c385d1bb3ba9..7116bda70dfa 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/FieldArgumentsProvider.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/FieldArgumentsProvider.java @@ -24,6 +24,8 @@ import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.platform.commons.JUnitException; +import org.junit.platform.commons.support.ModifierSupport; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.util.ClassLoaderUtils; import org.junit.platform.commons.util.CollectionUtils; import org.junit.platform.commons.util.Preconditions; @@ -87,7 +89,7 @@ static Field findField(Class testClass, String fieldName) { } private static Field validateField(Field field, Object testInstance) { - Preconditions.condition(field.getDeclaringClass().isInstance(testInstance) || ReflectionUtils.isStatic(field), + Preconditions.condition(field.getDeclaringClass().isInstance(testInstance) || ModifierSupport.isStatic(field), () -> format("Field '%s' must be static: local @FieldSource fields must be static " + "unless the PER_CLASS @TestInstance lifecycle mode is used; " + "external @FieldSource fields must always be static.", @@ -96,7 +98,7 @@ private static Field validateField(Field field, Object testInstance) { } private static Object readField(Field field, Object testInstance) { - Object value = ReflectionUtils.tryToReadFieldValue(field, testInstance).getOrThrow( + Object value = ReflectionSupport.tryToReadFieldValue(field, testInstance).getOrThrow( cause -> new JUnitException(format("Could not read field [%s]", field.getName()), cause)); String fieldName = field.getName(); diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/FallbackStringToObjectConverter.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/FallbackStringToObjectConverter.java index 680c6aa4712b..a7b86052d779 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/FallbackStringToObjectConverter.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/FallbackStringToObjectConverter.java @@ -10,12 +10,12 @@ package org.junit.platform.commons.support.conversion; -import static org.junit.platform.commons.util.ReflectionUtils.HierarchyTraversalMode.BOTTOM_UP; +import static org.junit.platform.commons.support.HierarchyTraversalMode.BOTTOM_UP; +import static org.junit.platform.commons.support.ModifierSupport.isNotPrivate; +import static org.junit.platform.commons.support.ModifierSupport.isNotStatic; +import static org.junit.platform.commons.support.ReflectionSupport.findMethods; +import static org.junit.platform.commons.support.ReflectionSupport.invokeMethod; import static org.junit.platform.commons.util.ReflectionUtils.findConstructors; -import static org.junit.platform.commons.util.ReflectionUtils.findMethods; -import static org.junit.platform.commons.util.ReflectionUtils.invokeMethod; -import static org.junit.platform.commons.util.ReflectionUtils.isNotPrivate; -import static org.junit.platform.commons.util.ReflectionUtils.isNotStatic; import static org.junit.platform.commons.util.ReflectionUtils.newInstance; import java.lang.reflect.Constructor; diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToClassConverter.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToClassConverter.java index 36ec2bb211a7..882feb0ff78e 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToClassConverter.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToClassConverter.java @@ -10,7 +10,7 @@ package org.junit.platform.commons.support.conversion; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ReflectionSupport; class StringToClassConverter implements StringToObjectConverter { @@ -27,7 +27,7 @@ public Object convert(String source, Class targetType) throws Exception { @Override public Object convert(String className, Class targetType, ClassLoader classLoader) throws Exception { // @formatter:off - return ReflectionUtils.tryToLoadClass(className, classLoader) + return ReflectionSupport.tryToLoadClass(className, classLoader) .getOrThrow(cause -> new ConversionException( "Failed to convert String \"" + className + "\" to type java.lang.Class", cause)); // @formatter:on diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClassSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClassSelector.java index 2d263b092453..a244c23486db 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClassSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClassSelector.java @@ -20,7 +20,7 @@ import org.apiguardian.api.API; import org.junit.platform.commons.PreconditionViolationException; import org.junit.platform.commons.function.Try; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.util.ToStringBuilder; import org.junit.platform.engine.DiscoverySelector; import org.junit.platform.engine.DiscoverySelectorIdentifier; @@ -92,8 +92,8 @@ public Class getJavaClass() { if (this.javaClass == null) { // @formatter:off Try> tryToLoadClass = this.classLoader == null - ? ReflectionUtils.tryToLoadClass(this.className) - : ReflectionUtils.tryToLoadClass(this.className, this.classLoader); + ? ReflectionSupport.tryToLoadClass(this.className) + : ReflectionSupport.tryToLoadClass(this.className, this.classLoader); this.javaClass = tryToLoadClass.getOrThrow(cause -> new PreconditionViolationException("Could not load class with name: " + this.className, cause)); // @formatter:on diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/MethodSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/MethodSelector.java index 4a58eb805a8f..7f6659482311 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/MethodSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/MethodSelector.java @@ -23,6 +23,7 @@ import org.junit.platform.commons.JUnitException; import org.junit.platform.commons.PreconditionViolationException; import org.junit.platform.commons.function.Try; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.util.ClassUtils; import org.junit.platform.commons.util.ReflectionUtils; import org.junit.platform.commons.util.ToStringBuilder; @@ -236,8 +237,8 @@ private void lazyLoadJavaClass() { // @formatter:off if (this.javaClass == null) { Try> tryToLoadClass = this.classLoader == null - ? ReflectionUtils.tryToLoadClass(this.className) - : ReflectionUtils.tryToLoadClass(this.className, this.classLoader); + ? ReflectionSupport.tryToLoadClass(this.className) + : ReflectionSupport.tryToLoadClass(this.className, this.classLoader); this.javaClass = tryToLoadClass.getOrThrow(cause -> new PreconditionViolationException("Could not load class with name: " + this.className, cause)); } @@ -249,14 +250,14 @@ private void lazyLoadJavaMethod() { lazyLoadJavaClass(); lazyLoadParameterTypes(); if (this.parameterTypes.length > 0) { - this.javaMethod = ReflectionUtils.findMethod(this.javaClass, this.methodName, + this.javaMethod = ReflectionSupport.findMethod(this.javaClass, this.methodName, this.parameterTypes).orElseThrow( () -> new PreconditionViolationException(String.format( "Could not find method with name [%s] and parameter types [%s] in class [%s].", this.methodName, this.parameterTypeNames, this.javaClass.getName()))); } else { - this.javaMethod = ReflectionUtils.findMethod(this.javaClass, this.methodName).orElseThrow( + this.javaMethod = ReflectionSupport.findMethod(this.javaClass, this.methodName).orElseThrow( () -> new PreconditionViolationException( String.format("Could not find method with name [%s] in class [%s].", this.methodName, this.javaClass.getName()))); diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/ClassSource.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/ClassSource.java index b47cc78cc2a9..f5833e11cb1a 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/ClassSource.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/ClassSource.java @@ -18,8 +18,8 @@ import org.apiguardian.api.API; import org.junit.platform.commons.PreconditionViolationException; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.util.Preconditions; -import org.junit.platform.commons.util.ReflectionUtils; import org.junit.platform.commons.util.ToStringBuilder; import org.junit.platform.engine.TestSource; @@ -175,7 +175,7 @@ public final String getClassName() { public final Class getJavaClass() { if (this.javaClass == null) { // @formatter:off - this.javaClass = ReflectionUtils.tryToLoadClass(this.className).getOrThrow( + this.javaClass = ReflectionSupport.tryToLoadClass(this.className).getOrThrow( cause -> new PreconditionViolationException("Could not load class with name: " + this.className, cause)); // @formatter:on } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/MethodSource.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/MethodSource.java index 79d2574b99f1..6c89a9db4432 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/MethodSource.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/MethodSource.java @@ -18,8 +18,8 @@ import org.apiguardian.api.API; import org.junit.platform.commons.PreconditionViolationException; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.util.Preconditions; -import org.junit.platform.commons.util.ReflectionUtils; import org.junit.platform.commons.util.StringUtils; import org.junit.platform.commons.util.ToStringBuilder; import org.junit.platform.engine.TestSource; @@ -195,7 +195,7 @@ public final Method getJavaMethod() { private void lazyLoadJavaClass() { if (this.javaClass == null) { // @formatter:off - this.javaClass = ReflectionUtils.tryToLoadClass(this.className).getOrThrow( + this.javaClass = ReflectionSupport.tryToLoadClass(this.className).getOrThrow( cause -> new PreconditionViolationException("Could not load class with name: " + this.className, cause)); // @formatter:on } @@ -206,14 +206,14 @@ private void lazyLoadJavaMethod() { if (this.javaMethod == null) { if (StringUtils.isNotBlank(this.methodParameterTypes)) { - this.javaMethod = ReflectionUtils.findMethod(this.javaClass, this.methodName, + this.javaMethod = ReflectionSupport.findMethod(this.javaClass, this.methodName, this.methodParameterTypes).orElseThrow( () -> new PreconditionViolationException(String.format( "Could not find method with name [%s] and parameter types [%s] in class [%s].", this.methodName, this.methodParameterTypes, this.javaClass.getName()))); } else { - this.javaMethod = ReflectionUtils.findMethod(this.javaClass, this.methodName).orElseThrow( + this.javaMethod = ReflectionSupport.findMethod(this.javaClass, this.methodName).orElseThrow( () -> new PreconditionViolationException( String.format("Could not find method with name [%s] in class [%s].", this.methodName, this.javaClass.getName()))); diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/DefaultParallelExecutionConfigurationStrategy.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/DefaultParallelExecutionConfigurationStrategy.java index fc5ac9e257fe..c81c192b8cc7 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/DefaultParallelExecutionConfigurationStrategy.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/DefaultParallelExecutionConfigurationStrategy.java @@ -18,8 +18,8 @@ import org.apiguardian.api.API; import org.junit.platform.commons.JUnitException; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.util.Preconditions; -import org.junit.platform.commons.util.ReflectionUtils; import org.junit.platform.engine.ConfigurationParameters; /** @@ -99,13 +99,13 @@ public ParallelExecutionConfiguration createConfiguration(ConfigurationParameter public ParallelExecutionConfiguration createConfiguration(ConfigurationParameters configurationParameters) { String className = configurationParameters.get(CONFIG_CUSTOM_CLASS_PROPERTY_NAME).orElseThrow( () -> new JUnitException(CONFIG_CUSTOM_CLASS_PROPERTY_NAME + " must be set")); - return ReflectionUtils.tryToLoadClass(className) // + return ReflectionSupport.tryToLoadClass(className) // .andThenTry(strategyClass -> { Preconditions.condition( ParallelExecutionConfigurationStrategy.class.isAssignableFrom(strategyClass), CONFIG_CUSTOM_CLASS_PROPERTY_NAME + " does not implement " + ParallelExecutionConfigurationStrategy.class); - return (ParallelExecutionConfigurationStrategy) ReflectionUtils.newInstance(strategyClass); + return (ParallelExecutionConfigurationStrategy) ReflectionSupport.newInstance(strategyClass); }) // .andThenTry(strategy -> strategy.createConfiguration(configurationParameters)) // .getOrThrow(cause -> new JUnitException( diff --git a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/ClassSelectorResolver.java b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/ClassSelectorResolver.java index 153a671b317d..ce9107310ecf 100644 --- a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/ClassSelectorResolver.java +++ b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/ClassSelectorResolver.java @@ -18,7 +18,7 @@ import org.junit.platform.commons.logging.Logger; import org.junit.platform.commons.logging.LoggerFactory; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.engine.ConfigurationParameters; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.UniqueId; @@ -89,7 +89,7 @@ public Resolution resolve(UniqueIdSelector selector, Context context) { } private static Optional> tryLoadSuiteClass(UniqueId.Segment segment) { - return ReflectionUtils.tryToLoadClass(segment.getValue()).toOptional(); + return ReflectionSupport.tryToLoadClass(segment.getValue()).toOptional(); } private static Resolution toResolution(Optional suite) { diff --git a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/IsPotentialTestContainer.java b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/IsPotentialTestContainer.java index f079cf8162bf..9a72f4c4b581 100644 --- a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/IsPotentialTestContainer.java +++ b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/IsPotentialTestContainer.java @@ -10,9 +10,9 @@ package org.junit.platform.suite.engine; -import static org.junit.platform.commons.util.ReflectionUtils.isAbstract; +import static org.junit.platform.commons.support.ModifierSupport.isAbstract; +import static org.junit.platform.commons.support.ModifierSupport.isPrivate; import static org.junit.platform.commons.util.ReflectionUtils.isInnerClass; -import static org.junit.platform.commons.util.ReflectionUtils.isPrivate; import java.util.function.Predicate; diff --git a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/LifecycleMethodUtils.java b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/LifecycleMethodUtils.java index 09098df17d7f..325f6817ae29 100644 --- a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/LifecycleMethodUtils.java +++ b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/LifecycleMethodUtils.java @@ -19,7 +19,7 @@ import org.junit.platform.commons.JUnitException; import org.junit.platform.commons.support.HierarchyTraversalMode; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ModifierSupport; import org.junit.platform.engine.support.hierarchical.ThrowableCollector; import org.junit.platform.suite.api.AfterSuite; import org.junit.platform.suite.api.BeforeSuite; @@ -60,14 +60,14 @@ private static List findMethodsAndAssertStaticAndNonPrivate(Class tes } private static void assertStatic(Class annotationType, Method method) { - if (ReflectionUtils.isNotStatic(method)) { + if (ModifierSupport.isNotStatic(method)) { throw new JUnitException(String.format("@%s method '%s' must be static.", annotationType.getSimpleName(), method.toGenericString())); } } private static void assertNonPrivate(Class annotationType, Method method) { - if (ReflectionUtils.isPrivate(method)) { + if (ModifierSupport.isPrivate(method)) { throw new JUnitException(String.format("@%s method '%s' must not be private.", annotationType.getSimpleName(), method.toGenericString())); } diff --git a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestDescriptor.java b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestDescriptor.java index b8e3028b0d29..ded5d53aebc2 100644 --- a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestDescriptor.java +++ b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestDescriptor.java @@ -17,8 +17,8 @@ import java.util.List; import org.junit.platform.commons.JUnitException; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.util.Preconditions; -import org.junit.platform.commons.util.ReflectionUtils; import org.junit.platform.commons.util.StringUtils; import org.junit.platform.engine.ConfigurationParameters; import org.junit.platform.engine.EngineExecutionListener; @@ -147,7 +147,7 @@ private void executeBeforeSuiteMethods(List beforeSuiteMethods, Throwabl return; } for (Method beforeSuiteMethod : beforeSuiteMethods) { - throwableCollector.execute(() -> ReflectionUtils.invokeMethod(beforeSuiteMethod, null)); + throwableCollector.execute(() -> ReflectionSupport.invokeMethod(beforeSuiteMethod, null)); if (throwableCollector.isNotEmpty()) { return; } @@ -170,7 +170,7 @@ private TestExecutionSummary executeTests(EngineExecutionListener parentEngineEx private void executeAfterSuiteMethods(List afterSuiteMethods, ThrowableCollector throwableCollector) { for (Method afterSuiteMethod : afterSuiteMethods) { - throwableCollector.execute(() -> ReflectionUtils.invokeMethod(afterSuiteMethod, null)); + throwableCollector.execute(() -> ReflectionSupport.invokeMethod(afterSuiteMethod, null)); } } diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/TestSourceProvider.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/TestSourceProvider.java index 3797f1014209..2da8ffcd8ff3 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/TestSourceProvider.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/TestSourceProvider.java @@ -14,8 +14,9 @@ import static java.util.function.Predicate.isEqual; import static java.util.stream.Collectors.toList; import static org.apiguardian.api.API.Status.INTERNAL; +import static org.junit.platform.commons.support.HierarchyTraversalMode.TOP_DOWN; +import static org.junit.platform.commons.support.ReflectionSupport.findMethods; import static org.junit.platform.commons.util.FunctionUtils.where; -import static org.junit.platform.commons.util.ReflectionUtils.findMethods; import java.lang.reflect.Method; import java.util.List; @@ -72,7 +73,8 @@ private String sanitizeMethodName(String methodName) { } private Method findMethod(Class testClass, String methodName) { - List methods = methodsCache.computeIfAbsent(testClass, clazz -> findMethods(clazz, m -> true)).stream() // + List methods = methodsCache.computeIfAbsent(testClass, + clazz -> findMethods(clazz, m -> true, TOP_DOWN)).stream() // .filter(where(Method::getName, isEqual(methodName))) // .collect(toList()); if (methods.isEmpty()) { diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/ClassSelectorResolver.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/ClassSelectorResolver.java index 6db805e7968b..e1bbc8834e78 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/ClassSelectorResolver.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/ClassSelectorResolver.java @@ -17,8 +17,8 @@ import java.util.Optional; import org.junit.platform.commons.JUnitException; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.util.ClassFilter; -import org.junit.platform.commons.util.ReflectionUtils; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.UniqueId; import org.junit.platform.engine.UniqueId.Segment; @@ -51,7 +51,7 @@ public Resolution resolve(UniqueIdSelector selector, Context context) { Segment lastSegment = selector.getUniqueId().getLastSegment(); if (SEGMENT_TYPE_RUNNER.equals(lastSegment.getType())) { String testClassName = lastSegment.getValue(); - Class testClass = ReflectionUtils.tryToLoadClass(testClassName)// + Class testClass = ReflectionSupport.tryToLoadClass(testClassName)// .getOrThrow(cause -> new JUnitException("Unknown class: " + testClassName, cause)); return resolveTestClass(testClass, context); } diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/IsPotentialJUnit4TestClass.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/IsPotentialJUnit4TestClass.java index 0d1f04831598..9470277ac407 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/IsPotentialJUnit4TestClass.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/IsPotentialJUnit4TestClass.java @@ -11,9 +11,9 @@ package org.junit.vintage.engine.discovery; import static org.apiguardian.api.API.Status.INTERNAL; -import static org.junit.platform.commons.util.ReflectionUtils.isAbstract; +import static org.junit.platform.commons.support.ModifierSupport.isAbstract; +import static org.junit.platform.commons.support.ModifierSupport.isPublic; import static org.junit.platform.commons.util.ReflectionUtils.isInnerClass; -import static org.junit.platform.commons.util.ReflectionUtils.isPublic; import java.util.function.Predicate; diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/descriptor/DescriptionUtilsTests.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/descriptor/DescriptionUtilsTests.java index 4401da092743..49c7524de53a 100644 --- a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/descriptor/DescriptionUtilsTests.java +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/descriptor/DescriptionUtilsTests.java @@ -20,8 +20,7 @@ import org.junit.jupiter.api.DynamicNode; import org.junit.jupiter.api.DynamicTest; import org.junit.jupiter.api.TestFactory; -import org.junit.platform.commons.util.ClassFilter; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.runner.Description; import org.junit.vintage.engine.discovery.IsPotentialJUnit4TestClass; @@ -32,8 +31,8 @@ class DescriptionUtilsTests { @TestFactory Stream computedMethodNameCorrectly() { - var classFilter = ClassFilter.of(new IsPotentialJUnit4TestClass()); - var testClasses = ReflectionUtils.findAllClassesInPackage("org.junit.vintage.engine.samples", classFilter); + var testClasses = ReflectionSupport.findAllClassesInPackage("org.junit.vintage.engine.samples", + new IsPotentialJUnit4TestClass(), name -> true); return testClasses.stream().flatMap(this::toDynamicTests); } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/AbstractExecutionConditionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/AbstractExecutionConditionTests.java index 5cd1462ac566..281332e7a0d1 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/AbstractExecutionConditionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/AbstractExecutionConditionTests.java @@ -14,9 +14,10 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.platform.commons.util.ReflectionUtils.findMethod; -import static org.junit.platform.commons.util.ReflectionUtils.findMethods; -import static org.junit.platform.commons.util.ReflectionUtils.newInstance; +import static org.junit.platform.commons.support.HierarchyTraversalMode.TOP_DOWN; +import static org.junit.platform.commons.support.ReflectionSupport.findMethod; +import static org.junit.platform.commons.support.ReflectionSupport.findMethods; +import static org.junit.platform.commons.support.ReflectionSupport.newInstance; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -59,10 +60,10 @@ abstract class AbstractExecutionConditionTests { void ensureAllTestMethodsAreCovered() { Predicate isTestMethod = method -> method.isAnnotationPresent(Test.class); - List methodsToTest = findMethods(getTestClass(), isTestMethod).stream()// + List methodsToTest = findMethods(getTestClass(), isTestMethod, TOP_DOWN).stream()// .map(Method::getName).sorted().collect(toList()); - List localTestMethods = findMethods(getClass(), isTestMethod).stream()// + List localTestMethods = findMethods(getClass(), isTestMethod, TOP_DOWN).stream()// .map(Method::getName).sorted().collect(toList()); assertThat(localTestMethods).isEqualTo(methodsToTest); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfConditionClassLoaderTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfConditionClassLoaderTests.java index d7ae67545a06..a303597df5db 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfConditionClassLoaderTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfConditionClassLoaderTests.java @@ -21,8 +21,8 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ConditionEvaluationResult; import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.test.TestClassLoader; -import org.junit.platform.commons.util.ReflectionUtils; /** * Tests for {@link DisabledIfCondition} using custom {@link ClassLoader} arrangements. @@ -40,7 +40,7 @@ void enabledWithStaticMethodInTypeFromDifferentClassLoader() throws Exception { assertThat(testClass.getClassLoader()).isSameAs(testClassLoader); ExtensionContext context = mock(); - Method annotatedMethod = ReflectionUtils.findMethod(getClass(), "enabledMethod").get(); + Method annotatedMethod = ReflectionSupport.findMethod(getClass(), "enabledMethod").get(); when(context.getElement()).thenReturn(Optional.of(annotatedMethod)); doReturn(testClass).when(context).getRequiredTestClass(); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfConditionClassLoaderTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfConditionClassLoaderTests.java index fc74017cdc93..808d50fdd592 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfConditionClassLoaderTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfConditionClassLoaderTests.java @@ -21,8 +21,8 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ConditionEvaluationResult; import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.test.TestClassLoader; -import org.junit.platform.commons.util.ReflectionUtils; /** * Tests for {@link EnabledIfCondition} using custom {@link ClassLoader} arrangements. @@ -40,7 +40,7 @@ void enabledWithStaticMethodInTypeFromDifferentClassLoader() throws Exception { assertThat(testClass.getClassLoader()).isSameAs(testClassLoader); ExtensionContext context = mock(); - Method annotatedMethod = ReflectionUtils.findMethod(getClass(), "enabledMethod").get(); + Method annotatedMethod = ReflectionSupport.findMethod(getClass(), "enabledMethod").get(); when(context.getElement()).thenReturn(Optional.of(annotatedMethod)); doReturn(testClass).when(context).getRequiredTestClass(); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExtensionComposabilityTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExtensionComposabilityTests.java index 60531a9a73bb..bf909c77c332 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExtensionComposabilityTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExtensionComposabilityTests.java @@ -30,8 +30,8 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestFactory; import org.junit.platform.commons.support.ModifierSupport; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.util.ClassUtils; -import org.junit.platform.commons.util.ReflectionUtils; /** * Unit tests for extension composability in JUnit Jupiter. @@ -82,7 +82,7 @@ void ensureJupiterExtensionApisAreComposable() { // @formatter:off List actualMethods = Arrays.stream(dynamicKitchenSinkExtension.getClass().getDeclaredMethods()) - .filter(ReflectionUtils::isNotStatic) + .filter(ModifierSupport::isNotStatic) .collect(toList()); List actualMethodSignatures = actualMethods.stream() @@ -140,7 +140,7 @@ Stream kitchenSinkExtensionImplementsAllExtensionApis() { } private List> findExtensionApis() { - return ReflectionUtils.findAllClassesInPackage(Extension.class.getPackage().getName(), this::isExtensionApi, + return ReflectionSupport.findAllClassesInPackage(Extension.class.getPackage().getName(), this::isExtensionApi, name -> true); } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/support/TypeBasedParameterResolverTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/support/TypeBasedParameterResolverTests.java index 178547888a2f..0451bfd98260 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/support/TypeBasedParameterResolverTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/support/TypeBasedParameterResolverTests.java @@ -32,7 +32,7 @@ import org.junit.jupiter.api.extension.ParameterResolutionException; import org.junit.jupiter.api.extension.ParameterResolver; import org.junit.platform.commons.PreconditionViolationException; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ReflectionSupport; /** * @since 5.6 @@ -98,7 +98,7 @@ private static ExtensionContext extensionContext() { } private Parameter findParameterOfMethod(String methodName, Class... parameterTypes) { - Method method = ReflectionUtils.findMethod(Sample.class, methodName, parameterTypes).get(); + Method method = ReflectionSupport.findMethod(Sample.class, methodName, parameterTypes).get(); return method.getParameters()[0]; } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolverTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolverTests.java index 7e938d9eb954..5347a3609388 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolverTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolverTests.java @@ -72,7 +72,7 @@ import org.junit.jupiter.engine.descriptor.subpackage.ClassWithStaticInnerTestCases; import org.junit.platform.commons.JUnitException; import org.junit.platform.commons.PreconditionViolationException; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.engine.DiscoverySelector; import org.junit.platform.engine.SelectorResolutionResult; import org.junit.platform.engine.TestDescriptor; @@ -457,7 +457,7 @@ void packageResolutionUsingDefaultPackage() throws Exception { List uniqueIds = uniqueIds(); assertThat(uniqueIds)// .describedAs("Failed to pick up DefaultPackageTestCase via classpath scanning")// - .contains(uniqueIdForClass(ReflectionUtils.tryToLoadClass("DefaultPackageTestCase").get())); + .contains(uniqueIdForClass(ReflectionSupport.tryToLoadClass("DefaultPackageTestCase").get())); assertThat(uniqueIds).contains(uniqueIdForClass(Class1WithTestCases.class)); assertThat(uniqueIds).contains(uniqueIdForMethod(Class1WithTestCases.class, "test1()")); assertThat(uniqueIds).contains(uniqueIdForClass(Class2WithTestCases.class)); @@ -481,7 +481,7 @@ void classpathResolution() throws Exception { List uniqueIds = uniqueIds(); assertThat(uniqueIds)// .describedAs("Failed to pick up DefaultPackageTestCase via classpath scanning")// - .contains(uniqueIdForClass(ReflectionUtils.tryToLoadClass("DefaultPackageTestCase").get())); + .contains(uniqueIdForClass(ReflectionSupport.tryToLoadClass("DefaultPackageTestCase").get())); assertThat(uniqueIds).contains(uniqueIdForClass(Class1WithTestCases.class)); assertThat(uniqueIds).contains(uniqueIdForMethod(Class1WithTestCases.class, "test1()")); assertThat(uniqueIds).contains(uniqueIdForClass(Class2WithTestCases.class)); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestFactoryMethodTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestFactoryMethodTests.java index d0d390b7576d..cc07c58e3f63 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestFactoryMethodTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestFactoryMethodTests.java @@ -21,7 +21,7 @@ import org.junit.jupiter.api.DynamicTest; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestFactory; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ReflectionSupport; /** * Unit tests for {@link IsTestFactoryMethod}. @@ -57,7 +57,7 @@ void bogusFactoryMethodReturningCollectionOfStrings() { } private static Method method(String name) { - return ReflectionUtils.findMethod(ClassWithTestFactoryMethods.class, name).get(); + return ReflectionSupport.findMethod(ClassWithTestFactoryMethods.class, name).get(); } private static class ClassWithTestFactoryMethods { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestMethodTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestMethodTests.java index ae1eaa1cc33b..a3a6c6e2b8f5 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestMethodTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestMethodTests.java @@ -18,7 +18,8 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ModifierSupport; +import org.junit.platform.commons.support.ReflectionSupport; /** * Unit tests for {@link IsTestMethod}. @@ -33,7 +34,7 @@ class IsTestMethodTests { void publicTestMethod() { Method method = method("publicTestMethod"); // Ensure that somebody doesn't accidentally delete the public modifier again. - assertTrue(ReflectionUtils.isPublic(method)); + assertTrue(ModifierSupport.isPublic(method)); assertThat(isTestMethod).accepts(method); } @@ -41,7 +42,7 @@ void publicTestMethod() { void publicTestMethodWithArgument() { Method method = method("publicTestMethodWithArgument", TestInfo.class); // Ensure that somebody doesn't accidentally delete the public modifier again. - assertTrue(ReflectionUtils.isPublic(method)); + assertTrue(ModifierSupport.isPublic(method)); assertThat(isTestMethod).accepts(method); } @@ -86,11 +87,11 @@ void bogusTestMethodReturningPrimitive() { } private static Method method(String name, Class... parameterTypes) { - return ReflectionUtils.findMethod(ClassWithTestMethods.class, name, parameterTypes).get(); + return ReflectionSupport.findMethod(ClassWithTestMethods.class, name, parameterTypes).get(); } private Method abstractMethod(String name) { - return ReflectionUtils.findMethod(AbstractClassWithAbstractTestMethod.class, name).get(); + return ReflectionSupport.findMethod(AbstractClassWithAbstractTestMethod.class, name).get(); } private static abstract class AbstractClassWithAbstractTestMethod { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestTemplateMethodTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestTemplateMethodTests.java index 3b2a8c783266..d5bf7b0b927c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestTemplateMethodTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestTemplateMethodTests.java @@ -16,7 +16,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestTemplate; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ReflectionSupport; /** * Unit tests for {@link IsTestTemplateMethod}. @@ -38,7 +38,7 @@ void bogusTestTemplateMethodReturningObject() { } private static Method method(String name) { - return ReflectionUtils.findMethod(ClassWithTestTemplateMethods.class, name).get(); + return ReflectionSupport.findMethod(ClassWithTestTemplateMethods.class, name).get(); } private static class ClassWithTestTemplateMethods { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/AbstractExecutableInvokerTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/AbstractExecutableInvokerTests.java index e30d5a20ebb0..a1992c0670f1 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/AbstractExecutableInvokerTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/AbstractExecutableInvokerTests.java @@ -28,6 +28,7 @@ import org.junit.jupiter.api.extension.ParameterResolver; import org.junit.jupiter.engine.config.JupiterConfiguration; import org.junit.jupiter.engine.extension.MutableExtensionRegistry; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.util.ReflectionUtils; /** @@ -82,7 +83,8 @@ private void thereIsAParameterResolverThatResolvesTheParameterTo(Object argument } private void testMethodWithASingleStringParameter() { - this.method = ReflectionUtils.findMethod(this.instance.getClass(), "singleStringParameter", String.class).get(); + this.method = ReflectionSupport.findMethod(this.instance.getClass(), "singleStringParameter", + String.class).get(); } private void register(ParameterResolver... resolvers) { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/ParameterResolutionUtilsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/ParameterResolutionUtilsTests.java index 895aed7a1618..34b18e0723b8 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/ParameterResolutionUtilsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/ParameterResolutionUtilsTests.java @@ -32,6 +32,7 @@ import org.junit.jupiter.api.extension.ParameterResolver; import org.junit.jupiter.engine.config.JupiterConfiguration; import org.junit.jupiter.engine.extension.MutableExtensionRegistry; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.util.ReflectionUtils; /** @@ -68,7 +69,7 @@ void resolveNestedConstructorArguments() { register(new NumberParameterResolver()); Class outerClass = ConstructorInjectionTestCase.class; - ConstructorInjectionTestCase outer = ReflectionUtils.newInstance(outerClass, "str"); + ConstructorInjectionTestCase outer = ReflectionSupport.newInstance(outerClass, "str"); Class innerClass = ConstructorInjectionTestCase.NestedTestCase.class; Object[] arguments = resolveConstructorParameters(innerClass, outer); @@ -313,7 +314,7 @@ private void testMethodWithASinglePrimitiveIntParameter() { } private void testMethodWith(String methodName, Class... parameterTypes) { - this.method = ReflectionUtils.findMethod(this.instance.getClass(), methodName, parameterTypes).get(); + this.method = ReflectionSupport.findMethod(this.instance.getClass(), methodName, parameterTypes).get(); } private void register(ParameterResolver... resolvers) { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/CustomAnnotationParameterResolver.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/CustomAnnotationParameterResolver.java index 47dfdb80d95b..f15c5c5eb966 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/CustomAnnotationParameterResolver.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/CustomAnnotationParameterResolver.java @@ -13,7 +13,7 @@ import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ParameterContext; import org.junit.jupiter.api.extension.ParameterResolver; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ReflectionSupport; /** * @since 5.0 @@ -29,7 +29,7 @@ public boolean supportsParameter(ParameterContext parameterContext, ExtensionCon @Override public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) { - return ReflectionUtils.newInstance(parameterContext.getParameter().getType()); + return ReflectionSupport.newInstance(parameterContext.getParameter().getType()); } } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistrationViaParametersAndFieldsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistrationViaParametersAndFieldsTests.java index e8fa7685ef5a..9e934c3a9875 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistrationViaParametersAndFieldsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistrationViaParametersAndFieldsTests.java @@ -74,8 +74,8 @@ import org.junit.jupiter.params.provider.ValueSource; import org.junit.platform.commons.PreconditionViolationException; import org.junit.platform.commons.logging.LogRecordListener; +import org.junit.platform.commons.support.ModifierSupport; import org.junit.platform.commons.util.ExceptionUtils; -import org.junit.platform.commons.util.ReflectionUtils; import org.junit.platform.testkit.engine.EngineExecutionResults; /** @@ -914,13 +914,13 @@ class BaseFieldExtension implements BeforeAllCallback, Tes @Override public final void beforeAll(ExtensionContext context) { - injectFields("beforeAll", context.getRequiredTestClass(), null, ReflectionUtils::isStatic); + injectFields("beforeAll", context.getRequiredTestClass(), null, ModifierSupport::isStatic); } @Override public final void postProcessTestInstance(Object testInstance, ExtensionContext context) { injectFields("postProcessTestInstance", context.getRequiredTestClass(), testInstance, - ReflectionUtils::isNotStatic); + ModifierSupport::isNotStatic); } private void injectFields(String trigger, Class testClass, Object instance, Predicate predicate) { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/RepeatedTestTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/RepeatedTestTests.java index 42037190f24a..b851b1f98f0b 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/RepeatedTestTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/RepeatedTestTests.java @@ -43,7 +43,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInfo; import org.junit.jupiter.engine.AbstractJupiterTestEngineTests; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.launcher.LauncherDiscoveryRequest; import org.junit.platform.testkit.engine.Events; @@ -285,7 +285,7 @@ void failureThreshold3() { void failureThresholdWithConcurrentExecution() { Class testClass = TestCase.class; String methodName = "failureThresholdWithConcurrentExecution"; - Method method = ReflectionUtils.findMethod(testClass, methodName).get(); + Method method = ReflectionSupport.findMethod(testClass, methodName).get(); LauncherDiscoveryRequest request = request()// .selectors(selectMethod(testClass, method))// .configurationParameter(PARALLEL_EXECUTION_ENABLED_PROPERTY_NAME, "true")// @@ -313,7 +313,7 @@ void failureThresholdWithConcurrentExecution() { private Events executeTest(String methodName) { Class testClass = TestCase.class; - Method method = ReflectionUtils.findMethod(testClass, methodName).get(); + Method method = ReflectionSupport.findMethod(testClass, methodName).get(); return executeTests(selectMethod(testClass, method)).allEvents(); } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java index b338cb0567a8..734f6e441664 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java @@ -43,8 +43,8 @@ import org.junit.jupiter.api.extension.TestInstanceFactoryContext; import org.junit.jupiter.api.extension.TestInstantiationException; import org.junit.jupiter.engine.AbstractJupiterTestEngineTests; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.test.TestClassLoader; -import org.junit.platform.commons.util.ReflectionUtils; import org.junit.platform.testkit.engine.EngineExecutionResults; /** @@ -634,10 +634,10 @@ public Object createTestInstance(TestInstanceFactoryContext factoryContext, Exte instantiated(getClass(), testClass); if (factoryContext.getOuterInstance().isPresent()) { - return ReflectionUtils.newInstance(testClass, factoryContext.getOuterInstance().get()); + return ReflectionSupport.newInstance(testClass, factoryContext.getOuterInstance().get()); } // else - return ReflectionUtils.newInstance(testClass); + return ReflectionSupport.newInstance(testClass); } } @@ -698,7 +698,7 @@ public Object createTestInstance(TestInstanceFactoryContext factoryContext, Exte try (var testClassLoader = TestClassLoader.forClasses(testClass)) { // Load test class from different class loader Class clazz = testClassLoader.loadClass(className); - return ReflectionUtils.newInstance(clazz); + return ReflectionSupport.newInstance(clazz); } catch (Exception ex) { throw new RuntimeException("Failed to load class [" + className + "]", ex); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestReporterParameterResolverTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestReporterParameterResolverTests.java index 913e310c4e93..0f16131b8ff3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestReporterParameterResolverTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestReporterParameterResolverTests.java @@ -22,7 +22,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestReporter; import org.junit.jupiter.api.extension.ParameterContext; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ReflectionSupport; /** * @since 5.0 @@ -49,7 +49,7 @@ void resolve() { } private Parameter findParameterOfMethod(String methodName, Class... parameterTypes) { - Method method = ReflectionUtils.findMethod(Sample.class, methodName, parameterTypes).get(); + Method method = ReflectionSupport.findMethod(Sample.class, methodName, parameterTypes).get(); return method.getParameters()[0]; } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/support/OpenTest4JAndJUnit4AwareThrowableCollectorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/support/OpenTest4JAndJUnit4AwareThrowableCollectorTests.java index 17a195eea29a..3c81342dc92d 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/support/OpenTest4JAndJUnit4AwareThrowableCollectorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/support/OpenTest4JAndJUnit4AwareThrowableCollectorTests.java @@ -24,6 +24,7 @@ import org.junit.jupiter.api.fixtures.TrackLogRecords; import org.junit.jupiter.api.function.Executable; import org.junit.platform.commons.logging.LogRecordListener; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.util.ReflectionUtils; /** @@ -42,10 +43,10 @@ void simulateJUnit4NotInTheClasspath(LogRecordListener listener) throws Throwabl // Ensure that our custom ClassLoader actually throws a ClassNotFoundException // when attempting to load the AssumptionViolatedException class. assertThrows(ClassNotFoundException.class, - () -> ReflectionUtils.tryToLoadClass(AssumptionViolatedException.class.getName()).get()); + () -> ReflectionSupport.tryToLoadClass(AssumptionViolatedException.class.getName()).get()); Class clazz = classLoader.loadClass(OpenTest4JAndJUnit4AwareThrowableCollector.class.getName()); - assertNotNull(ReflectionUtils.newInstance(clazz)); + assertNotNull(ReflectionSupport.newInstance(clazz)); // @formatter:off assertThat(listener.stream(Level.FINE).map(LogRecord::getMessage).findFirst().orElse("")) diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestNameFormatterTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestNameFormatterTests.java index bba252b4fbd0..a438edba25c2 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestNameFormatterTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestNameFormatterTests.java @@ -47,7 +47,7 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.CsvSource; import org.junit.platform.commons.JUnitException; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ReflectionSupport; /** * @since 5.0 @@ -357,7 +357,7 @@ public String toString() { private static class ParameterizedTestCases { static Method getMethod(String methodName, Class... parameterTypes) { - return ReflectionUtils.findMethod(ParameterizedTestCases.class, methodName, parameterTypes).orElseThrow(); + return ReflectionSupport.findMethod(ParameterizedTestCases.class, methodName, parameterTypes).orElseThrow(); } @SuppressWarnings("unused") diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/aggregator/DefaultArgumentsAccessorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/aggregator/DefaultArgumentsAccessorTests.java index 1e9b95bb0079..421e6bb0af4d 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/aggregator/DefaultArgumentsAccessorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/aggregator/DefaultArgumentsAccessorTests.java @@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ParameterContext; import org.junit.platform.commons.PreconditionViolationException; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ReflectionSupport; /** * Unit tests for {@link DefaultArgumentsAccessor}. @@ -173,7 +173,7 @@ private static DefaultArgumentsAccessor defaultArgumentsAccessor(int invocationI } private static ParameterContext parameterContext() { - Method declaringExecutable = ReflectionUtils.findMethod(DefaultArgumentsAccessorTests.class, "foo").get(); + Method declaringExecutable = ReflectionSupport.findMethod(DefaultArgumentsAccessorTests.class, "foo").get(); ParameterContext parameterContext = mock(); when(parameterContext.getDeclaringExecutable()).thenReturn(declaringExecutable); return parameterContext; diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/DefaultArgumentConverterTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/DefaultArgumentConverterTests.java index 6e473e8d1965..1c03dc3bed90 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/DefaultArgumentConverterTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/DefaultArgumentConverterTests.java @@ -49,8 +49,8 @@ import org.junit.jupiter.api.extension.ParameterContext; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.test.TestClassLoader; -import org.junit.platform.commons.util.ReflectionUtils; /** * Unit tests for {@link DefaultArgumentConverter}. @@ -276,7 +276,7 @@ void convertsStringToClassWithCustomTypeFromDifferentClassLoader() throws Except var customType = testClassLoader.loadClass(customTypeName); assertThat(customType.getClassLoader()).isSameAs(testClassLoader); - var declaringExecutable = ReflectionUtils.findMethod(customType, "foo").get(); + var declaringExecutable = ReflectionSupport.findMethod(customType, "foo").get(); assertThat(declaringExecutable.getDeclaringClass().getClassLoader()).isSameAs(testClassLoader); var clazz = (Class) convert(customTypeName, Class.class, parameterContext(declaringExecutable)); @@ -373,7 +373,7 @@ private Object convert(Object input, Class targetClass, ParameterContext para } private static ParameterContext parameterContext() { - Method declaringExecutable = ReflectionUtils.findMethod(DefaultArgumentConverterTests.class, "foo").get(); + Method declaringExecutable = ReflectionSupport.findMethod(DefaultArgumentConverterTests.class, "foo").get(); return parameterContext(declaringExecutable); } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/TypedArgumentConverterTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/TypedArgumentConverterTests.java index 0881c45231cd..e181fa58f911 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/TypedArgumentConverterTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/TypedArgumentConverterTests.java @@ -30,7 +30,7 @@ import org.junit.jupiter.params.provider.NullSource; import org.junit.jupiter.params.provider.ValueSource; import org.junit.platform.commons.PreconditionViolationException; -import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.support.ReflectionSupport; /** * Tests for {@link TypedArgumentConverter}. @@ -98,7 +98,7 @@ private ParameterContext parameterContext(Parameter parameter) { } private Parameter findParameterOfMethod(String methodName, Class... parameterTypes) { - Method method = ReflectionUtils.findMethod(getClass(), methodName, parameterTypes).get(); + Method method = ReflectionSupport.findMethod(getClass(), methodName, parameterTypes).get(); return method.getParameters()[0]; } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/FieldArgumentsProviderTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/FieldArgumentsProviderTests.java index 3ab74b340d84..afe49a882000 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/FieldArgumentsProviderTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/FieldArgumentsProviderTests.java @@ -13,7 +13,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.engine.extension.MutableExtensionRegistry.createRegistryWithDefaultExtensions; -import static org.junit.platform.commons.util.ReflectionUtils.findMethod; +import static org.junit.platform.commons.support.ReflectionSupport.findMethod; import static org.mockito.Mockito.doCallRealMethod; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -36,8 +36,8 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.platform.commons.JUnitException; import org.junit.platform.commons.PreconditionViolationException; +import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.test.TestClassLoader; -import org.junit.platform.commons.util.ReflectionUtils; /** * Unit tests for {@link FieldArgumentsProvider}. @@ -466,7 +466,7 @@ private static Stream provideArguments(Class testClass, boolean all // Ensure we have a non-null test method, even if it's not a real test method. // If this throws an exception, make sure that the supplied test class defines a "void test()" method. - Method testMethod = ReflectionUtils.findMethod(testClass, "test").get(); + Method testMethod = ReflectionSupport.findMethod(testClass, "test").get(); return provideArguments(testClass, testMethod, allowNonStaticMethod, fieldNames); } @@ -487,7 +487,7 @@ private static Stream provideArguments(Class testClass, Method test doCallRealMethod().when(extensionContext).getRequiredTestMethod(); doCallRealMethod().when(extensionContext).getRequiredTestClass(); - var testInstance = allowNonStaticMethod ? ReflectionUtils.newInstance(testClass) : null; + var testInstance = allowNonStaticMethod ? ReflectionSupport.newInstance(testClass) : null; when(extensionContext.getTestInstance()).thenReturn(Optional.ofNullable(testInstance)); var lifeCycle = allowNonStaticMethod ? Lifecycle.PER_CLASS : Lifecycle.PER_METHOD; diff --git a/platform-tests/src/test/java/org/junit/platform/commons/support/conversion/FallbackStringToObjectConverterTests.java b/platform-tests/src/test/java/org/junit/platform/commons/support/conversion/FallbackStringToObjectConverterTests.java index 9994bba3858c..c3dcce9135e9 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/support/conversion/FallbackStringToObjectConverterTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/support/conversion/FallbackStringToObjectConverterTests.java @@ -11,7 +11,7 @@ package org.junit.platform.commons.support.conversion; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.platform.commons.util.ReflectionUtils.findMethod; +import static org.junit.platform.commons.support.ReflectionSupport.findMethod; import java.lang.reflect.Constructor; import java.lang.reflect.Method; diff --git a/platform-tests/src/test/java/org/junit/platform/console/ConsoleDetailsTests.java b/platform-tests/src/test/java/org/junit/platform/console/ConsoleDetailsTests.java index b40aa222c0ec..2a3c4571f5ee 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/ConsoleDetailsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/ConsoleDetailsTests.java @@ -17,7 +17,8 @@ import static org.junit.jupiter.api.Assumptions.assumeTrue; import static org.junit.jupiter.api.DynamicContainer.dynamicContainer; import static org.junit.jupiter.api.DynamicTest.dynamicTest; -import static org.junit.platform.commons.util.ReflectionUtils.findMethods; +import static org.junit.platform.commons.support.HierarchyTraversalMode.TOP_DOWN; +import static org.junit.platform.commons.support.ReflectionSupport.findMethods; import static org.junit.platform.commons.util.ReflectionUtils.getFullyQualifiedMethodName; import java.io.File; @@ -78,7 +79,7 @@ private List scanContainerClassAndCreateDynamicTests(Class conta // String containerName = containerClass.getSimpleName(); List nodes = new ArrayList<>(); Map> map = new EnumMap<>(Details.class); - for (var method : findMethods(containerClass, m -> m.isAnnotationPresent(Test.class))) { + for (var method : findMethods(containerClass, m -> m.isAnnotationPresent(Test.class), TOP_DOWN)) { var methodName = method.getName(); var types = method.getParameterTypes(); for (var details : Details.values()) { From 3bc81aaa25beed2ea39bce295306728a7c472ccf Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 15 Aug 2024 17:43:27 +0200 Subject: [PATCH 010/611] Use custom checkstyle-nohttp plugin --- build.gradle.kts | 10 +----- gradle/config/checkstyle/checkstyleNohttp.xml | 10 ++++++ gradle/libs.versions.toml | 2 +- .../junitbuild.checkstyle-nohttp.gradle.kts | 35 +++++++++++++++++++ 4 files changed, 47 insertions(+), 10 deletions(-) create mode 100644 gradle/config/checkstyle/checkstyleNohttp.xml create mode 100644 gradle/plugins/common/src/main/kotlin/junitbuild.checkstyle-nohttp.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts index 87509e4ad9fc..e5404fa14f6d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,8 +1,8 @@ plugins { - alias(libs.plugins.nohttp) alias(libs.plugins.nexusPublish) id("junitbuild.base-conventions") id("junitbuild.build-metadata") + id("junitbuild.checkstyle-nohttp") id("junitbuild.dependency-update-check") id("junitbuild.jacoco-aggregation-conventions") id("junitbuild.temp-maven-repo") @@ -62,11 +62,3 @@ nexusPublishing { sonatype() } } - -nohttp { - source.exclude("**/.gradle/**", "gradle/plugins/**/build/**") -} - -tasks.checkstyleNohttp { - notCompatibleWithConfigurationCache("https://github.com/spring-io/nohttp/issues/61") -} diff --git a/gradle/config/checkstyle/checkstyleNohttp.xml b/gradle/config/checkstyle/checkstyleNohttp.xml new file mode 100644 index 000000000000..d1723372016d --- /dev/null +++ b/gradle/config/checkstyle/checkstyleNohttp.xml @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a54336afebdc..6ec9b4616f49 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -51,6 +51,7 @@ maven = { module = "org.apache.maven:apache-maven", version = "3.9.8" } mavenSurefirePlugin = { module = "org.apache.maven.plugins:maven-surefire-plugin", version.ref = "surefire" } memoryfilesystem = { module = "com.github.marschall:memoryfilesystem", version = "2.8.0" } mockito = { module = "org.mockito:mockito-junit-jupiter", version = "5.12.0" } +nohttp-checkstyle = { module = "io.spring.nohttp:nohttp-checkstyle", version = "0.0.11" } opentest4j = { module = "org.opentest4j:opentest4j", version.ref = "opentest4j" } openTestReporting-events = { module = "org.opentest4j.reporting:open-test-reporting-events", version.ref = "openTestReporting" } openTestReporting-tooling = { module = "org.opentest4j.reporting:open-test-reporting-tooling", version.ref = "openTestReporting" } @@ -86,7 +87,6 @@ foojayResolver = { id = "org.gradle.toolchains.foojay-resolver", version = "0.8. gitPublish = { id = "org.ajoberstar.git-publish", version = "4.2.2" } jmh = { id = "me.champeau.jmh", version = "0.7.2" } nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" } -nohttp = { id = "io.spring.nohttp", version = "0.0.11" } plantuml = { id = "io.freefair.plantuml", version = "8.6" } shadow = { id = "com.gradleup.shadow", version = "8.3.0" } spotless = { id = "com.diffplug.spotless", version = "7.0.0.BETA1" } diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.checkstyle-nohttp.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.checkstyle-nohttp.gradle.kts new file mode 100644 index 000000000000..32b088a30104 --- /dev/null +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.checkstyle-nohttp.gradle.kts @@ -0,0 +1,35 @@ +plugins { + base + checkstyle +} + +checkstyle { + toolVersion = requiredVersionFromLibs("checkstyle") + configDirectory = rootProject.layout.projectDirectory.dir("gradle/config/checkstyle") +} + +dependencies { + checkstyle(dependencyFromLibs("nohttp-checkstyle")) +} + +tasks { + val checkstyleNohttp by registering(Checkstyle::class) { + group = "verification" + description = "Checks for illegal uses of http://" + classpath = files(configurations.checkstyle) + config = resources.text.fromFile(checkstyle.configDirectory.file("checkstyleNohttp.xml")) + source = fileTree(layout.projectDirectory) { + exclude(".git/**", "**/.gradle/**") + exclude(".idea/**", ".eclipse/**") + exclude("**/*.class") + exclude("**/*.hprof") + exclude("**/*.jar") + exclude("**/*.jpg", "**/*.png") + exclude("**/*.jks") + exclude("**/build/**") + } + } + check { + dependsOn(checkstyleNohttp) + } +} From 726121eb71fb7e838dae9c4b87fdb46a4ab2e19a Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 15 Aug 2024 17:52:08 +0200 Subject: [PATCH 011/611] Remove duplication by introducing checkstyle-conventions plugin --- ...nitbuild.checkstyle-conventions.gradle.kts | 13 ++++++ .../junitbuild.checkstyle-nohttp.gradle.kts | 41 +++++++------------ ...tbuild.java-library-conventions.gradle.kts | 2 +- 3 files changed, 29 insertions(+), 27 deletions(-) create mode 100644 gradle/plugins/common/src/main/kotlin/junitbuild.checkstyle-conventions.gradle.kts diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.checkstyle-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.checkstyle-conventions.gradle.kts new file mode 100644 index 000000000000..ae6f47ef34d7 --- /dev/null +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.checkstyle-conventions.gradle.kts @@ -0,0 +1,13 @@ +plugins { + base + checkstyle +} + +checkstyle { + toolVersion = requiredVersionFromLibs("checkstyle") + configDirectory = rootProject.layout.projectDirectory.dir("gradle/config/checkstyle") +} + +tasks.check { + dependsOn(tasks.withType()) +} diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.checkstyle-nohttp.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.checkstyle-nohttp.gradle.kts index 32b088a30104..daf45cbfea84 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.checkstyle-nohttp.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.checkstyle-nohttp.gradle.kts @@ -1,35 +1,24 @@ plugins { - base - checkstyle -} - -checkstyle { - toolVersion = requiredVersionFromLibs("checkstyle") - configDirectory = rootProject.layout.projectDirectory.dir("gradle/config/checkstyle") + id("junitbuild.checkstyle-conventions") } dependencies { checkstyle(dependencyFromLibs("nohttp-checkstyle")) } -tasks { - val checkstyleNohttp by registering(Checkstyle::class) { - group = "verification" - description = "Checks for illegal uses of http://" - classpath = files(configurations.checkstyle) - config = resources.text.fromFile(checkstyle.configDirectory.file("checkstyleNohttp.xml")) - source = fileTree(layout.projectDirectory) { - exclude(".git/**", "**/.gradle/**") - exclude(".idea/**", ".eclipse/**") - exclude("**/*.class") - exclude("**/*.hprof") - exclude("**/*.jar") - exclude("**/*.jpg", "**/*.png") - exclude("**/*.jks") - exclude("**/build/**") - } - } - check { - dependsOn(checkstyleNohttp) +tasks.register("checkstyleNohttp") { + group = "verification" + description = "Checks for illegal uses of http://" + classpath = files(configurations.checkstyle) + config = resources.text.fromFile(checkstyle.configDirectory.file("checkstyleNohttp.xml")) + source = fileTree(layout.projectDirectory) { + exclude(".git/**", "**/.gradle/**") + exclude(".idea/**", ".eclipse/**") + exclude("**/*.class") + exclude("**/*.hprof") + exclude("**/*.jar") + exclude("**/*.jpg", "**/*.png") + exclude("**/*.jks") + exclude("**/build/**") } } diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts index 08e435be8996..4f34af3676d6 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts @@ -10,9 +10,9 @@ plugins { `java-library` eclipse idea - checkstyle id("junitbuild.base-conventions") id("junitbuild.build-parameters") + id("junitbuild.checkstyle-conventions") id("junitbuild.jacoco-java-conventions") } From d85dd9bf58157aab339248d391a5d4142b0764e1 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 15 Aug 2024 17:56:06 +0200 Subject: [PATCH 012/611] Remove duplication --- .../kotlin/junitbuild.java-library-conventions.gradle.kts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts index 4f34af3676d6..d3c195c735c1 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts @@ -308,11 +308,6 @@ afterEvaluate { } } -checkstyle { - toolVersion = requiredVersionFromLibs("checkstyle") - configDirectory = rootProject.layout.projectDirectory.dir("gradle/config/checkstyle") -} - tasks { checkstyleMain { config = resources.text.fromFile(checkstyle.configDirectory.file("checkstyleMain.xml")) From 04782baa6ef6e63831b1ebcb79fbf8d0342036cb Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sun, 1 Sep 2024 12:35:44 +0200 Subject: [PATCH 013/611] Add GH Actions workflow to post-process and validate closed issues --- ...sue-labels.yml => label-opened-issues.yml} | 2 +- .github/workflows/unlabel-closed-issues.yml | 39 +++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) rename .github/workflows/{issue-labels.yml => label-opened-issues.yml} (92%) create mode 100644 .github/workflows/unlabel-closed-issues.yml diff --git a/.github/workflows/issue-labels.yml b/.github/workflows/label-opened-issues.yml similarity index 92% rename from .github/workflows/issue-labels.yml rename to .github/workflows/label-opened-issues.yml index b91cf84c462b..066596b43c85 100644 --- a/.github/workflows/issue-labels.yml +++ b/.github/workflows/label-opened-issues.yml @@ -1,4 +1,4 @@ -name: Label new issues +name: Add label to opened issues on: issues: types: diff --git a/.github/workflows/unlabel-closed-issues.yml b/.github/workflows/unlabel-closed-issues.yml new file mode 100644 index 000000000000..ff96f0a70468 --- /dev/null +++ b/.github/workflows/unlabel-closed-issues.yml @@ -0,0 +1,39 @@ +name: Remove label from closed issues +on: + issues: + types: + - closed +jobs: + label_issues: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - uses: actions/github-script@v7 + with: + script: | + const originalLabels = context.issue.labels.map(l => l.name); + const newLabels = originalLabels.filter(l => l !== "status: in progress" && l !== "status: new"); + if (newLabels.length !== originalLabels.length) { + github.rest.issues.update({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: newLabels, + }); + } + const statusLabels = newLabels.filter(l => l.startsWith("status: ")); + if (context.issue.state_reason === "not planned" && statusLabels.length === 0) { + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: "Please assign a status label to this issue.", + }); + github.rest.issues.update({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + state: "open", + }); + } From a885b34a4d75da5dac59fdd6be2abc82a3caf0a5 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sun, 1 Sep 2024 12:40:48 +0200 Subject: [PATCH 014/611] Add debug output --- .github/workflows/unlabel-closed-issues.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/unlabel-closed-issues.yml b/.github/workflows/unlabel-closed-issues.yml index ff96f0a70468..a2f8b0d0a036 100644 --- a/.github/workflows/unlabel-closed-issues.yml +++ b/.github/workflows/unlabel-closed-issues.yml @@ -12,8 +12,11 @@ jobs: - uses: actions/github-script@v7 with: script: | + console.log(context.issue); const originalLabels = context.issue.labels.map(l => l.name); + console.log(originalLabels); const newLabels = originalLabels.filter(l => l !== "status: in progress" && l !== "status: new"); + console.log(newLabels); if (newLabels.length !== originalLabels.length) { github.rest.issues.update({ issue_number: context.issue.number, @@ -23,6 +26,7 @@ jobs: }); } const statusLabels = newLabels.filter(l => l.startsWith("status: ")); + console.log(statusLabels); if (context.issue.state_reason === "not planned" && statusLabels.length === 0) { github.rest.issues.createComment({ issue_number: context.issue.number, From 09a86a077f7162c3103476f11adbe175291cdca1 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sun, 1 Sep 2024 12:44:26 +0200 Subject: [PATCH 015/611] Load issue via API --- .github/workflows/unlabel-closed-issues.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/unlabel-closed-issues.yml b/.github/workflows/unlabel-closed-issues.yml index a2f8b0d0a036..68484849289c 100644 --- a/.github/workflows/unlabel-closed-issues.yml +++ b/.github/workflows/unlabel-closed-issues.yml @@ -12,14 +12,19 @@ jobs: - uses: actions/github-script@v7 with: script: | - console.log(context.issue); - const originalLabels = context.issue.labels.map(l => l.name); + const issue = github.rest.issues.get({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + }); + console.log(issue); + const originalLabels = issue.labels.map(l => l.name); console.log(originalLabels); const newLabels = originalLabels.filter(l => l !== "status: in progress" && l !== "status: new"); console.log(newLabels); if (newLabels.length !== originalLabels.length) { github.rest.issues.update({ - issue_number: context.issue.number, + issue_number: issue.number, owner: context.repo.owner, repo: context.repo.repo, labels: newLabels, @@ -27,15 +32,15 @@ jobs: } const statusLabels = newLabels.filter(l => l.startsWith("status: ")); console.log(statusLabels); - if (context.issue.state_reason === "not planned" && statusLabels.length === 0) { + if (issue.state_reason === "not planned" && statusLabels.length === 0) { github.rest.issues.createComment({ - issue_number: context.issue.number, + issue_number: issue.number, owner: context.repo.owner, repo: context.repo.repo, body: "Please assign a status label to this issue.", }); github.rest.issues.update({ - issue_number: context.issue.number, + issue_number: issue.number, owner: context.repo.owner, repo: context.repo.repo, state: "open", From 4130b4cb5ca4a788702da51d1b5bd1892bdab3c0 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sun, 1 Sep 2024 12:45:51 +0200 Subject: [PATCH 016/611] Await Promise --- .github/workflows/unlabel-closed-issues.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unlabel-closed-issues.yml b/.github/workflows/unlabel-closed-issues.yml index 68484849289c..7514e08332ff 100644 --- a/.github/workflows/unlabel-closed-issues.yml +++ b/.github/workflows/unlabel-closed-issues.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/github-script@v7 with: script: | - const issue = github.rest.issues.get({ + const issue = await github.rest.issues.get({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, From 5f050fe09af001cd81638d369cb5c210695419c6 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sun, 1 Sep 2024 12:50:30 +0200 Subject: [PATCH 017/611] Access nested data --- .github/workflows/unlabel-closed-issues.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/unlabel-closed-issues.yml b/.github/workflows/unlabel-closed-issues.yml index 7514e08332ff..3deb1d950331 100644 --- a/.github/workflows/unlabel-closed-issues.yml +++ b/.github/workflows/unlabel-closed-issues.yml @@ -17,14 +17,14 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, }); - console.log(issue); - const originalLabels = issue.labels.map(l => l.name); + console.log(issue.data); + const originalLabels = issue.data.labels.map(l => l.name); console.log(originalLabels); const newLabels = originalLabels.filter(l => l !== "status: in progress" && l !== "status: new"); console.log(newLabels); if (newLabels.length !== originalLabels.length) { github.rest.issues.update({ - issue_number: issue.number, + issue_number: issue.data.number, owner: context.repo.owner, repo: context.repo.repo, labels: newLabels, @@ -32,15 +32,15 @@ jobs: } const statusLabels = newLabels.filter(l => l.startsWith("status: ")); console.log(statusLabels); - if (issue.state_reason === "not planned" && statusLabels.length === 0) { + if (issue.data.state_reason === "not_planned" && statusLabels.length === 0) { github.rest.issues.createComment({ - issue_number: issue.number, + issue_number: issue.data.number, owner: context.repo.owner, repo: context.repo.repo, - body: "Please assign a status label to this issue.", + body: "Please assign a status label to this issue.data.", }); github.rest.issues.update({ - issue_number: issue.number, + issue_number: issue.data.number, owner: context.repo.owner, repo: context.repo.repo, state: "open", From 94b4b8642d3d3e4897b27bd1af637c17ea4d047f Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sun, 1 Sep 2024 12:52:47 +0200 Subject: [PATCH 018/611] Remove debug output --- .github/workflows/unlabel-closed-issues.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/unlabel-closed-issues.yml b/.github/workflows/unlabel-closed-issues.yml index 3deb1d950331..2bc4278b921a 100644 --- a/.github/workflows/unlabel-closed-issues.yml +++ b/.github/workflows/unlabel-closed-issues.yml @@ -17,11 +17,8 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, }); - console.log(issue.data); const originalLabels = issue.data.labels.map(l => l.name); - console.log(originalLabels); const newLabels = originalLabels.filter(l => l !== "status: in progress" && l !== "status: new"); - console.log(newLabels); if (newLabels.length !== originalLabels.length) { github.rest.issues.update({ issue_number: issue.data.number, @@ -31,13 +28,12 @@ jobs: }); } const statusLabels = newLabels.filter(l => l.startsWith("status: ")); - console.log(statusLabels); if (issue.data.state_reason === "not_planned" && statusLabels.length === 0) { github.rest.issues.createComment({ issue_number: issue.data.number, owner: context.repo.owner, repo: context.repo.repo, - body: "Please assign a status label to this issue.data.", + body: "Please assign a status label to this issue.", }); github.rest.issues.update({ issue_number: issue.data.number, From 0a68fc41b6ad0bf92d20035b2d7cbf2cca017a84 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sun, 1 Sep 2024 12:55:06 +0200 Subject: [PATCH 019/611] Await all requests --- .github/workflows/unlabel-closed-issues.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unlabel-closed-issues.yml b/.github/workflows/unlabel-closed-issues.yml index 2bc4278b921a..2554569d6679 100644 --- a/.github/workflows/unlabel-closed-issues.yml +++ b/.github/workflows/unlabel-closed-issues.yml @@ -20,7 +20,7 @@ jobs: const originalLabels = issue.data.labels.map(l => l.name); const newLabels = originalLabels.filter(l => l !== "status: in progress" && l !== "status: new"); if (newLabels.length !== originalLabels.length) { - github.rest.issues.update({ + await github.rest.issues.update({ issue_number: issue.data.number, owner: context.repo.owner, repo: context.repo.repo, @@ -29,13 +29,13 @@ jobs: } const statusLabels = newLabels.filter(l => l.startsWith("status: ")); if (issue.data.state_reason === "not_planned" && statusLabels.length === 0) { - github.rest.issues.createComment({ + await github.rest.issues.createComment({ issue_number: issue.data.number, owner: context.repo.owner, repo: context.repo.repo, body: "Please assign a status label to this issue.", }); - github.rest.issues.update({ + await github.rest.issues.update({ issue_number: issue.data.number, owner: context.repo.owner, repo: context.repo.repo, From 5f9eeb714637ab641a13ff92fb840c6479b39690 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sun, 1 Sep 2024 12:58:10 +0200 Subject: [PATCH 020/611] Make workflow name clearer --- .github/workflows/unlabel-closed-issues.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unlabel-closed-issues.yml b/.github/workflows/unlabel-closed-issues.yml index 2554569d6679..cc476e4fccba 100644 --- a/.github/workflows/unlabel-closed-issues.yml +++ b/.github/workflows/unlabel-closed-issues.yml @@ -1,4 +1,4 @@ -name: Remove label from closed issues +name: Check/remove status labels from closed issues on: issues: types: From 751467c6612fedab86433b9225d69140b1057a55 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Wed, 4 Sep 2024 13:08:24 +0200 Subject: [PATCH 021/611] Polish Javadoc and formatting --- .../commons/util/ReflectionUtils.java | 9 +++--- .../platform/commons/util/StringUtils.java | 11 +++---- .../console/options/SelectorConverter.java | 3 -- .../platform/engine/DiscoverySelector.java | 12 +++++--- .../engine/DiscoverySelectorIdentifier.java | 24 +++++++-------- .../engine/discovery/ClassSelector.java | 2 ++ .../discovery/ClasspathResourceSelector.java | 2 ++ .../discovery/ClasspathRootSelector.java | 2 ++ .../engine/discovery/DirectorySelector.java | 2 ++ .../DiscoverySelectorIdentifierParser.java | 22 +++++++------- .../DiscoverySelectorIdentifierParsers.java | 4 ++- .../engine/discovery/DiscoverySelectors.java | 16 +++++++--- .../engine/discovery/FileSelector.java | 4 ++- .../engine/discovery/IterationSelector.java | 30 +++++++++++-------- .../engine/discovery/MethodSelector.java | 1 + .../engine/discovery/ModuleSelector.java | 2 ++ .../engine/discovery/NestedClassSelector.java | 2 ++ .../discovery/NestedMethodSelector.java | 2 ++ .../engine/discovery/PackageSelector.java | 2 ++ .../engine/discovery/UniqueIdSelector.java | 2 ++ .../engine/discovery/UriSelector.java | 2 ++ 21 files changed, 98 insertions(+), 58 deletions(-) diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java index 517ee073f273..dd18b8d13cd6 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java @@ -933,21 +933,22 @@ public static String getFullyQualifiedMethodName(Class clazz, Method method) */ public static String getFullyQualifiedMethodName(Class clazz, String methodName, Class... parameterTypes) { Preconditions.notNull(clazz, "Class must not be null"); - Preconditions.notBlank(methodName, "Method name must not be null or blank"); return getFullyQualifiedMethodName(clazz.getName(), methodName, ClassUtils.nullSafeToString(parameterTypes)); } /** * Build the fully qualified method name for the method described by the - * supplied class, method name, and parameter types. + * supplied class name, method name, and parameter types. * *

Note that the class is not necessarily the class in which the method is * declared. * - * @param className the name of the class from which the method should be referenced; never {@code null} + * @param className the name of the class from which the method should be referenced; + * never {@code null} * @param methodName the name of the method; never {@code null} or blank - * @param parameterTypeNames the parameter type names of the method; may be empty but not {@code null} + * @param parameterTypeNames the parameter type names of the method; may be + * empty but not {@code null} * @return fully qualified method name; never {@code null} * @since 1.11 */ diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/StringUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/StringUtils.java index 42dcdeef863b..0b45e4ed637a 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/StringUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/StringUtils.java @@ -306,9 +306,10 @@ private static TwoPartSplitResult splitIntoTwo(String value, int index, int leng public interface TwoPartSplitResult { /** - * Maps the result of splitting a string into two parts or throw an exception. + * Map the result of splitting a string into two parts or throw an exception. * - * @param onePartExceptionCreator the exception creator to use if the string was split into a single part + * @param onePartExceptionCreator the exception creator to use if the string + * was split into a single part * @param twoPartsMapper the mapper to use if the string was split into two parts */ default T mapTwo(Supplier onePartExceptionCreator, @@ -320,7 +321,7 @@ default T mapTwo(Supplier onePartExceptionCreato } /** - * Maps the result of splitting a string into up to two parts. + * Map the result of splitting a string into up to two parts. * * @param onePartMapper the mapper to use if the string was split into a single part * @param twoPartsMapper the mapper to use if the string was split into two parts @@ -340,7 +341,7 @@ private static final class OnePart implements TwoPartSplitResult { @Override public T map(Function onePartMapper, BiFunction twoPartsMapper) { - return onePartMapper.apply(value); + return onePartMapper.apply(this.value); } } @@ -357,7 +358,7 @@ private static final class TwoParts implements TwoPartSplitResult { @Override public T map(Function onePartMapper, BiFunction twoPartsMapper) { - return twoPartsMapper.apply(first, second); + return twoPartsMapper.apply(this.first, this.second); } } diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/SelectorConverter.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/SelectorConverter.java index 3bb444602cb8..7c18320eba67 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/SelectorConverter.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/SelectorConverter.java @@ -93,7 +93,6 @@ public ClasspathResourceSelector convert(String value) { } static class Iteration implements ITypeConverter { - @Override public IterationSelector convert(String value) { DiscoverySelectorIdentifier identifier = DiscoverySelectorIdentifier.create( @@ -101,11 +100,9 @@ public IterationSelector convert(String value) { return (IterationSelector) DiscoverySelectors.parse(identifier) // .orElseThrow(() -> new PreconditionViolationException("Invalid format: Failed to parse selector")); } - } static class Identifier implements ITypeConverter { - @Override public DiscoverySelectorIdentifier convert(String value) { return DiscoverySelectorIdentifier.parse(value); diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/DiscoverySelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/DiscoverySelector.java index 342f536ca2ce..d3faa984fd5f 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/DiscoverySelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/DiscoverySelector.java @@ -33,12 +33,16 @@ public interface DiscoverySelector { /** * Return the {@linkplain DiscoverySelectorIdentifier identifier} of this * selector. - *

- * The returned identifier has to be parsable by a corresponding + * + *

The returned identifier must be parsable by a corresponding * {@link DiscoverySelectorIdentifierParser}. * - * @return the identifier of this selector or empty if it is not supported; - * never {@code null} + *

The default implementation returns {@link Optional#empty()}. Can be + * overridden by concrete implementations. + * + * @return an {@link Optional} containing the identifier of this selector; + * never {@code null} but potentially empty if the selector does not support + * identifiers * @since 1.11 */ @API(status = EXPERIMENTAL, since = "1.11") diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/DiscoverySelectorIdentifier.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/DiscoverySelectorIdentifier.java index 4fd926e9b27b..7f4f8e21138f 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/DiscoverySelectorIdentifier.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/DiscoverySelectorIdentifier.java @@ -20,10 +20,9 @@ import org.junit.platform.commons.util.StringUtils; /** - * Identifier for {@link DiscoverySelector DiscoverySelectors} with a specific - * prefix. - *

- * The {@linkplain #toString() string representation} of an identifier is + * Identifier for a {@link DiscoverySelector} with a specific prefix. + * + *

The {@linkplain #toString() string representation} of an identifier is * intended to be human-readable and is formatted as {@code prefix:value}. * * @since 1.11 @@ -37,7 +36,7 @@ public final class DiscoverySelectorIdentifier { private final String value; /** - * Create a new {@link DiscoverySelectorIdentifier} with the supplied prefix and + * Create a new {@code DiscoverySelectorIdentifier} with the supplied prefix and * value. * * @param prefix the prefix; never {@code null} or blank @@ -51,8 +50,8 @@ public static DiscoverySelectorIdentifier create(String prefix, String value) { * Parse the supplied string representation of a * {@link DiscoverySelectorIdentifier} in the format {@code prefix:value}. * - * @param string the string representation of a {@link DiscoverySelectorIdentifier} - * @return the parsed {@link DiscoverySelectorIdentifier} + * @param string the string representation of a {@code DiscoverySelectorIdentifier} + * @return the parsed {@code DiscoverySelectorIdentifier} * @throws PreconditionViolationException if the supplied string does not * conform to the expected format */ @@ -74,7 +73,7 @@ private DiscoverySelectorIdentifier(String prefix, String value) { * @return the prefix; never {@code null} or blank */ public String getPrefix() { - return prefix; + return this.prefix; } /** @@ -83,7 +82,7 @@ public String getPrefix() { * @return the value; never {@code null} or blank */ public String getValue() { - return value; + return this.value; } @Override @@ -95,12 +94,12 @@ public boolean equals(Object o) { return false; } DiscoverySelectorIdentifier that = (DiscoverySelectorIdentifier) o; - return Objects.equals(prefix, that.prefix) && Objects.equals(value, that.value); + return Objects.equals(this.prefix, that.prefix) && Objects.equals(this.value, that.value); } @Override public int hashCode() { - return Objects.hash(prefix, value); + return Objects.hash(this.prefix, this.value); } /** @@ -109,6 +108,7 @@ public int hashCode() { */ @Override public String toString() { - return String.format("%s:%s", prefix, value); + return String.format("%s:%s", this.prefix, this.value); } + } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClassSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClassSelector.java index a244c23486db..f1dda935b88d 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClassSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClassSelector.java @@ -162,5 +162,7 @@ public String getPrefix() { public Optional parse(DiscoverySelectorIdentifier identifier, Context context) { return Optional.of(DiscoverySelectors.selectClass(identifier.getValue())); } + } + } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClasspathResourceSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClasspathResourceSelector.java index 1a17cda9119b..eb0aff3fda14 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClasspathResourceSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClasspathResourceSelector.java @@ -142,5 +142,7 @@ public Optional parse(DiscoverySelectorIdentifier ide } // )); } + } + } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClasspathRootSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClasspathRootSelector.java index 815edd8373ae..7e41b9ba4310 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClasspathRootSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClasspathRootSelector.java @@ -117,5 +117,7 @@ public Optional parse(DiscoverySelectorIdentifier identif Path path = Paths.get(URI.create(identifier.getValue())); return getFirstElement(DiscoverySelectors.selectClasspathRoots(singleton(path))); } + } + } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DirectorySelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DirectorySelector.java index 976c20ddb695..77a18048dfde 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DirectorySelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DirectorySelector.java @@ -136,5 +136,7 @@ public String getPrefix() { public Optional parse(DiscoverySelectorIdentifier identifier, Context context) { return Optional.of(DiscoverySelectors.selectDirectory(identifier.getValue())); } + } + } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectorIdentifierParser.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectorIdentifierParser.java index 8570c6d5c3cc..071e6b09263d 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectorIdentifierParser.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectorIdentifierParser.java @@ -19,10 +19,9 @@ import org.junit.platform.engine.DiscoverySelectorIdentifier; /** - * Parser for {@link DiscoverySelectorIdentifier DiscoverySelectorIdentifiers} - * with a specific prefix. - *

- * Implementations of this interface can be registered using the Java service + * Parser for a {@link DiscoverySelectorIdentifier} with a specific prefix. + * + *

Implementations of this interface can be registered using the Java service * loader mechanism to extend the set of supported prefixes for * {@link DiscoverySelectorIdentifier DiscoverySelectorIdentifiers}. * @@ -33,22 +32,23 @@ public interface DiscoverySelectorIdentifierParser { /** - * Get the prefix that this parser can handle. + * Get the prefix that this parser supports. * - * @return the prefix that this parser can handle; never {@code null} + * @return the prefix that this parser supports; never {@code null} or blank */ String getPrefix(); /** * Parse the supplied {@link DiscoverySelectorIdentifier}. - *

- * The JUnit Platform will only invoke this method if the supplied + * + *

The JUnit Platform will only invoke this method if the supplied * {@link DiscoverySelectorIdentifier} has a prefix that matches the value * returned by {@link #getPrefix()}. * * @param identifier the {@link DiscoverySelectorIdentifier} to parse * @param context the {@link Context} to use for parsing - * @return an {@link Optional} containing the parsed {@link DiscoverySelector}; never {@code null} + * @return an {@link Optional} containing the parsed {@link DiscoverySelector}; + * never {@code null} but potentially empty */ Optional parse(DiscoverySelectorIdentifier identifier, Context context); @@ -59,8 +59,8 @@ interface Context { /** * Parse the supplied selector. - *

- * This method is intended to be used by implementations of + * + *

This method is intended to be used by implementations of * {@link DiscoverySelectorIdentifierParser#parse} for selectors that * contain other selectors. */ diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectorIdentifierParsers.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectorIdentifierParsers.java index 2f0d79b46735..7d379a4fce52 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectorIdentifierParsers.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectorIdentifierParsers.java @@ -75,11 +75,13 @@ private enum Singleton { for (DiscoverySelectorIdentifierParser parser : loadedParsers) { DiscoverySelectorIdentifierParser previous = parsersByPrefix.put(parser.getPrefix(), parser); Preconditions.condition(previous == null, - () -> String.format("Duplicate parser for prefix: [%s] candidate a: [%s] candidate b: [%s] ", + () -> String.format("Duplicate parser for prefix: [%s]; candidate a: [%s]; candidate b: [%s]", parser.getPrefix(), requireNonNull(previous).getClass().getName(), parser.getClass().getName())); } this.parsersByPrefix = unmodifiableMap(parsersByPrefix); } + } + } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectors.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectors.java index 5bdbb25fd8d5..1c6964579e13 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectors.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectors.java @@ -930,8 +930,8 @@ public static UniqueIdSelector selectUniqueId(String uniqueId) { * * @param parentSelector the parent selector to select iterations for; never * {@code null} - * @param iterationIndices the iteration indices to select; never - * {@code null} or empty + * @param iterationIndices the iteration indices to select; never {@code null} + * or empty * @since 1.9 * @see IterationSelector */ @@ -943,11 +943,12 @@ public static IterationSelector selectIteration(DiscoverySelector parentSelector } /** - * Parse the supplied string representation of a - * {@link DiscoverySelectorIdentifier}. + * Parse the supplied string representation of a {@link DiscoverySelectorIdentifier}. * * @param identifier the string representation of a {@code DiscoverySelectorIdentifier}; * never {@code null} or blank + * @return an {@link Optional} containing the corresponding {@link DiscoverySelector}; + * never {@code null} but potentially empty * @since 1.11 * @see DiscoverySelectorIdentifierParser */ @@ -961,6 +962,8 @@ public static Optional parse(String identifier) { * * @param identifier the {@code DiscoverySelectorIdentifier} to parse; * never {@code null} + * @return an {@link Optional} containing the corresponding {@link DiscoverySelector}; + * never {@code null} but potentially empty * @since 1.11 * @see DiscoverySelectorIdentifierParser */ @@ -975,6 +978,8 @@ public static Optional parse(DiscoverySelectorIdent * * @param identifiers the string representations of * {@code DiscoverySelectorIdentifiers} to parse; never {@code null} + * @return a stream of the corresponding {@link DiscoverySelector DiscoverySelectors}; + * never {@code null} but potentially empty * @since 1.11 * @see DiscoverySelectorIdentifierParser */ @@ -989,6 +994,8 @@ public static Stream parseAll(String... identifiers * * @param identifiers the {@code DiscoverySelectorIdentifiers} to parse; * never {@code null} + * @return a stream of the corresponding {@link DiscoverySelector DiscoverySelectors}; + * never {@code null} but potentially empty * @since 1.11 * @see DiscoverySelectorIdentifierParser */ @@ -996,4 +1003,5 @@ public static Stream parseAll(String... identifiers public static Stream parseAll(Collection identifiers) { return DiscoverySelectorIdentifierParsers.parseAll(identifiers); } + } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/FileSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/FileSelector.java index 6246fa58e4c3..7cb12802f1d6 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/FileSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/FileSelector.java @@ -112,7 +112,7 @@ public boolean equals(Object o) { @API(status = STABLE, since = "1.3") @Override public int hashCode() { - return Objects.hash(path, position); + return Objects.hash(this.path, this.position); } @Override @@ -158,5 +158,7 @@ public Optional parse(DiscoverySelectorIdentifier identifier, Cont } // )); } + } + } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/IterationSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/IterationSelector.java index 965a86cdb379..c5060aed467a 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/IterationSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/IterationSelector.java @@ -65,14 +65,14 @@ private SortedSet toSortedSet(int[] iterationIndices) { * Get the selected parent {@link DiscoverySelector}. */ public DiscoverySelector getParentSelector() { - return parentSelector; + return this.parentSelector; } /** * Get the selected iteration indices. */ public SortedSet getIterationIndices() { - return iterationIndices; + return this.iterationIndices; } @Override @@ -84,12 +84,12 @@ public boolean equals(Object o) { return false; } IterationSelector that = (IterationSelector) o; - return parentSelector.equals(that.parentSelector) && iterationIndices.equals(that.iterationIndices); + return this.parentSelector.equals(that.parentSelector) && this.iterationIndices.equals(that.iterationIndices); } @Override public int hashCode() { - return Objects.hash(parentSelector, iterationIndices); + return Objects.hash(this.parentSelector, this.iterationIndices); } @Override @@ -104,13 +104,14 @@ public String toString() { @Override public Optional toIdentifier() { - return parentSelector.toIdentifier().map(parentSelectorString -> DiscoverySelectorIdentifier.create( // + return this.parentSelector.toIdentifier().map(parentSelectorString -> DiscoverySelectorIdentifier.create( // IdentifierParser.PREFIX, // String.format("%s[%s]", parentSelectorString, formatIterationIndicesAsRanges())) // ); } private String formatIterationIndicesAsRanges() { + class Range { final int start; int end; @@ -120,10 +121,11 @@ class Range { this.end = start; } } + List ranges = new ArrayList<>(); - Range current = new Range(iterationIndices.first()); + Range current = new Range(this.iterationIndices.first()); ranges.add(current); - for (int n : iterationIndices.tailSet(current.start + 1)) { + for (int n : this.iterationIndices.tailSet(current.start + 1)) { if (n == current.end + 1) { current.end = n; } @@ -133,14 +135,14 @@ class Range { } } return ranges.stream() // - .map(r -> { - if (r.start == r.end) { - return String.valueOf(r.start); + .map(range -> { + if (range.start == range.end) { + return String.valueOf(range.start); } - if (r.start == r.end - 1) { - return r.start + "," + r.end; + if (range.start == range.end - 1) { + return range.start + "," + range.end; } - return r.start + ".." + r.end; + return range.start + ".." + range.end; }) // .collect(joining(",")); } @@ -185,5 +187,7 @@ private IntStream parseIndexDefinition(String value) { Integer.parseInt(lastIndex))// ); } + } + } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/MethodSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/MethodSelector.java index 7f6659482311..c2df7e1af657 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/MethodSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/MethodSelector.java @@ -342,4 +342,5 @@ public Optional parse(DiscoverySelectorIdentifier identifier, Co } } + } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ModuleSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ModuleSelector.java index 293654370f8e..140610901155 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ModuleSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ModuleSelector.java @@ -102,5 +102,7 @@ public String getPrefix() { public Optional parse(DiscoverySelectorIdentifier identifier, Context context) { return Optional.of(DiscoverySelectors.selectModule(identifier.getValue())); } + } + } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/NestedClassSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/NestedClassSelector.java index cfa1dd6e2500..5c0ae7a542cb 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/NestedClassSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/NestedClassSelector.java @@ -180,5 +180,7 @@ public Optional parse(DiscoverySelectorIdentifier identifie return Optional.of( DiscoverySelectors.selectNestedClass(parts.subList(0, parts.size() - 1), parts.get(parts.size() - 1))); } + } + } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/NestedMethodSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/NestedMethodSelector.java index ae5d4a69fdc0..ff117ca99be7 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/NestedMethodSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/NestedMethodSelector.java @@ -284,5 +284,7 @@ public Optional parse(DiscoverySelectorIdentifier identifi return Optional.of(DiscoverySelectors.selectNestedMethod(enclosingClassNames, nestedClassName, methodName, parameterTypeNames)); } + } + } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/PackageSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/PackageSelector.java index fc7da6fb5c6f..21801c7c21ad 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/PackageSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/PackageSelector.java @@ -102,5 +102,7 @@ public String getPrefix() { public Optional parse(DiscoverySelectorIdentifier identifier, Context context) { return Optional.of(DiscoverySelectors.selectPackage(identifier.getValue())); } + } + } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/UniqueIdSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/UniqueIdSelector.java index 08068b1d9ca6..4c0a00ade87c 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/UniqueIdSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/UniqueIdSelector.java @@ -103,5 +103,7 @@ public String getPrefix() { public Optional parse(DiscoverySelectorIdentifier identifier, Context context) { return Optional.of(DiscoverySelectors.selectUniqueId(identifier.getValue())); } + } + } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/UriSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/UriSelector.java index 9e6ed0c45c8a..eb18583a93da 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/UriSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/UriSelector.java @@ -106,5 +106,7 @@ public String getPrefix() { public Optional parse(DiscoverySelectorIdentifier identifier, Context context) { return Optional.of(DiscoverySelectors.selectUri(identifier.getValue())); } + } + } From cfc9e65a1b16aa639db3dc1c506b27f70ad83026 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Thu, 5 Sep 2024 13:20:14 +0200 Subject: [PATCH 022/611] Indent with tabs --- .../projects/graalvm-starter/settings.gradle.kts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts b/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts index 1399f18e3201..39f3134b19c6 100644 --- a/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts +++ b/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts @@ -1,11 +1,11 @@ pluginManagement { - plugins { - id("org.graalvm.buildtools.native") version "0.10.1" - } - repositories { - mavenCentral() - gradlePluginPortal() - } + plugins { + id("org.graalvm.buildtools.native") version "0.10.1" + } + repositories { + mavenCentral() + gradlePluginPortal() + } } rootProject.name = "graalvm-starter" From 3b0d2af31e16504c9dba030fd701de9febda08f8 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Thu, 5 Sep 2024 13:20:49 +0200 Subject: [PATCH 023/611] Upgrade to GraalVM Native Build Tools 0.10.2 --- .../projects/graalvm-starter/settings.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts b/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts index 39f3134b19c6..7c15fd07d908 100644 --- a/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts +++ b/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts @@ -1,6 +1,6 @@ pluginManagement { plugins { - id("org.graalvm.buildtools.native") version "0.10.1" + id("org.graalvm.buildtools.native") version "0.10.2" } repositories { mavenCentral() From 40bc1c4146d91b595668bd06402dba0a83d05b9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonard=20Br=C3=BCnings?= Date: Mon, 26 Aug 2024 13:41:54 +0200 Subject: [PATCH 024/611] Fix potential double acquisition in `SingleLock` `SingleLock` uses a `ForkJoinPool.ManagedBlocker` for efficient blocking in a fork-join pool. In the `isReleasable()` method it calls `tryLock()` without remembering the outcome. The `block` method also unconditionally called `lockInterruptibly()` even if the lock was already acquired. The problem that can arise is that the lock is acquired multiple times, but only released once. `CompositeLockManagedBlocker` is also updated, so that `block()` checks for `acquired` before locking. --- .../docs/asciidoc/release-notes/release-notes-5.11.1.adoc | 3 ++- .../engine/support/hierarchical/CompositeLock.java | 6 ++++-- .../platform/engine/support/hierarchical/SingleLock.java | 8 +++++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc index 48a5c8fdf324..b27f74c910ce 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc @@ -16,7 +16,8 @@ JUnit repository on GitHub. [[release-notes-5.11.1-junit-platform-bug-fixes]] ==== Bug Fixes -* ❓ +* Fix potential locking issue with `ExclusiveResource` in the `HierarchicalTestExecutorService`. + This could lead to deadlocks in certain scenarios. [[release-notes-5.11.1-junit-platform-deprecations-and-breaking-changes]] ==== Deprecations and Breaking Changes diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/CompositeLock.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/CompositeLock.java index df5ea0a5f3e3..18b628b0fdde 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/CompositeLock.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/CompositeLock.java @@ -68,8 +68,10 @@ private class CompositeLockManagedBlocker implements ForkJoinPool.ManagedBlocker @Override public boolean block() throws InterruptedException { - acquireAllLocks(); - acquired = true; + if (!acquired) { + acquireAllLocks(); + acquired = true; + } return true; } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleLock.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleLock.java index 23840449bd63..b5f6e80d8089 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleLock.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleLock.java @@ -46,14 +46,16 @@ private class SingleLockManagedBlocker implements ForkJoinPool.ManagedBlocker { @Override public boolean block() throws InterruptedException { - lock.lockInterruptibly(); - acquired = true; + if (!acquired) { + lock.lockInterruptibly(); + acquired = true; + } return true; } @Override public boolean isReleasable() { - return acquired || lock.tryLock(); + return acquired || (acquired = lock.tryLock()); } } From 044f5cf4b066d3f2121a33db4a8d3952355d5225 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Sun, 8 Sep 2024 13:55:26 +0200 Subject: [PATCH 025/611] Polishing --- .../release-notes/release-notes-5.11.1.adoc | 8 ++++---- .../support/hierarchical/CompositeLock.java | 16 ++++++++-------- .../engine/support/hierarchical/SingleLock.java | 14 +++++++------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc index b27f74c910ce..80f58d56d747 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc @@ -6,8 +6,8 @@ *Scope:* minor bug fixes and improvements since 5.11.0 For a complete list of all _closed_ issues and pull requests for this release, consult the -link:{junit5-repo}+/milestone/79?closed=1+[5.11.1] milestone page in the -JUnit repository on GitHub. +link:{junit5-repo}+/milestone/79?closed=1+[5.11.1] milestone page in the JUnit repository +on GitHub. [[release-notes-5.11.1-junit-platform]] @@ -16,8 +16,8 @@ JUnit repository on GitHub. [[release-notes-5.11.1-junit-platform-bug-fixes]] ==== Bug Fixes -* Fix potential locking issue with `ExclusiveResource` in the `HierarchicalTestExecutorService`. - This could lead to deadlocks in certain scenarios. +* Fixed potential locking issue with `ExclusiveResource` in the + `HierarchicalTestExecutorService`, which could lead to deadlocks in certain scenarios. [[release-notes-5.11.1-junit-platform-deprecations-and-breaking-changes]] ==== Deprecations and Breaking Changes diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/CompositeLock.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/CompositeLock.java index 18b628b0fdde..3718d82a64fc 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/CompositeLock.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/CompositeLock.java @@ -28,7 +28,7 @@ class CompositeLock implements ResourceLock { // for tests only List getLocks() { - return locks; + return this.locks; } @Override @@ -38,9 +38,9 @@ public ResourceLock acquire() throws InterruptedException { } private void acquireAllLocks() throws InterruptedException { - List acquiredLocks = new ArrayList<>(locks.size()); + List acquiredLocks = new ArrayList<>(this.locks.size()); try { - for (Lock lock : locks) { + for (Lock lock : this.locks) { lock.lockInterruptibly(); acquiredLocks.add(lock); } @@ -53,7 +53,7 @@ private void acquireAllLocks() throws InterruptedException { @Override public void release() { - release(locks); + release(this.locks); } private void release(List acquiredLocks) { @@ -64,20 +64,20 @@ private void release(List acquiredLocks) { private class CompositeLockManagedBlocker implements ForkJoinPool.ManagedBlocker { - private boolean acquired; + private volatile boolean acquired; @Override public boolean block() throws InterruptedException { - if (!acquired) { + if (!this.acquired) { acquireAllLocks(); - acquired = true; + this.acquired = true; } return true; } @Override public boolean isReleasable() { - return acquired; + return this.acquired; } } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleLock.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleLock.java index b5f6e80d8089..e568b9a8f5c0 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleLock.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleLock.java @@ -26,7 +26,7 @@ class SingleLock implements ResourceLock { // for tests only Lock getLock() { - return lock; + return this.lock; } @Override @@ -37,25 +37,25 @@ public ResourceLock acquire() throws InterruptedException { @Override public void release() { - lock.unlock(); + this.lock.unlock(); } private class SingleLockManagedBlocker implements ForkJoinPool.ManagedBlocker { - private boolean acquired; + private volatile boolean acquired; @Override public boolean block() throws InterruptedException { - if (!acquired) { - lock.lockInterruptibly(); - acquired = true; + if (!this.acquired) { + SingleLock.this.lock.lockInterruptibly(); + this.acquired = true; } return true; } @Override public boolean isReleasable() { - return acquired || (acquired = lock.tryLock()); + return this.acquired || (this.acquired = SingleLock.this.lock.tryLock()); } } From 16ab431ac14df4ede8a2d9129315b6b96e3136ee Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 9 Sep 2024 13:01:10 +0200 Subject: [PATCH 026/611] Disable Configuration Cache by default but enable it on CI when possible There were too many hiccups, the `asciidoctor` and `eclipse` tasks being the most prominent examples. --- .github/actions/main-build/action.yml | 2 +- .github/workflows/cross-version.yml | 6 ++++-- .github/workflows/main.yml | 12 +++++------- .github/workflows/reproducible-build.yml | 3 ++- gradle.properties | 1 - 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/actions/main-build/action.yml b/.github/actions/main-build/action.yml index b9acd2f3c045..4c6c611412d7 100644 --- a/.github/actions/main-build/action.yml +++ b/.github/actions/main-build/action.yml @@ -4,7 +4,7 @@ inputs: arguments: required: true description: Gradle arguments - default: :platform-tooling-support-tests:test build + default: :platform-tooling-support-tests:test build --configuration-cache runs: using: "composite" steps: diff --git a/.github/workflows/cross-version.yml b/.github/workflows/cross-version.yml index 97b19e9ed8b5..2a760cfe25fe 100644 --- a/.github/workflows/cross-version.yml +++ b/.github/workflows/cross-version.yml @@ -47,7 +47,8 @@ jobs: arguments: | -PjavaToolchain.version=${{ matrix.jdk.version }} \ -Dscan.tag.JDK_${{ matrix.jdk.version }} \ - build + build \ + --configuration-cache openj9: strategy: fail-fast: false @@ -81,4 +82,5 @@ jobs: -PjavaToolchain.implementation=j9 \ -Dscan.tag.JDK_${{ matrix.jdk }} \ -Dscan.tag.OpenJ9 \ - build + build \ + --configuration-cache diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bb456f95beb3..fce0b7512bc1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,7 +34,8 @@ jobs: -Ptesting.enableJaCoCo \ :platform-tooling-support-tests:test \ build \ - jacocoRootReport + jacocoRootReport \ + --configuration-cache - name: Upload to Codecov.io uses: codecov/codecov-action@v4 with: @@ -81,8 +82,7 @@ jobs: with: arguments: | publish -x check \ - prepareGitHubAttestation \ - --no-configuration-cache + prepareGitHubAttestation - name: Generate build provenance attestations uses: actions/attest-build-provenance@210c1913531870065f03ce1f9440dd87bc0938cd # v1.4.0 with: @@ -109,15 +109,13 @@ jobs: with: arguments: | prepareDocsForUploadToGhPages \ - -Dscan.tag.Documentation \ - --no-configuration-cache + -Dscan.tag.Documentation - name: Upload Documentation if: github.event_name == 'push' && github.repository == 'junit-team/junit5' && github.ref == 'refs/heads/main' uses: ./.github/actions/run-gradle with: arguments: | gitPublishPush \ - -Dscan.tag.Documentation \ - --no-configuration-cache + -Dscan.tag.Documentation env: GRGIT_USER: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/reproducible-build.yml b/.github/workflows/reproducible-build.yml index 5866318d1356..9bf66f6b3fd3 100644 --- a/.github/workflows/reproducible-build.yml +++ b/.github/workflows/reproducible-build.yml @@ -24,7 +24,8 @@ jobs: - name: Restore Gradle cache and display toolchains uses: ./.github/actions/run-gradle with: - arguments: --quiet + arguments: --quiet \ + --configuration-cache - name: Build and compare checksums shell: bash run: | diff --git a/gradle.properties b/gradle.properties index 1ea6fe5cdd9c..9fc0c535e8f1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,6 @@ org.gradle.jvmargs=-Xmx1g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryEr --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED -org.gradle.configuration-cache=true org.gradle.caching=true org.gradle.parallel=true org.gradle.java.installations.fromEnv=JDK8,JDK18,JDK19,JDK20,JDK21,JDK22,JDK23,JDK24 From c1843e44dbf09158b65986c05a3dacbc6ca1a970 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 9 Sep 2024 13:32:16 +0200 Subject: [PATCH 027/611] Disable ArchUnitTests on JDK 24 and later --- gradle/libs.versions.toml | 3 +++ .../java/platform/tooling/support/tests/ArchUnitTests.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6ec9b4616f49..89a76c1ff3ab 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -24,7 +24,10 @@ ant = { module = "org.apache.ant:ant", version.ref = "ant" } ant-junit = { module = "org.apache.ant:ant-junit", version.ref = "ant" } ant-junitlauncher = { module = "org.apache.ant:ant-junitlauncher", version.ref = "ant" } apiguardian = { module = "org.apiguardian:apiguardian-api", version.ref = "apiguardian" } + +# check whether @DisabledForJreRange condition on ArchUnitTests can be updated when updating archunit = { module = "com.tngtech.archunit:archunit-junit5", version = "1.3.0" } + assertj = { module = "org.assertj:assertj-core", version.ref = "assertj" } bartholdy = { module = "de.sormuras:bartholdy", version = "0.2.3" } bndlib = { module = "biz.aQute.bnd:biz.aQute.bndlib", version.ref = "bnd" } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java index ff32c0777736..a0504901de9d 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java @@ -41,7 +41,10 @@ import org.apiguardian.api.API; import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.condition.DisabledForJreRange; +import org.junit.jupiter.api.condition.JRE; +@DisabledForJreRange(min = JRE.JAVA_24) @Order(Integer.MAX_VALUE) @AnalyzeClasses(locations = ArchUnitTests.AllJars.class) class ArchUnitTests { From 48624faf726a5e0df8e05c4e00a0237032e924bf Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 9 Sep 2024 13:34:37 +0200 Subject: [PATCH 028/611] Fix YAML syntax --- .github/workflows/reproducible-build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/reproducible-build.yml b/.github/workflows/reproducible-build.yml index 9bf66f6b3fd3..a4466d4ca450 100644 --- a/.github/workflows/reproducible-build.yml +++ b/.github/workflows/reproducible-build.yml @@ -24,7 +24,8 @@ jobs: - name: Restore Gradle cache and display toolchains uses: ./.github/actions/run-gradle with: - arguments: --quiet \ + arguments: | + --quiet \ --configuration-cache - name: Build and compare checksums shell: bash From 1e50843c38b2b7eaf0659521b7bb792aeeeb9e13 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Mon, 9 Sep 2024 14:01:42 +0200 Subject: [PATCH 029/611] Delete unnecessary (and potentially misleading) comment in User Guide --- documentation/src/docs/asciidoc/user-guide/writing-tests.adoc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc index 49a5d4ff3f9b..3a161bf3185f 100644 --- a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc +++ b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc @@ -2428,10 +2428,6 @@ lambda expression for a dynamic test, those fields will not be reset by callback or extensions between the execution of individual dynamic tests generated by the same `@TestFactory` method. -As of JUnit Jupiter {jupiter-version}, dynamic tests must always be created by factory -methods; however, this might be complemented by a registration facility in a later -release. - [[writing-tests-dynamic-tests-examples]] ==== Dynamic Test Examples From 3c51d9282b1150253b6bcfa8302c3023994f84b9 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 9 Sep 2024 14:03:46 +0200 Subject: [PATCH 030/611] Only run ArchUnit tests on JDKs < 24 --- gradle/libs.versions.toml | 2 +- .../platform-tooling-support-tests.gradle.kts | 7 +++++-- .../java/platform/tooling/support/tests/ArchUnitTests.java | 3 --- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 89a76c1ff3ab..b4066ff064d4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -25,7 +25,7 @@ ant-junit = { module = "org.apache.ant:ant-junit", version.ref = "ant" } ant-junitlauncher = { module = "org.apache.ant:ant-junitlauncher", version.ref = "ant" } apiguardian = { module = "org.apiguardian:apiguardian-api", version.ref = "apiguardian" } -# check whether @DisabledForJreRange condition on ArchUnitTests can be updated when updating +# check whether the Java condition in platform-tooling-support-tests.gradle.kts can be changed when updating archunit = { module = "com.tngtech.archunit:archunit-junit5", version = "1.3.0" } assertj = { module = "org.assertj:assertj-core", version.ref = "assertj" } diff --git a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts index 9b7d6c805f1b..181cd73cf1c5 100644 --- a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts +++ b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts @@ -1,3 +1,4 @@ + import com.gradle.develocity.agent.gradle.internal.test.TestDistributionConfigurationInternal import junitbuild.extensions.capitalized import org.gradle.api.tasks.PathSensitivity.RELATIVE @@ -142,8 +143,10 @@ tasks.test { jvmArgumentProviders += JarPath(project, antJarsClasspath.get(), "antJars") jvmArgumentProviders += MavenDistribution(project, unzipMavenDistribution, mavenDistributionDir) - (options as JUnitPlatformOptions).apply { - includeEngines("archunit") + if (buildParameters.javaToolchain.version.orElse(21) < 24) { + (options as JUnitPlatformOptions).apply { + includeEngines("archunit") + } } inputs.apply { diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java index a0504901de9d..ff32c0777736 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java @@ -41,10 +41,7 @@ import org.apiguardian.api.API; import org.junit.jupiter.api.Order; -import org.junit.jupiter.api.condition.DisabledForJreRange; -import org.junit.jupiter.api.condition.JRE; -@DisabledForJreRange(min = JRE.JAVA_24) @Order(Integer.MAX_VALUE) @AnalyzeClasses(locations = ArchUnitTests.AllJars.class) class ArchUnitTests { From d9d023fccd27e0339fea5fbc082172b6347ea962 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 9 Sep 2024 14:23:27 +0200 Subject: [PATCH 031/611] Fix build script --- .../platform-tooling-support-tests.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts index 181cd73cf1c5..3938425035a3 100644 --- a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts +++ b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts @@ -143,7 +143,7 @@ tasks.test { jvmArgumentProviders += JarPath(project, antJarsClasspath.get(), "antJars") jvmArgumentProviders += MavenDistribution(project, unzipMavenDistribution, mavenDistributionDir) - if (buildParameters.javaToolchain.version.orElse(21) < 24) { + if (buildParameters.javaToolchain.version.getOrElse(21) < 24) { (options as JUnitPlatformOptions).apply { includeEngines("archunit") } From 52d81763e1055c0ee3733ee71ab28e2e3867054a Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 9 Sep 2024 14:57:29 +0200 Subject: [PATCH 032/611] Fix integration tests running Maven on JDK 24 --- .../support/tests/JavaVersionsTests.java | 16 ++++++----- .../tooling/support/tests/MavenEnvVars.java | 27 +++++++++++++++++++ .../support/tests/MultiReleaseJarTests.java | 12 ++++++--- 3 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenEnvVars.java diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java index 54702715df5f..d7785cd6e1ad 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java @@ -18,6 +18,7 @@ import java.nio.file.Path; import java.util.List; +import java.util.Map; import de.sormuras.bartholdy.tool.Java; @@ -36,28 +37,31 @@ class JavaVersionsTests { void java_8() { var java8Home = Helper.getJavaHome("8"); assumeTrue(java8Home.isPresent(), "Java 8 installation directory not found!"); - var actualLines = execute("8", java8Home.get()); + var actualLines = execute("8", java8Home.get(), Map.of()); assertTrue(actualLines.contains("[WARNING] Tests run: 2, Failures: 0, Errors: 0, Skipped: 1")); } @Test void java_default() { - var actualLines = execute("default", new Java().getHome()); + var actualLines = execute("default", new Java().getHome(), MavenEnvVars.FOR_JDK24_AND_LATER); assertTrue(actualLines.contains("[WARNING] Tests run: 2, Failures: 0, Errors: 0, Skipped: 1")); } - List execute(String version, Path javaHome) { - var result = Request.builder() // + List execute(String version, Path javaHome, Map environmentVars) { + var builder = Request.builder() // .setTool(Request.maven()) // .setProject(Projects.JAVA_VERSIONS) // .setWorkspace("java-versions-" + version) // .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("--update-snapshots", "--batch-mode", "verify") // .setTimeout(TOOL_TIMEOUT) // - .setJavaHome(javaHome) // - .build().run(); + .setJavaHome(javaHome); + environmentVars.forEach(builder::putEnvironment); + + var result = builder.build().run(); + assertFalse(result.isTimedOut(), () -> "tool timed out: " + result); assertEquals(0, result.getExitCode()); assertEquals("", result.getOutput("err")); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenEnvVars.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenEnvVars.java new file mode 100644 index 000000000000..bcec609010a0 --- /dev/null +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenEnvVars.java @@ -0,0 +1,27 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package platform.tooling.support.tests; + +import java.util.Map; + +import org.junit.jupiter.api.condition.JRE; + +final class MavenEnvVars { + + // https://issues.apache.org/jira/browse/MNG-8248 + static final Map FOR_JDK24_AND_LATER = JRE.currentVersion().compareTo(JRE.JAVA_24) >= 0 // + ? Map.of("MAVEN_OPTS", "--enable-native-access=ALL-UNNAMED") // + : Map.of(); + + private MavenEnvVars() { + } + +} diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java index 8ca29012b767..33105f0983f4 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java @@ -19,6 +19,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.List; +import java.util.Map; import de.sormuras.bartholdy.Result; @@ -82,15 +83,18 @@ void checkDefault() throws Exception { } private Result mvn(String variant) { - var result = Request.builder() // + Map environmentVars = MavenEnvVars.FOR_JDK24_AND_LATER; + + var builder = Request.builder() // .setTool(Request.maven()) // .setProject(Projects.MULTI_RELEASE_JAR) // .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("--update-snapshots", "--show-version", "--errors", "--batch-mode", "--file", variant, "test") // - .setTimeout(TOOL_TIMEOUT) // - .build() // - .run(); + .setTimeout(TOOL_TIMEOUT); + environmentVars.forEach(builder::putEnvironment); + + var result = builder.build().run(); assertFalse(result.isTimedOut(), () -> "tool timed out: " + result); From 8665d6d68e01a92c69b77915e1000c6dae4e0aec Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 9 Sep 2024 15:29:56 +0200 Subject: [PATCH 033/611] Track Java runtime version as part of Test/JavaExec cache key In order to detect changes in behavior between EA builds sooner --- .../junitbuild.java-toolchain-conventions.gradle.kts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.java-toolchain-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.java-toolchain-conventions.gradle.kts index c6b7e0120359..873ff64cfb1e 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.java-toolchain-conventions.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.java-toolchain-conventions.gradle.kts @@ -32,6 +32,17 @@ project.pluginManager.withPlugin("java") { tasks.withType().configureEach { javaLauncher = javaToolchainService.launcherFor(extension.toolchain) + if (javaLanguageVersion != defaultLanguageVersion) { + // Track exact version of Java to detect changes in behavior between EA builds sooner + inputs.property("javaRuntimeVersion", javaLauncher.get().metadata.javaRuntimeVersion) + } + } + + tasks.withType().configureEach { + if (javaLanguageVersion != defaultLanguageVersion) { + // Track exact version of Java to detect changes in behavior between EA builds sooner + inputs.property("javaRuntimeVersion", javaLauncher.get().metadata.javaRuntimeVersion) + } } tasks.withType().configureEach { From 9c1632c0201d62eb46c8a8af2758607aa2c03467 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 9 Sep 2024 15:46:04 +0200 Subject: [PATCH 034/611] Schedule cross-version workflow to run once a week to spot new issues --- .github/workflows/cross-version.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/cross-version.yml b/.github/workflows/cross-version.yml index 2a760cfe25fe..8a50878c10ec 100644 --- a/.github/workflows/cross-version.yml +++ b/.github/workflows/cross-version.yml @@ -1,6 +1,8 @@ name: Cross-Version on: + schedule: + - cron: '0 0 * * 6' // Every Saturday at 00:00 UTC push: branches: - main From 26d4dbe863bff6a3b05cd9f7fd561dfe3a02c1cf Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 9 Sep 2024 15:53:17 +0200 Subject: [PATCH 035/611] Fix YAML syntax --- .github/workflows/cross-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cross-version.yml b/.github/workflows/cross-version.yml index 8a50878c10ec..5813d8b5a430 100644 --- a/.github/workflows/cross-version.yml +++ b/.github/workflows/cross-version.yml @@ -2,7 +2,7 @@ name: Cross-Version on: schedule: - - cron: '0 0 * * 6' // Every Saturday at 00:00 UTC + - cron: '0 0 * * 6' # Every Saturday at 00:00 UTC push: branches: - main From 39ef1bc2dba26b225e3483a78fc319775046cfb3 Mon Sep 17 00:00:00 2001 From: Christian Stein Date: Tue, 10 Sep 2024 07:53:40 +0200 Subject: [PATCH 036/611] Fix `NO_COLOR` support in console launcher Closes #3328 --- .../docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc | 3 ++- .../junit/platform/console/options/AnsiColorOptionMixin.java | 4 +++- .../java/platform/tooling/support/tests/StandaloneTests.java | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 89a1753a5280..b935ad8a9832 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -16,7 +16,8 @@ JUnit repository on GitHub. [[release-notes-5.12.0-M1-junit-platform-bug-fixes]] ==== Bug Fixes -* ❓ +* Fix support for disabling ANSI colors on the console when the `NO_COLOR` environment + variable is available. [[release-notes-5.12.0-M1-junit-platform-deprecations-and-breaking-changes]] ==== Deprecations and Breaking Changes diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/AnsiColorOptionMixin.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/AnsiColorOptionMixin.java index bfd1bdbf1474..19a29afac5e7 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/AnsiColorOptionMixin.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/AnsiColorOptionMixin.java @@ -23,7 +23,9 @@ class AnsiColorOptionMixin { @Spec(MIXEE) CommandSpec commandSpec; - private boolean disableAnsiColors; + // https://no-color.org + // ANSI is disabled when environment variable NO_COLOR is defined (regardless of its value). + private boolean disableAnsiColors = System.getenv("NO_COLOR") != null; public boolean isDisableAnsiColors() { return disableAnsiColors; diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java index 98f3bb5104a4..e033b3e62e97 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java @@ -383,13 +383,13 @@ JUnit Jupiter > JupiterIntegration > disabled() private static Result discover(String... args) { var result = Request.builder() // + .putEnvironment("NO_COLOR", "1") // --disable-ansi-colors .setTool(new Java()) // .setProject(Projects.STANDALONE) // .addArguments("-jar", MavenRepo.jar("junit-platform-console-standalone")) // .addArguments("discover") // .addArguments("--scan-class-path") // .addArguments("--disable-banner") // - .addArguments("--disable-ansi-colors") // .addArguments("--include-classname", "standalone.*") // .addArguments("--classpath", "bin") // .addArguments((Object[]) args) // @@ -405,6 +405,7 @@ private static Result discover(String... args) { @Order(3) void execute() throws IOException { var result = Request.builder() // + .putEnvironment("NO_COLOR", "1") // --disable-ansi-colors .setTool(new Java()) // .setProject(Projects.STANDALONE) // .addArguments("--show-version") // From 3629c0d4f9fd83dcfba6591236a8aa669a6cbc3e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 09:13:09 +0200 Subject: [PATCH 037/611] Configure Renovate (#3950) * Configure presets * Disable major updates for Groovy and Spock * Prevent automated updates to SNAPSHOT versions of open-test-reporting --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Marc Philipp --- .github/renovate.json5 | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/renovate.json5 diff --git a/.github/renovate.json5 b/.github/renovate.json5 new file mode 100644 index 000000000000..1fcd1c29c90a --- /dev/null +++ b/.github/renovate.json5 @@ -0,0 +1,33 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:best-practices", + "group:all", + ":automergeAll", + "schedule:weekly", + ], + packageRules: [ + // Disable major version upgrades for Groovy versions + // as we want to keep one for each major version. + // The same applies for Spock as we test the Vintage engine integration + { + matchPackagePrefixes: ["org.codehaus.groovy:"], + matchCurrentValue: "/^2\\./", + allowedVersions: "(,3.0)" + }, + { + matchPackagePrefixes: ["org.apache.groovy:"], + matchCurrentValue: "/^4\\./", + allowedVersions: "(,5.0)" + }, + { + matchPackagePrefixes: ["org.spockframework:"], + matchCurrentValue: "/^1\\./", + allowedVersions: "/^1\\..*-groovy-2\\.*/" + }, + { + matchPackagePrefixes: ["org.opentest4j.reporting:"], + allowedVersions: "!/-SNAPSHOT$/" + }, + ] +} From 003a9b486de75538a1b817d392a9842081dd233d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 07:15:13 +0000 Subject: [PATCH 038/611] Migrate config .github/renovate.json5 --- .github/renovate.json5 | 47 +++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 1fcd1c29c90a..48ab9134044e 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -1,33 +1,38 @@ { - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": [ - "config:best-practices", - "group:all", - ":automergeAll", - "schedule:weekly", + $schema: 'https://docs.renovatebot.com/renovate-schema.json', + extends: [ + 'config:best-practices', + 'group:all', + ':automergeAll', + 'schedule:weekly', ], packageRules: [ - // Disable major version upgrades for Groovy versions - // as we want to keep one for each major version. - // The same applies for Spock as we test the Vintage engine integration { - matchPackagePrefixes: ["org.codehaus.groovy:"], - matchCurrentValue: "/^2\\./", - allowedVersions: "(,3.0)" + matchCurrentValue: '/^2\\./', + allowedVersions: '(,3.0)', + matchPackageNames: [ + 'org.codehaus.groovy:{/,}**', + ], }, { - matchPackagePrefixes: ["org.apache.groovy:"], - matchCurrentValue: "/^4\\./", - allowedVersions: "(,5.0)" + matchCurrentValue: '/^4\\./', + allowedVersions: '(,5.0)', + matchPackageNames: [ + 'org.apache.groovy:{/,}**', + ], }, { - matchPackagePrefixes: ["org.spockframework:"], - matchCurrentValue: "/^1\\./", - allowedVersions: "/^1\\..*-groovy-2\\.*/" + matchCurrentValue: '/^1\\./', + allowedVersions: '/^1\\..*-groovy-2\\.*/', + matchPackageNames: [ + 'org.spockframework:{/,}**', + ], }, { - matchPackagePrefixes: ["org.opentest4j.reporting:"], - allowedVersions: "!/-SNAPSHOT$/" + allowedVersions: '!/-SNAPSHOT$/', + matchPackageNames: [ + 'org.opentest4j.reporting:{/,}**', + ], }, - ] + ], } From 762c68cec431e3667dad0ede10d6fa373075574d Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 10 Sep 2024 12:31:13 +0200 Subject: [PATCH 039/611] Ignore Eclipse JDT 4.33.0 Due to diffplug/spotless#2255 --- .github/renovate.json5 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 48ab9134044e..dfe5750341e8 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -34,5 +34,14 @@ 'org.opentest4j.reporting:{/,}**', ], }, + { + allowedVersions: '!/4\\.33\\.0/', + description: [ + 'Due to https://github.com/diffplug/spotless/issues/2255', + ], + matchPackageNames: [ + 'org.eclipse.platform:{/,}**' + ] + }, ], } From 6fe353f374e0399e788294b22e2375e19a385655 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 10 Sep 2024 13:00:05 +0200 Subject: [PATCH 040/611] Bump Maven Surefire plugin to 3.5.0 --- platform-tooling-support-tests/projects/vintage/pom.xml | 2 +- .../tooling/support/tests/VintageMavenIntegrationTests.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/platform-tooling-support-tests/projects/vintage/pom.xml b/platform-tooling-support-tests/projects/vintage/pom.xml index 47a0f145cf89..11f500cd1e1c 100644 --- a/platform-tooling-support-tests/projects/vintage/pom.xml +++ b/platform-tooling-support-tests/projects/vintage/pom.xml @@ -43,7 +43,7 @@ maven-surefire-plugin - 2.22.2 + 3.5.0 diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java index 3358881d600f..398c5a13ff03 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java @@ -31,8 +31,9 @@ class VintageMavenIntegrationTests { void unsupportedVersion() { var result = run("4.11"); - assertThat(result.getExitCode()).isEqualTo(0); + assertThat(result.getExitCode()).isEqualTo(1); assertThat(result.getOutput("out")) // + .contains("TestEngine with ID 'junit-vintage' failed to discover tests") // .contains("Tests run: 0, Failures: 0, Errors: 0, Skipped: 0"); } From 816713bbae0853a95a27a285372092276bd6c676 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 10 Sep 2024 12:48:21 +0200 Subject: [PATCH 041/611] Group PRs by package manager --- .github/renovate.json5 | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index dfe5750341e8..a66aa83b3116 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -2,11 +2,34 @@ $schema: 'https://docs.renovatebot.com/renovate-schema.json', extends: [ 'config:best-practices', - 'group:all', ':automergeAll', 'schedule:weekly', ], packageRules: [ + { + groupName: 'Maven dependencies', + matchManagers: [ + 'maven' + ], + }, + { + groupName: 'Gradle dependencies', + matchManagers: [ + 'gradle' + ], + }, + { + groupName: 'GitHub Actions', + matchManagers: [ + 'github-actions' + ], + }, + { + groupName: 'Gradle wrapper', + matchManagers: [ + 'gradle-wrapper' + ], + }, { matchCurrentValue: '/^2\\./', allowedVersions: '(,3.0)', From 1377648e16444c89e632834acc409e4fc97e6561 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 10 Sep 2024 13:09:03 +0200 Subject: [PATCH 042/611] Group by package manager regardless of update type --- .github/renovate.json5 | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index a66aa83b3116..1c0eaf06d34d 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -11,24 +11,36 @@ matchManagers: [ 'maven' ], + matchUpdateTypes: [ + 'major', + 'minor', + 'patch', + ], }, { groupName: 'Gradle dependencies', matchManagers: [ 'gradle' ], + matchUpdateTypes: [ + 'major', + 'minor', + 'patch', + ] }, { groupName: 'GitHub Actions', matchManagers: [ 'github-actions' ], - }, - { - groupName: 'Gradle wrapper', - matchManagers: [ - 'gradle-wrapper' - ], + matchUpdateTypes: [ + 'major', + 'minor', + 'patch', + 'pin', + 'pinDigest', + 'digest' + ] }, { matchCurrentValue: '/^2\\./', From 5ab702be281e25fe2a25de614d402a9c0e90016a Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 10 Sep 2024 13:20:18 +0200 Subject: [PATCH 043/611] Delete custom groups It's easier to revert updates if they're from separate PRs. --- .github/renovate.json5 | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 1c0eaf06d34d..e934b36ed7f0 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -6,42 +6,6 @@ 'schedule:weekly', ], packageRules: [ - { - groupName: 'Maven dependencies', - matchManagers: [ - 'maven' - ], - matchUpdateTypes: [ - 'major', - 'minor', - 'patch', - ], - }, - { - groupName: 'Gradle dependencies', - matchManagers: [ - 'gradle' - ], - matchUpdateTypes: [ - 'major', - 'minor', - 'patch', - ] - }, - { - groupName: 'GitHub Actions', - matchManagers: [ - 'github-actions' - ], - matchUpdateTypes: [ - 'major', - 'minor', - 'patch', - 'pin', - 'pinDigest', - 'digest' - ] - }, { matchCurrentValue: '/^2\\./', allowedVersions: '(,3.0)', From 807bcf20d8f4440e0809a4b9f91951817101b9c5 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 10 Sep 2024 14:21:39 +0200 Subject: [PATCH 044/611] Only cancel in-progress documentation jobs when result will be uploaded --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fce0b7512bc1..ce486d491a63 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -92,7 +92,7 @@ jobs: name: Build Documentation concurrency: group: github-pages - cancel-in-progress: true + cancel-in-progress: ${{ github.event_name == 'push' && github.repository == 'junit-team/junit5' && github.ref == 'refs/heads/main' }} needs: Linux runs-on: ubuntu-latest steps: From 0b401510daf2b77618ed8e7b68b6793809ec2f35 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 10 Sep 2024 14:35:34 +0200 Subject: [PATCH 045/611] Include github.ref in concurrency group to avoid unnecessary conflicts --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ce486d491a63..36d06b7beaab 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -91,8 +91,8 @@ jobs: documentation: name: Build Documentation concurrency: - group: github-pages - cancel-in-progress: ${{ github.event_name == 'push' && github.repository == 'junit-team/junit5' && github.ref == 'refs/heads/main' }} + group: github-pages-${{ github.ref }} + cancel-in-progress: true needs: Linux runs-on: ubuntu-latest steps: From c5b1a392738d390ca934f1291bcc408530482eb6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 12:38:41 +0000 Subject: [PATCH 046/611] Pin dependencies --- .github/actions/run-gradle/action.yml | 4 ++-- .github/actions/setup-test-jdk/action.yml | 2 +- .github/workflows/close-inactive-issues.yml | 2 +- .github/workflows/codeql-analysis.yml | 6 +++--- .github/workflows/combine-prs.yml | 2 +- .github/workflows/cross-version.yml | 6 +++--- .github/workflows/gradle-dependency-submission.yml | 6 +++--- .github/workflows/label-opened-issues.yml | 2 +- .github/workflows/main.yml | 14 +++++++------- .github/workflows/reproducible-build.yml | 2 +- .github/workflows/unlabel-closed-issues.yml | 2 +- 11 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/actions/run-gradle/action.yml b/.github/actions/run-gradle/action.yml index 4103d29bab8d..e825551ce6f5 100644 --- a/.github/actions/run-gradle/action.yml +++ b/.github/actions/run-gradle/action.yml @@ -8,13 +8,13 @@ inputs: runs: using: "composite" steps: - - uses: actions/setup-java@v4 + - uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 id: setup-gradle-jdk with: distribution: temurin java-version: 21 check-latest: true - - uses: gradle/actions/setup-gradle@v4 + - uses: gradle/actions/setup-gradle@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4 - shell: bash env: JAVA_HOME: ${{ steps.setup-gradle-jdk.outputs.path }} diff --git a/.github/actions/setup-test-jdk/action.yml b/.github/actions/setup-test-jdk/action.yml index 70a571e59a7f..9492cfae4ad6 100644 --- a/.github/actions/setup-test-jdk/action.yml +++ b/.github/actions/setup-test-jdk/action.yml @@ -8,7 +8,7 @@ inputs: runs: using: "composite" steps: - - uses: actions/setup-java@v4 + - uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 with: distribution: ${{ inputs.distribution }} java-version: 8 diff --git a/.github/workflows/close-inactive-issues.yml b/.github/workflows/close-inactive-issues.yml index fef88e94d267..687cfcdc4f19 100644 --- a/.github/workflows/close-inactive-issues.yml +++ b/.github/workflows/close-inactive-issues.yml @@ -10,7 +10,7 @@ jobs: issues: write pull-requests: write steps: - - uses: actions/stale@v9 + - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9 with: only-labels: "status: waiting-for-feedback" days-before-stale: 14 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 264bcc0a79f7..133179e59c25 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -30,9 +30,9 @@ jobs: - javascript steps: - name: Check out repository - uses: actions/checkout@v4 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - name: Initialize CodeQL - uses: github/codeql-action/init@v3 + uses: github/codeql-action/init@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3 with: languages: ${{ matrix.language }} tools: latest @@ -44,4 +44,4 @@ jobs: -Dscan.tag.CodeQL \ allMainClasses - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + uses: github/codeql-action/analyze@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3 diff --git a/.github/workflows/combine-prs.yml b/.github/workflows/combine-prs.yml index 29df14a19746..593acdf8a7aa 100644 --- a/.github/workflows/combine-prs.yml +++ b/.github/workflows/combine-prs.yml @@ -11,6 +11,6 @@ jobs: runs-on: ubuntu-latest steps: - name: combine-prs - uses: github/combine-prs@v5.1.0 + uses: github/combine-prs@20d70f9d80eeb5958667d0602da433bd04ca6713 # v5.1.0 with: github_token: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/cross-version.yml b/.github/workflows/cross-version.yml index 5813d8b5a430..9a9cc5712455 100644 --- a/.github/workflows/cross-version.yml +++ b/.github/workflows/cross-version.yml @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: actions/checkout@v4 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 with: fetch-depth: 1 - name: Set up Test JDK @@ -60,7 +60,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: actions/checkout@v4 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 with: fetch-depth: 1 - name: Set up Test JDK @@ -68,7 +68,7 @@ jobs: with: distribution: semeru - name: 'Set up JDK ${{ matrix.jdk }}' - uses: actions/setup-java@v4 + uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 with: distribution: semeru java-version: ${{ matrix.jdk }} diff --git a/.github/workflows/gradle-dependency-submission.yml b/.github/workflows/gradle-dependency-submission.yml index 63f483f77f70..c867584a5835 100644 --- a/.github/workflows/gradle-dependency-submission.yml +++ b/.github/workflows/gradle-dependency-submission.yml @@ -14,14 +14,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: actions/checkout@v4 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 with: fetch-depth: 1 - name: Setup Java - uses: actions/setup-java@v4 + uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 with: distribution: temurin java-version: 21 check-latest: true - name: Generate and submit dependency graph - uses: gradle/actions/dependency-submission@v4 + uses: gradle/actions/dependency-submission@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4 diff --git a/.github/workflows/label-opened-issues.yml b/.github/workflows/label-opened-issues.yml index 066596b43c85..9c98295a1840 100644 --- a/.github/workflows/label-opened-issues.yml +++ b/.github/workflows/label-opened-issues.yml @@ -9,7 +9,7 @@ jobs: permissions: issues: write steps: - - uses: actions/github-script@v7 + - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 with: script: | github.rest.issues.addLabels({ diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 36d06b7beaab..5004201b8660 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,11 +17,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: actions/checkout@v4 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 with: fetch-depth: 1 - name: Install GraalVM - uses: graalvm/setup-graalvm@v1 + uses: graalvm/setup-graalvm@22cc13fe88ef133134b3798e128fb208df55e1f5 # v1 with: distribution: graalvm-community version: 'latest' @@ -37,7 +37,7 @@ jobs: jacocoRootReport \ --configuration-cache - name: Upload to Codecov.io - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4 with: token: ${{ secrets.CODECOV_TOKEN }} @@ -45,7 +45,7 @@ jobs: runs-on: windows-latest steps: - name: Check out repository - uses: actions/checkout@v4 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 with: fetch-depth: 1 - name: Build @@ -55,7 +55,7 @@ jobs: runs-on: macos-latest steps: - name: Check out repository - uses: actions/checkout@v4 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 with: fetch-depth: 1 - name: Build @@ -71,7 +71,7 @@ jobs: if: github.event_name == 'push' && github.repository == 'junit-team/junit5' && (startsWith(github.ref, 'refs/heads/releases/') || github.ref == 'refs/heads/main') steps: - name: Check out repository - uses: actions/checkout@v4 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 with: fetch-depth: 1 - name: Publish @@ -97,7 +97,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: actions/checkout@v4 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 with: fetch-depth: 1 - name: Install Graphviz diff --git a/.github/workflows/reproducible-build.yml b/.github/workflows/reproducible-build.yml index a4466d4ca450..39eb9160dbdc 100644 --- a/.github/workflows/reproducible-build.yml +++ b/.github/workflows/reproducible-build.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: actions/checkout@v4 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 with: fetch-depth: 1 - name: Restore Gradle cache and display toolchains diff --git a/.github/workflows/unlabel-closed-issues.yml b/.github/workflows/unlabel-closed-issues.yml index cc476e4fccba..c48b1db534d5 100644 --- a/.github/workflows/unlabel-closed-issues.yml +++ b/.github/workflows/unlabel-closed-issues.yml @@ -9,7 +9,7 @@ jobs: permissions: issues: write steps: - - uses: actions/github-script@v7 + - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 with: script: | const issue = await github.rest.issues.get({ From 467fe81a7f1a1f76cbb13c9b687269cd6e2c34d0 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 10 Sep 2024 15:27:09 +0200 Subject: [PATCH 047/611] Allow Renovate to run around the clock --- .github/renovate.json5 | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index e934b36ed7f0..153557ce6b10 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -3,7 +3,6 @@ extends: [ 'config:best-practices', ':automergeAll', - 'schedule:weekly', ], packageRules: [ { From 21d9ac0e63d98aa74ffd2b4c9796bf1b8af14039 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 13:28:41 +0000 Subject: [PATCH 048/611] Update actions/attest-build-provenance action to v1.4.3 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5004201b8660..3d80d89a1f19 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -84,7 +84,7 @@ jobs: publish -x check \ prepareGitHubAttestation - name: Generate build provenance attestations - uses: actions/attest-build-provenance@210c1913531870065f03ce1f9440dd87bc0938cd # v1.4.0 + uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3 with: subject-path: documentation/build/attestation/*.jar From 0061f5787d9d24b43ffb33f7f1d5c2e3374b945c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 13:44:18 +0000 Subject: [PATCH 049/611] Update ant to v1.10.15 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b4066ff064d4..082c75b29290 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -ant = "1.10.14" +ant = "1.10.15" apiguardian = "1.1.2" asciidoctorj-pdf = "2.3.18" asciidoctor-plugins = "4.0.3" # Check if workaround in documentation.gradle.kts can be removed when upgrading From 0a9be89b99c04059d43a17cf26b9b5ad05eacb76 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 10 Sep 2024 15:44:11 +0200 Subject: [PATCH 050/611] Delete Combine PRs workflow since it's been replaced with Renovate --- .github/workflows/combine-prs.yml | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 .github/workflows/combine-prs.yml diff --git a/.github/workflows/combine-prs.yml b/.github/workflows/combine-prs.yml deleted file mode 100644 index 593acdf8a7aa..000000000000 --- a/.github/workflows/combine-prs.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Combine PRs - -on: - schedule: - - cron: '0 0 * * *' # Every day at 00:00 UTC - workflow_dispatch: - -jobs: - combine-prs: - if: github.repository == 'junit-team/junit5' - runs-on: ubuntu-latest - steps: - - name: combine-prs - uses: github/combine-prs@20d70f9d80eeb5958667d0602da433bd04ca6713 # v5.1.0 - with: - github_token: ${{ secrets.GH_TOKEN }} From 8c523d8b19ebcfadc6eee5c31b162cf16cc6ccaa Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 14:13:29 +0000 Subject: [PATCH 051/611] Update dependency de.sormuras.junit:junit-platform-maven-plugin to v1.1.7 --- .../projects/multi-release-jar/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml b/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml index 0904feb98643..551fc455eb3f 100644 --- a/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml +++ b/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml @@ -45,7 +45,7 @@ de.sormuras.junit junit-platform-maven-plugin - 1.1.5 + 1.1.7 true JAVA From b11b6757d264abab41f1ab423b4b6413e8665117 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 16:39:51 +0000 Subject: [PATCH 052/611] Update dependency io.github.classgraph:classgraph to v4.8.175 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 082c75b29290..0235f4bfd8e7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -32,7 +32,7 @@ assertj = { module = "org.assertj:assertj-core", version.ref = "assertj" } bartholdy = { module = "de.sormuras:bartholdy", version = "0.2.3" } bndlib = { module = "biz.aQute.bnd:biz.aQute.bndlib", version.ref = "bnd" } checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checkstyle" } -classgraph = { module = "io.github.classgraph:classgraph", version = "4.8.174" } +classgraph = { module = "io.github.classgraph:classgraph", version = "4.8.175" } commons-io = { module = "commons-io:commons-io", version = "2.16.1" } groovy4 = { module = "org.apache.groovy:groovy", version = "4.0.22" } groovy2-bom = { module = "org.codehaus.groovy:groovy-bom", version = "2.5.21" } From 44902082a5482d864ee02031567d9e48c903710a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 19:55:19 +0000 Subject: [PATCH 053/611] Update dependency org.apache.maven:apache-maven to v3.9.9 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0235f4bfd8e7..9de95916ea64 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -50,7 +50,7 @@ junit4 = { module = "junit:junit", version = { require = "[4.12,)", prefer = "4. kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.8.1" } log4j-core = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j" } log4j-jul = { module = "org.apache.logging.log4j:log4j-jul", version.ref = "log4j" } -maven = { module = "org.apache.maven:apache-maven", version = "3.9.8" } +maven = { module = "org.apache.maven:apache-maven", version = "3.9.9" } mavenSurefirePlugin = { module = "org.apache.maven.plugins:maven-surefire-plugin", version.ref = "surefire" } memoryfilesystem = { module = "com.github.marschall:memoryfilesystem", version = "2.8.0" } mockito = { module = "org.mockito:mockito-junit-jupiter", version = "5.12.0" } From afc202c16082c814dcbf09fb223fe3159ed7e2a8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 22:57:21 +0000 Subject: [PATCH 054/611] Update dependency org.codehaus.groovy:groovy-bom to v2.5.23 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9de95916ea64..98bd60916162 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -35,7 +35,7 @@ checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checks classgraph = { module = "io.github.classgraph:classgraph", version = "4.8.175" } commons-io = { module = "commons-io:commons-io", version = "2.16.1" } groovy4 = { module = "org.apache.groovy:groovy", version = "4.0.22" } -groovy2-bom = { module = "org.codehaus.groovy:groovy-bom", version = "2.5.21" } +groovy2-bom = { module = "org.codehaus.groovy:groovy-bom", version = "2.5.23" } hamcrest = { module = "org.hamcrest:hamcrest", version = "3.0" } jackson-dataformat-yaml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml", version.ref = "jackson" } jackson-module-kotlin = { module = "com.fasterxml.jackson.module:jackson-module-kotlin", version.ref = "jackson" } From 213246ec269048327be76deba70af762e0fc867c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 01:24:01 +0000 Subject: [PATCH 055/611] Update dependency org.slf4j:slf4j-jdk14 to v2.0.16 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 98bd60916162..da24b6c8abb6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -59,7 +59,7 @@ opentest4j = { module = "org.opentest4j:opentest4j", version.ref = "opentest4j" openTestReporting-events = { module = "org.opentest4j.reporting:open-test-reporting-events", version.ref = "openTestReporting" } openTestReporting-tooling = { module = "org.opentest4j.reporting:open-test-reporting-tooling", version.ref = "openTestReporting" } picocli = { module = "info.picocli:picocli", version = "4.7.6" } -slf4j-julBinding = { module = "org.slf4j:slf4j-jdk14", version = "2.0.13" } +slf4j-julBinding = { module = "org.slf4j:slf4j-jdk14", version = "2.0.16" } spock1 = { module = "org.spockframework:spock-core", version = "1.3-groovy-2.5" } univocity-parsers = { module = "com.univocity:univocity-parsers", version = "2.9.1" } xmlunit-assertj = { module = "org.xmlunit:xmlunit-assertj3", version.ref = "xmlunit" } From 03c4b6ca3b220e2b6ff47b3e922e47491d1890d8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 03:50:44 +0000 Subject: [PATCH 056/611] Update plugin org.graalvm.buildtools.native to v0.10.3 --- .../projects/graalvm-starter/settings.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts b/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts index 7c15fd07d908..ef491d025954 100644 --- a/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts +++ b/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts @@ -1,6 +1,6 @@ pluginManagement { plugins { - id("org.graalvm.buildtools.native") version "0.10.2" + id("org.graalvm.buildtools.native") version "0.10.3" } repositories { mavenCentral() From 40109feb212a87e3c66ca1bdf54bea34c3fbb631 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 07:07:28 +0000 Subject: [PATCH 057/611] Update plugin org.jetbrains.kotlin.jvm to v1.9.25 --- .../projects/gradle-kotlin-extensions/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts b/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts index 51a6ffd269ad..ac2d236c6663 100644 --- a/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts +++ b/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts @@ -1,7 +1,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - kotlin("jvm") version "1.9.0" + kotlin("jvm") version "1.9.25" } repositories { From b2c22ce77166ea8609ff0d66cf08ec95e1a5578f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 07:08:07 +0000 Subject: [PATCH 058/611] Update dependency gradle to v8.10.1 --- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 68e8816d71c9..8e876e1c5571 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab -distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip +distributionSha256Sum=1541fa36599e12857140465f3c91a97409b4512501c26f9631fb113e392c5bd1 +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME From b1b357b8cb5a683db77a528f37af4f16d9b74510 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 07:07:44 +0000 Subject: [PATCH 059/611] Update plugin shadow to v8.3.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index da24b6c8abb6..4424dd3fcc8c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -91,6 +91,6 @@ gitPublish = { id = "org.ajoberstar.git-publish", version = "4.2.2" } jmh = { id = "me.champeau.jmh", version = "0.7.2" } nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" } plantuml = { id = "io.freefair.plantuml", version = "8.6" } -shadow = { id = "com.gradleup.shadow", version = "8.3.0" } +shadow = { id = "com.gradleup.shadow", version = "8.3.1" } spotless = { id = "com.diffplug.spotless", version = "7.0.0.BETA1" } versions = { id = "com.github.ben-manes.versions", version = "0.51.0" } From a2097b2bbc32c73dc90009f3cefe6f952d0a9a32 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 11 Sep 2024 09:45:39 +0200 Subject: [PATCH 060/611] Disable annotation processing when compiling JTE templates --- .../kotlin/junitbuild/generator/GenerateJreRelatedSourceCode.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/gradle/plugins/code-generator/src/main/kotlin/junitbuild/generator/GenerateJreRelatedSourceCode.kt b/gradle/plugins/code-generator/src/main/kotlin/junitbuild/generator/GenerateJreRelatedSourceCode.kt index b76ad39345d6..918bcd53c468 100644 --- a/gradle/plugins/code-generator/src/main/kotlin/junitbuild/generator/GenerateJreRelatedSourceCode.kt +++ b/gradle/plugins/code-generator/src/main/kotlin/junitbuild/generator/GenerateJreRelatedSourceCode.kt @@ -45,6 +45,7 @@ abstract class GenerateJreRelatedSourceCode : DefaultTask() { val codeResolver = DirectoryCodeResolver(templateDir.toPath()) val templateEngine = TemplateEngine.create(codeResolver, temporaryDir.toPath(), ContentType.Plain, javaClass.classLoader) + templateEngine.setCompileArgs("-proc:none") val templates = templateDir.walkTopDown() .filter { it.extension == "jte" } From e74f94b57ce6a712b6686450ec480d0b7f05514d Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 11 Sep 2024 16:10:03 +0200 Subject: [PATCH 061/611] Remove unused imports from integration test projects --- .../gradle-missing-engine/src/test/java/FooTests.java | 1 - .../src/test/java/com/example/project/DummyTests.java | 5 ----- .../integration/integration/JupiterIntegrationTests.java | 4 ---- 3 files changed, 10 deletions(-) diff --git a/platform-tooling-support-tests/projects/gradle-missing-engine/src/test/java/FooTests.java b/platform-tooling-support-tests/projects/gradle-missing-engine/src/test/java/FooTests.java index 97be110987fc..d389a1357fdf 100644 --- a/platform-tooling-support-tests/projects/gradle-missing-engine/src/test/java/FooTests.java +++ b/platform-tooling-support-tests/projects/gradle-missing-engine/src/test/java/FooTests.java @@ -10,7 +10,6 @@ */ import static org.junit.jupiter.api.Assertions.fail; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; class FooTests { diff --git a/platform-tooling-support-tests/projects/maven-surefire-compatibility/src/test/java/com/example/project/DummyTests.java b/platform-tooling-support-tests/projects/maven-surefire-compatibility/src/test/java/com/example/project/DummyTests.java index b9f8a24f46b0..4751e1f005c8 100644 --- a/platform-tooling-support-tests/projects/maven-surefire-compatibility/src/test/java/com/example/project/DummyTests.java +++ b/platform-tooling-support-tests/projects/maven-surefire-compatibility/src/test/java/com/example/project/DummyTests.java @@ -10,12 +10,7 @@ package com.example.project; -import static org.junit.jupiter.api.Assertions.assertEquals; - -import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.CsvSource; class DummyTests { diff --git a/platform-tooling-support-tests/projects/multi-release-jar/default/src/test/java/integration/integration/JupiterIntegrationTests.java b/platform-tooling-support-tests/projects/multi-release-jar/default/src/test/java/integration/integration/JupiterIntegrationTests.java index d3664cae5998..e5f363bc284c 100644 --- a/platform-tooling-support-tests/projects/multi-release-jar/default/src/test/java/integration/integration/JupiterIntegrationTests.java +++ b/platform-tooling-support-tests/projects/multi-release-jar/default/src/test/java/integration/integration/JupiterIntegrationTests.java @@ -11,7 +11,6 @@ package integration; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assumptions.assumeTrue; import static org.junit.platform.launcher.EngineFilter.includeEngines; import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; @@ -20,9 +19,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; import org.junit.platform.engine.discovery.DiscoverySelectors; -import org.junit.platform.engine.discovery.ModuleSelector; -import org.junit.platform.launcher.TestIdentifier; -import org.junit.platform.launcher.TestPlan; import org.junit.platform.launcher.core.LauncherFactory; @TestMethodOrder(Alphanumeric.class) From 971b60e41799023d6f8edcc4163f72f7eb52482f Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 11 Sep 2024 16:10:51 +0200 Subject: [PATCH 062/611] Configure Spotless to remove unused imports --- .../src/main/kotlin/junitbuild.spotless-conventions.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.spotless-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.spotless-conventions.gradle.kts index 0e7090705073..5af8f263d205 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.spotless-conventions.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.spotless-conventions.gradle.kts @@ -34,6 +34,7 @@ spotless { eclipse(majorMinorVersion).configFile(javaFormatterConfigFile) trimTrailingWhitespace() endWithNewline() + removeUnusedImports() } } From a82af6b91e2ffc7271b47c705bc057031ea5fb11 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 14:11:33 +0000 Subject: [PATCH 063/611] Update plugin spotless to v7.0.0.BETA2 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4424dd3fcc8c..b3e310ea499c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -92,5 +92,5 @@ jmh = { id = "me.champeau.jmh", version = "0.7.2" } nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" } plantuml = { id = "io.freefair.plantuml", version = "8.6" } shadow = { id = "com.gradleup.shadow", version = "8.3.1" } -spotless = { id = "com.diffplug.spotless", version = "7.0.0.BETA1" } +spotless = { id = "com.diffplug.spotless", version = "7.0.0.BETA2" } versions = { id = "com.github.ben-manes.versions", version = "0.51.0" } From 3a0ba62d96f99f714007f2ad6390b0ce9fa2385e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 15:57:28 +0000 Subject: [PATCH 064/611] Update dependency com.puppycrawl.tools:checkstyle to v10.18.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b3e310ea499c..a41122c5d203 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ asciidoctorj-pdf = "2.3.18" asciidoctor-plugins = "4.0.3" # Check if workaround in documentation.gradle.kts can be removed when upgrading assertj = "3.26.3" bnd = "7.0.0" -checkstyle = "10.17.0" +checkstyle = "10.18.1" eclipse = "4.32.0" jackson = "2.17.2" jacoco = "0.8.12" From 81d2152b498c2c676a111e58583803c81127e828 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 18:58:01 +0000 Subject: [PATCH 065/611] Update dependency org.apache.maven.plugins:maven-compiler-plugin to v3.13.0 --- platform-tooling-support-tests/projects/java-versions/pom.xml | 2 +- platform-tooling-support-tests/projects/maven-starter/pom.xml | 2 +- .../projects/maven-surefire-compatibility/pom.xml | 2 +- .../projects/multi-release-jar/default/pom.xml | 2 +- platform-tooling-support-tests/projects/vintage/pom.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/platform-tooling-support-tests/projects/java-versions/pom.xml b/platform-tooling-support-tests/projects/java-versions/pom.xml index 7123e267d45c..f4f3ddfd2cbf 100644 --- a/platform-tooling-support-tests/projects/java-versions/pom.xml +++ b/platform-tooling-support-tests/projects/java-versions/pom.xml @@ -33,7 +33,7 @@ maven-compiler-plugin - 3.8.1 + 3.13.0 1.8 1.8 diff --git a/platform-tooling-support-tests/projects/maven-starter/pom.xml b/platform-tooling-support-tests/projects/maven-starter/pom.xml index 18b577f81a4e..b65aec64a043 100644 --- a/platform-tooling-support-tests/projects/maven-starter/pom.xml +++ b/platform-tooling-support-tests/projects/maven-starter/pom.xml @@ -43,7 +43,7 @@ maven-compiler-plugin - 3.8.1 + 3.13.0 maven-surefire-plugin diff --git a/platform-tooling-support-tests/projects/maven-surefire-compatibility/pom.xml b/platform-tooling-support-tests/projects/maven-surefire-compatibility/pom.xml index 58f907ab1e05..5ad18aa4522b 100644 --- a/platform-tooling-support-tests/projects/maven-surefire-compatibility/pom.xml +++ b/platform-tooling-support-tests/projects/maven-surefire-compatibility/pom.xml @@ -38,7 +38,7 @@ maven-compiler-plugin - 3.8.1 + 3.13.0 maven-surefire-plugin diff --git a/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml b/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml index 551fc455eb3f..e76513937258 100644 --- a/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml +++ b/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml @@ -34,7 +34,7 @@ maven-compiler-plugin - 3.8.1 + 3.13.0 11 diff --git a/platform-tooling-support-tests/projects/vintage/pom.xml b/platform-tooling-support-tests/projects/vintage/pom.xml index 11f500cd1e1c..74d3bc4b67bd 100644 --- a/platform-tooling-support-tests/projects/vintage/pom.xml +++ b/platform-tooling-support-tests/projects/vintage/pom.xml @@ -39,7 +39,7 @@ maven-compiler-plugin - 3.8.1 + 3.13.0 maven-surefire-plugin From a97af4fab5b52dcc586eec88eebdda4095cea85e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 23:03:04 +0000 Subject: [PATCH 066/611] Update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.5.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a41122c5d203..95c2d8232a19 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -16,7 +16,7 @@ ktlint = "1.3.1" log4j = "2.23.1" opentest4j = "1.3.0" openTestReporting = "0.1.0-M2" -surefire = "3.3.1" +surefire = "3.5.0" xmlunit = "2.10.0" [libraries] From 750ca12140ce8466cacddf1b42d728b16b797aa3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 12 Sep 2024 00:54:34 +0000 Subject: [PATCH 067/611] Update dependency org.mockito:mockito-junit-jupiter to v5.13.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 95c2d8232a19..8e6f26b2116a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -53,7 +53,7 @@ log4j-jul = { module = "org.apache.logging.log4j:log4j-jul", version.ref = "log4 maven = { module = "org.apache.maven:apache-maven", version = "3.9.9" } mavenSurefirePlugin = { module = "org.apache.maven.plugins:maven-surefire-plugin", version.ref = "surefire" } memoryfilesystem = { module = "com.github.marschall:memoryfilesystem", version = "2.8.0" } -mockito = { module = "org.mockito:mockito-junit-jupiter", version = "5.12.0" } +mockito = { module = "org.mockito:mockito-junit-jupiter", version = "5.13.0" } nohttp-checkstyle = { module = "io.spring.nohttp:nohttp-checkstyle", version = "0.0.11" } opentest4j = { module = "org.opentest4j:opentest4j", version.ref = "opentest4j" } openTestReporting-events = { module = "org.opentest4j.reporting:open-test-reporting-events", version.ref = "openTestReporting" } From 5cd668eb96248b2782de9eb97c7f8f1066d094b7 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 12 Sep 2024 07:46:41 +0200 Subject: [PATCH 068/611] Centralize repository declarations for custom Gradle plugins --- gradle/plugins/code-generator/build.gradle.kts | 4 ---- gradle/plugins/common/build.gradle.kts | 4 ---- gradle/plugins/settings.gradle.kts | 3 +++ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/gradle/plugins/code-generator/build.gradle.kts b/gradle/plugins/code-generator/build.gradle.kts index d317808a7142..e9f2ef657e47 100644 --- a/gradle/plugins/code-generator/build.gradle.kts +++ b/gradle/plugins/code-generator/build.gradle.kts @@ -2,10 +2,6 @@ plugins { `kotlin-dsl` } -repositories { - gradlePluginPortal() -} - dependencies { implementation("junitbuild.base:code-generator-model") implementation(projects.common) diff --git a/gradle/plugins/common/build.gradle.kts b/gradle/plugins/common/build.gradle.kts index 0a93c96c0fee..6015360a7105 100644 --- a/gradle/plugins/common/build.gradle.kts +++ b/gradle/plugins/common/build.gradle.kts @@ -2,10 +2,6 @@ plugins { `kotlin-dsl` } -repositories { - gradlePluginPortal() -} - dependencies { implementation(projects.buildParameters) implementation(kotlin("gradle-plugin")) diff --git a/gradle/plugins/settings.gradle.kts b/gradle/plugins/settings.gradle.kts index 728290a2cad6..41935db0aa36 100644 --- a/gradle/plugins/settings.gradle.kts +++ b/gradle/plugins/settings.gradle.kts @@ -4,6 +4,9 @@ dependencyResolutionManagement { from(files("../libs.versions.toml")) } } + repositories { + gradlePluginPortal() + } } rootProject.name = "plugins" From c4fae49296eaf9feade28827bb734c3a04ebb3c5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 12 Sep 2024 05:47:44 +0000 Subject: [PATCH 069/611] Update log4j2 monorepo to v2.24.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8e6f26b2116a..539d73925231 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -13,7 +13,7 @@ jmh = "1.37" junit4 = "4.13.2" junit4Min = "4.12" ktlint = "1.3.1" -log4j = "2.23.1" +log4j = "2.24.0" opentest4j = "1.3.0" openTestReporting = "0.1.0-M2" surefire = "3.5.0" From b3f008567ef2714d02875a9074f1ccd145921b5b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 12 Sep 2024 06:19:08 +0000 Subject: [PATCH 070/611] Update plugin develocity to v3.18.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 539d73925231..98403b1a3679 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -85,7 +85,7 @@ asciidoctorPdf = { id = "org.asciidoctor.jvm.pdf", version.ref = "asciidoctor-pl bnd = { id = "biz.aQute.bnd", version.ref = "bnd" } buildParameters = { id = "org.gradlex.build-parameters", version = "1.4.4" } commonCustomUserData = { id = "com.gradle.common-custom-user-data-gradle-plugin", version = "2.0.2" } -develocity = { id = "com.gradle.develocity", version = "3.17.6" } +develocity = { id = "com.gradle.develocity", version = "3.18.1" } foojayResolver = { id = "org.gradle.toolchains.foojay-resolver", version = "0.8.0" } gitPublish = { id = "org.ajoberstar.git-publish", version = "4.2.2" } jmh = { id = "me.champeau.jmh", version = "0.7.2" } From 75df5b8d789f17d4547406c26000e6ca57d5ce57 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 12 Sep 2024 09:09:28 +0200 Subject: [PATCH 071/611] Delete Eclipse JDT rule Can be handled by closing the Renovate PR for that version --- .github/renovate.json5 | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 153557ce6b10..bc5b52e8cbfe 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -32,14 +32,5 @@ 'org.opentest4j.reporting:{/,}**', ], }, - { - allowedVersions: '!/4\\.33\\.0/', - description: [ - 'Due to https://github.com/diffplug/spotless/issues/2255', - ], - matchPackageNames: [ - 'org.eclipse.platform:{/,}**' - ] - }, ], } From 65aa610a325ec1b5b4f1c812b439763ea8f79443 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 12 Sep 2024 09:20:30 +0200 Subject: [PATCH 072/611] Reference org-level config preset --- .github/renovate.json5 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index bc5b52e8cbfe..ea024d3d17e6 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -1,8 +1,7 @@ { $schema: 'https://docs.renovatebot.com/renovate-schema.json', extends: [ - 'config:best-practices', - ':automergeAll', + 'github>junit-team/renovate-config', ], packageRules: [ { From 9f5cfc9ee6da1198c38c83a2cd22c31b9f5c2e59 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 12 Sep 2024 16:14:23 +0200 Subject: [PATCH 073/611] Polish test --- ...lHierarchicalTestExecutorServiceTests.java | 26 +++++++------------ 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java index b9544248f077..79120bf40d17 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java @@ -11,32 +11,24 @@ package org.junit.platform.engine.support.hierarchical; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.Mockito.when; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; import org.junit.platform.commons.JUnitException; -import org.mockito.Mock; -import org.mockito.junit.jupiter.MockitoExtension; -@ExtendWith(MockitoExtension.class) class ForkJoinPoolHierarchicalTestExecutorServiceTests { - @Mock - ParallelExecutionConfiguration configuration; - @Test void exceptionsFromInvalidConfigurationAreNotSwallowed() { - when(configuration.getParallelism()).thenReturn(2); - when(configuration.getMaxPoolSize()).thenReturn(1); // invalid, should be > parallelism - when(configuration.getCorePoolSize()).thenReturn(1); - when(configuration.getMinimumRunnable()).thenReturn(1); - when(configuration.getSaturatePredicate()).thenReturn(__ -> true); - when(configuration.getKeepAliveSeconds()).thenReturn(0); - - JUnitException exception = assertThrows(JUnitException.class, - () -> new ForkJoinPoolHierarchicalTestExecutorService(configuration)); + var configuration = new DefaultParallelExecutionConfiguration(2, 1, 1, 1, 0, __ -> true); + + JUnitException exception = assertThrows(JUnitException.class, () -> { + try (var pool = new ForkJoinPoolHierarchicalTestExecutorService(configuration)) { + assertNotNull(pool, "we won't get here"); + } + }); + assertThat(exception).hasMessage("Failed to create ForkJoinPool"); assertThat(exception).rootCause().isInstanceOf(IllegalArgumentException.class); } From eb5b398f7bbf4b53a6384b6cdb37ec9c01fb5bf3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 13 Sep 2024 03:36:09 +0000 Subject: [PATCH 074/611] Update gradle/actions digest to d156388 --- .github/actions/run-gradle/action.yml | 2 +- .github/workflows/gradle-dependency-submission.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/run-gradle/action.yml b/.github/actions/run-gradle/action.yml index e825551ce6f5..f0ba06a50fd0 100644 --- a/.github/actions/run-gradle/action.yml +++ b/.github/actions/run-gradle/action.yml @@ -14,7 +14,7 @@ runs: distribution: temurin java-version: 21 check-latest: true - - uses: gradle/actions/setup-gradle@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4 + - uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # v4 - shell: bash env: JAVA_HOME: ${{ steps.setup-gradle-jdk.outputs.path }} diff --git a/.github/workflows/gradle-dependency-submission.yml b/.github/workflows/gradle-dependency-submission.yml index c867584a5835..a2f98e37c62e 100644 --- a/.github/workflows/gradle-dependency-submission.yml +++ b/.github/workflows/gradle-dependency-submission.yml @@ -24,4 +24,4 @@ jobs: java-version: 21 check-latest: true - name: Generate and submit dependency graph - uses: gradle/actions/dependency-submission@16bf8bc8fe830fa669c3c9f914d3eb147c629707 # v4 + uses: gradle/actions/dependency-submission@d156388eb19639ec20ade50009f3d199ce1e2808 # v4 From c04cdc83bc87d1f579275a6d4c1471a1be56c919 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 13 Sep 2024 08:30:24 +0000 Subject: [PATCH 075/611] Update plugin org.jetbrains.kotlin.jvm to v2 --- .../projects/gradle-kotlin-extensions/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts b/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts index ac2d236c6663..1811e4793aaf 100644 --- a/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts +++ b/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts @@ -1,7 +1,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - kotlin("jvm") version "1.9.25" + kotlin("jvm") version "2.0.20" } repositories { From bd7a374681540ffd00db7fa2c904a67e5b030cba Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 13 Sep 2024 08:30:19 +0000 Subject: [PATCH 076/611] Update dependency org.apache.maven.plugins:maven-surefire-plugin to v3 --- platform-tooling-support-tests/projects/java-versions/pom.xml | 2 +- platform-tooling-support-tests/projects/maven-starter/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform-tooling-support-tests/projects/java-versions/pom.xml b/platform-tooling-support-tests/projects/java-versions/pom.xml index f4f3ddfd2cbf..5714dfc34e46 100644 --- a/platform-tooling-support-tests/projects/java-versions/pom.xml +++ b/platform-tooling-support-tests/projects/java-versions/pom.xml @@ -41,7 +41,7 @@ maven-surefire-plugin - 2.22.2 + 3.5.0 diff --git a/platform-tooling-support-tests/projects/maven-starter/pom.xml b/platform-tooling-support-tests/projects/maven-starter/pom.xml index b65aec64a043..166263dd1765 100644 --- a/platform-tooling-support-tests/projects/maven-starter/pom.xml +++ b/platform-tooling-support-tests/projects/maven-starter/pom.xml @@ -47,7 +47,7 @@ maven-surefire-plugin - 2.22.2 + 3.5.0 From 77924aaa92b90926381c0fcb4fd9141eafc2c2eb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 13 Sep 2024 08:30:15 +0000 Subject: [PATCH 077/611] Update plugin plantuml to v8.10 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 98403b1a3679..b33f2015171b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -90,7 +90,7 @@ foojayResolver = { id = "org.gradle.toolchains.foojay-resolver", version = "0.8. gitPublish = { id = "org.ajoberstar.git-publish", version = "4.2.2" } jmh = { id = "me.champeau.jmh", version = "0.7.2" } nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" } -plantuml = { id = "io.freefair.plantuml", version = "8.6" } +plantuml = { id = "io.freefair.plantuml", version = "8.10" } shadow = { id = "com.gradleup.shadow", version = "8.3.1" } spotless = { id = "com.diffplug.spotless", version = "7.0.0.BETA2" } versions = { id = "com.github.ben-manes.versions", version = "0.51.0" } From 097adb00acdfae992cb57c55dcb96bed3efd1d82 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 13 Sep 2024 08:30:10 +0000 Subject: [PATCH 078/611] Update dependency org.eclipse.platform:org.eclipse.platform to v4.33.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b33f2015171b..77092a2b266d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ asciidoctor-plugins = "4.0.3" # Check if workaround in documentation.gradle.kts assertj = "3.26.3" bnd = "7.0.0" checkstyle = "10.18.1" -eclipse = "4.32.0" +eclipse = "4.33.0" jackson = "2.17.2" jacoco = "0.8.12" jmh = "1.37" From 1d1c6d547293a1556238e814fb7d01e97c09a9c6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 13 Sep 2024 08:30:04 +0000 Subject: [PATCH 079/611] Update dependency org.apache.groovy:groovy to v4.0.23 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 77092a2b266d..ca393ee6daf4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -34,7 +34,7 @@ bndlib = { module = "biz.aQute.bnd:biz.aQute.bndlib", version.ref = "bnd" } checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checkstyle" } classgraph = { module = "io.github.classgraph:classgraph", version = "4.8.175" } commons-io = { module = "commons-io:commons-io", version = "2.16.1" } -groovy4 = { module = "org.apache.groovy:groovy", version = "4.0.22" } +groovy4 = { module = "org.apache.groovy:groovy", version = "4.0.23" } groovy2-bom = { module = "org.codehaus.groovy:groovy-bom", version = "2.5.23" } hamcrest = { module = "org.hamcrest:hamcrest", version = "3.0" } jackson-dataformat-yaml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml", version.ref = "jackson" } From 3e2cc6cac1151ced3286cf0039123dd577e57f12 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Fri, 13 Sep 2024 16:11:28 +0200 Subject: [PATCH 080/611] Ensure TestWatchers can access data in the ExtensionContext.Store Changes made in conjunction with #3614 resulted in an exception being thrown if a NamespacedHierarchicalStore was queried after it had been closed. Consequently, TestWatcher callbacks were no longer able to access data in the Store. To fix that regression, this commit revises NamespacedHierarchicalStore so that it no longer throws an exception after it has been closed if the store is queried via one of the get(...) or getOrComputeIfAbsent(...) methods; however, if a getOrComputeIfAbsent(...) invocation results in the computation of a new value, an exception will still be thrown. In other words, when a NamespacedHierarchicalStore is closed, it now effectively switches to ready-only mode. See: #3614 Fixes: #3944 --- .../release-notes/release-notes-5.11.1.adoc | 7 ++- .../store/NamespacedHierarchicalStore.java | 9 ++-- .../engine/extension/TestWatcherTests.java | 51 +++++++++++++++++++ .../NamespacedHierarchicalStoreTests.java | 27 ++++++---- 4 files changed, 78 insertions(+), 16 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc index 80f58d56d747..41114a7b0230 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc @@ -18,6 +18,10 @@ on GitHub. * Fixed potential locking issue with `ExclusiveResource` in the `HierarchicalTestExecutorService`, which could lead to deadlocks in certain scenarios. +* `NamespacedHierarchicalStore` no longer throws an exception after it has been closed if + the store is queried via one of the `get(...)` or `getOrComputeIfAbsent(...)` methods; + however, if a `getOrComputeIfAbsent(...)` invocation results in the computation of a new + value, an exception will still be thrown. [[release-notes-5.11.1-junit-platform-deprecations-and-breaking-changes]] ==== Deprecations and Breaking Changes @@ -37,7 +41,8 @@ on GitHub. [[release-notes-5.11.1-junit-jupiter-bug-fixes]] ==== Bug Fixes -* ❓ +* `TestWatcher` callback methods can once again access data in the + `ExtensionContext.Store`. [[release-notes-5.11.1-junit-jupiter-deprecations-and-breaking-changes]] ==== Deprecations and Breaking Changes diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/store/NamespacedHierarchicalStore.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/store/NamespacedHierarchicalStore.java index 965eb9b24439..79836ac6f501 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/store/NamespacedHierarchicalStore.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/store/NamespacedHierarchicalStore.java @@ -139,7 +139,6 @@ public void close() { * closed */ public Object get(N namespace, Object key) { - rejectIfClosed(); StoredValue storedValue = getStoredValue(new CompositeKey<>(namespace, key)); return StoredValue.evaluateIfNotNull(storedValue); } @@ -156,7 +155,6 @@ public Object get(N namespace, Object key) { * be cast to the required type, or if this store has already been closed */ public T get(N namespace, Object key, Class requiredType) throws NamespacedHierarchicalStoreException { - rejectIfClosed(); Object value = get(namespace, key); return castToRequiredType(key, value, requiredType); } @@ -174,13 +172,15 @@ public T get(N namespace, Object key, Class requiredType) throws Namespac * closed */ public Object getOrComputeIfAbsent(N namespace, K key, Function defaultCreator) { - rejectIfClosed(); Preconditions.notNull(defaultCreator, "defaultCreator must not be null"); CompositeKey compositeKey = new CompositeKey<>(namespace, key); StoredValue storedValue = getStoredValue(compositeKey); if (storedValue == null) { storedValue = this.storedValues.computeIfAbsent(compositeKey, - __ -> storedValue(new MemoizingSupplier(() -> defaultCreator.apply(key)))); + __ -> storedValue(new MemoizingSupplier(() -> { + rejectIfClosed(); + return defaultCreator.apply(key); + }))); } return storedValue.evaluate(); } @@ -202,7 +202,6 @@ public Object getOrComputeIfAbsent(N namespace, K key, Function def public V getOrComputeIfAbsent(N namespace, K key, Function defaultCreator, Class requiredType) throws NamespacedHierarchicalStoreException { - rejectIfClosed(); Object value = getOrComputeIfAbsent(namespace, key, defaultCreator); return castToRequiredType(key, value, requiredType); } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestWatcherTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestWatcherTests.java index 27ca3d2d77c9..a8400aa63ba3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestWatcherTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestWatcherTests.java @@ -12,6 +12,7 @@ import static java.util.function.Predicate.not; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.entry; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; @@ -41,8 +42,11 @@ import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.TestInstance.Lifecycle; import org.junit.jupiter.api.TestMethodOrder; +import org.junit.jupiter.api.extension.BeforeTestExecutionCallback; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.ExtensionContext.Namespace; +import org.junit.jupiter.api.extension.ExtensionContext.Store; import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.api.extension.TestWatcher; import org.junit.jupiter.api.fixtures.TrackLogRecords; @@ -67,6 +71,7 @@ class TestWatcherTests extends AbstractJupiterTestEngineTests { @BeforeEach void clearResults() { TrackingTestWatcher.results.clear(); + DataRetrievingTestWatcher.results.clear(); } @Test @@ -167,6 +172,16 @@ void testWatcherSemanticsWhenRegisteredAtMethodLevel() { assertThat(TrackingTestWatcher.results.get("testDisabled")).containsExactly("test", "repeatedTest"); } + @Test + void testWatcherCanRetrieveDataFromTheExtensionContextStore() { + Class testClass = DataRetrievingTestWatcherTestCase.class; + EngineExecutionResults results = executeTestsForClass(testClass); + + results.testEvents().assertStatistics(stats -> stats.started(1).succeeded(1).failed(0)); + + assertThat(DataRetrievingTestWatcher.results).containsExactly(entry("key", "enigma")); + } + private void assertCommonStatistics(EngineExecutionResults results) { results.containerEvents().assertStatistics(stats -> stats.started(3).succeeded(3).failed(0)); results.testEvents().assertStatistics(stats -> stats.skipped(2).started(6).succeeded(2).aborted(2).failed(2)); @@ -414,4 +429,40 @@ public void testFailed(ExtensionContext context, Throwable cause) { } + /** + * {@link TestWatcher} that retrieves data from the {@link ExtensionContext.Store}. + * @see #3944 + */ + static class DataRetrievingTestWatcher implements BeforeTestExecutionCallback, TestWatcher { + + private static final Namespace NAMESPACE = Namespace.create(DataRetrievingTestWatcher.class); + + private static final String KEY = "key"; + + private static final Map results = new HashMap<>(); + + @Override + public void beforeTestExecution(ExtensionContext context) throws Exception { + getStore(context).put(KEY, "enigma"); + } + + @Override + public void testSuccessful(ExtensionContext context) { + results.put(KEY, getStore(context).get(KEY, String.class)); + } + + private static Store getStore(ExtensionContext context) { + return context.getStore(NAMESPACE); + } + } + + @ExtendWith(DataRetrievingTestWatcher.class) + static class DataRetrievingTestWatcherTestCase { + + @Test + public void test() { + //no-op + } + } + } diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/store/NamespacedHierarchicalStoreTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/store/NamespacedHierarchicalStoreTests.java index 9f18083a924c..f234ff11dbe3 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/store/NamespacedHierarchicalStoreTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/store/NamespacedHierarchicalStoreTests.java @@ -519,28 +519,35 @@ void closeIsIdempotent() throws Throwable { verifyNoMoreInteractions(closeAction); } + /** + * @see #3944 + */ @Test - void rejectsModificationAfterClose() { + void acceptsQueryAfterClose() { + store.put(namespace, key, value); store.close(); assertClosed(); - assertThrows(NamespacedHierarchicalStoreException.class, () -> store.put(namespace, "key1", "value1")); - assertThrows(NamespacedHierarchicalStoreException.class, () -> store.remove(namespace, "key1")); - assertThrows(NamespacedHierarchicalStoreException.class, - () -> store.remove(namespace, "key1", Number.class)); + assertThat(store.get(namespace, key)).isEqualTo(value); + assertThat(store.get(namespace, key, String.class)).isEqualTo(value); + assertThat(store.getOrComputeIfAbsent(namespace, key, k -> "new")).isEqualTo(value); + assertThat(store.getOrComputeIfAbsent(namespace, key, k -> "new", String.class)).isEqualTo(value); } @Test - void rejectsQueryAfterClose() { + void rejectsModificationAfterClose() { store.close(); assertClosed(); - assertThrows(NamespacedHierarchicalStoreException.class, () -> store.get(namespace, "key1")); - assertThrows(NamespacedHierarchicalStoreException.class, () -> store.get(namespace, "key1", Integer.class)); + assertThrows(NamespacedHierarchicalStoreException.class, () -> store.put(namespace, key, value)); + assertThrows(NamespacedHierarchicalStoreException.class, () -> store.remove(namespace, key)); + assertThrows(NamespacedHierarchicalStoreException.class, () -> store.remove(namespace, key, int.class)); + + // Since key does not exist, an invocation of getOrComputeIfAbsent(...) will attempt to compute a new value. assertThrows(NamespacedHierarchicalStoreException.class, - () -> store.getOrComputeIfAbsent(namespace, "key1", k -> "value")); + () -> store.getOrComputeIfAbsent(namespace, key, k -> "new")); assertThrows(NamespacedHierarchicalStoreException.class, - () -> store.getOrComputeIfAbsent(namespace, "key1", k -> 1337, Integer.class)); + () -> store.getOrComputeIfAbsent(namespace, key, k -> "new", String.class)); } private void assertNotClosed() { From 9e544025b0b1c1064bd83175e1829e8d21875621 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 13 Sep 2024 14:26:28 +0000 Subject: [PATCH 081/611] Update github/codeql-action digest to 8214744 --- .github/workflows/codeql-analysis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 133179e59c25..dd0e5c3f69b9 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -32,7 +32,7 @@ jobs: - name: Check out repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - name: Initialize CodeQL - uses: github/codeql-action/init@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3 + uses: github/codeql-action/init@8214744c546c1e5c8f03dde8fab3a7353211988d # v3 with: languages: ${{ matrix.language }} tools: latest @@ -44,4 +44,4 @@ jobs: -Dscan.tag.CodeQL \ allMainClasses - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@4dd16135b69a43b6c8efb853346f8437d92d3c93 # v3 + uses: github/codeql-action/analyze@8214744c546c1e5c8f03dde8fab3a7353211988d # v3 From da8eb5f18d09d4ca8ba0b87e7fae0160d8c64958 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 13 Sep 2024 15:00:53 +0000 Subject: [PATCH 082/611] Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-core to v1.9.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ca393ee6daf4..b5a293598d9d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -47,7 +47,7 @@ jmh-generator-annprocess = { module = "org.openjdk.jmh:jmh-generator-annprocess" joox = { module = "org.jooq:joox", version = "2.0.1" } jte = { module = "gg.jte:jte", version = "3.1.12" } junit4 = { module = "junit:junit", version = { require = "[4.12,)", prefer = "4.13.2" } } -kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.8.1" } +kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.9.0" } log4j-core = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j" } log4j-jul = { module = "org.apache.logging.log4j:log4j-jul", version.ref = "log4j" } maven = { module = "org.apache.maven:apache-maven", version = "3.9.9" } From f5cea9e032954933bc3e401ece67040e21c0c9fa Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 16 Sep 2024 17:39:16 +0200 Subject: [PATCH 083/611] Revert "Update dependency org.eclipse.platform:org.eclipse.platform to v4.33.0" This reverts commit 097adb00acdfae992cb57c55dcb96bed3efd1d82. --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b5a293598d9d..a282cf48cb7b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ asciidoctor-plugins = "4.0.3" # Check if workaround in documentation.gradle.kts assertj = "3.26.3" bnd = "7.0.0" checkstyle = "10.18.1" -eclipse = "4.33.0" +eclipse = "4.32.0" jackson = "2.17.2" jacoco = "0.8.12" jmh = "1.37" From 88f88591abc9900a3e30f0c3a9fca524b5c0f8b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonard=20Br=C3=BCnings?= Date: Tue, 17 Sep 2024 10:58:05 +0200 Subject: [PATCH 084/611] Fix deadlock in `ForkJoinPoolHierarchicalTestExecutorService` (#3981) The service now checks if the `ExclusiveTask` that should run is executed on a thread that is already executing another task. If this is scenario is detected, it checks if the lock is compatible to the enclosing locks. 1. If compatible, it is executed and marked done 2. If incompatible, it is added to a list of deferred tasks and left unfinished. The deferred tasks will be re-forked afterwards. Fixes #3945. --------- Co-authored-by: Marc Philipp --- .../support/hierarchical/CompositeLock.java | 4 +- ...inPoolHierarchicalTestExecutorService.java | 110 ++++++++++- .../support/hierarchical/LockManager.java | 42 +++- .../support/hierarchical/NodeTestTask.java | 5 + .../support/hierarchical/ResourceLock.java | 8 + .../support/hierarchical/SingleLock.java | 16 ++ .../hierarchical/ForkJoinDeadLockTests.java | 179 ++++++++++++++++++ ...lHierarchicalTestExecutorServiceTests.java | 97 ++++++++++ .../hierarchical/LockManagerTests.java | 28 ++- .../hierarchical/ResourceLockTests.java | 82 ++++++++ 10 files changed, 549 insertions(+), 22 deletions(-) create mode 100644 platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinDeadLockTests.java create mode 100644 platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ResourceLockTests.java diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/CompositeLock.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/CompositeLock.java index 3718d82a64fc..b09f1236f570 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/CompositeLock.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/CompositeLock.java @@ -15,6 +15,8 @@ import java.util.concurrent.ForkJoinPool; import java.util.concurrent.locks.Lock; +import org.junit.platform.commons.util.Preconditions; + /** * @since 1.3 */ @@ -23,7 +25,7 @@ class CompositeLock implements ResourceLock { private final List locks; CompositeLock(List locks) { - this.locks = locks; + this.locks = Preconditions.notEmpty(locks, "Locks must not be empty"); } // for tests only diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorService.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorService.java index 09afd8df3eb7..9b5d2efea14c 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorService.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorService.java @@ -16,6 +16,8 @@ import java.lang.Thread.UncaughtExceptionHandler; import java.lang.reflect.Constructor; +import java.util.ArrayDeque; +import java.util.ArrayList; import java.util.Deque; import java.util.LinkedList; import java.util.List; @@ -26,7 +28,6 @@ import java.util.concurrent.ForkJoinTask; import java.util.concurrent.ForkJoinWorkerThread; import java.util.concurrent.Future; -import java.util.concurrent.RecursiveAction; import java.util.concurrent.TimeUnit; import java.util.function.Function; import java.util.function.Predicate; @@ -51,7 +52,9 @@ public class ForkJoinPoolHierarchicalTestExecutorService implements HierarchicalTestExecutorService { private final ForkJoinPool forkJoinPool; + private final TaskEventListener taskEventListener; private final int parallelism; + private final ThreadLocal threadLocks = ThreadLocal.withInitial(ThreadLock::new); /** * Create a new {@code ForkJoinPoolHierarchicalTestExecutorService} based on @@ -71,7 +74,13 @@ public ForkJoinPoolHierarchicalTestExecutorService(ConfigurationParameters confi */ @API(status = STABLE, since = "1.10") public ForkJoinPoolHierarchicalTestExecutorService(ParallelExecutionConfiguration configuration) { + this(configuration, TaskEventListener.NOOP); + } + + ForkJoinPoolHierarchicalTestExecutorService(ParallelExecutionConfiguration configuration, + TaskEventListener taskEventListener) { forkJoinPool = createForkJoinPool(configuration); + this.taskEventListener = taskEventListener; parallelism = forkJoinPool.getParallelism(); LoggerFactory.getLogger(getClass()).config(() -> "Using ForkJoinPool with parallelism of " + parallelism); } @@ -132,7 +141,7 @@ public Future submit(TestTask testTask) { if (testTask.getExecutionMode() == CONCURRENT && ForkJoinTask.getSurplusQueuedTaskCount() < parallelism) { return exclusiveTask.fork(); } - exclusiveTask.compute(); + exclusiveTask.execSync(); return completedFuture(null); } @@ -143,7 +152,7 @@ private boolean isAlreadyRunningInForkJoinPool() { @Override public void invokeAll(List tasks) { if (tasks.size() == 1) { - new ExclusiveTask(tasks.get(0)).compute(); + new ExclusiveTask(tasks.get(0)).execSync(); return; } Deque nonConcurrentTasks = new LinkedList<>(); @@ -169,7 +178,7 @@ private void forkConcurrentTasks(List tasks, Deque nonConcurrentTasks) { for (ExclusiveTask task : nonConcurrentTasks) { - task.compute(); + task.execSync(); } } @@ -177,7 +186,18 @@ private void joinConcurrentTasksInReverseOrderToEnableWorkStealing( Deque concurrentTasksInReverseOrder) { for (ExclusiveTask forkedTask : concurrentTasksInReverseOrder) { forkedTask.join(); + resubmitDeferredTasks(); + } + } + + private void resubmitDeferredTasks() { + List deferredTasks = threadLocks.get().deferredTasks; + for (ExclusiveTask deferredTask : deferredTasks) { + if (!deferredTask.isDone()) { + deferredTask.fork(); + } } + deferredTasks.clear(); } @Override @@ -186,8 +206,8 @@ public void close() { } // this class cannot not be serialized because TestTask is not Serializable - @SuppressWarnings("serial") - static class ExclusiveTask extends RecursiveAction { + @SuppressWarnings({ "serial", "RedundantSuppression" }) + class ExclusiveTask extends ForkJoinTask { private final TestTask testTask; @@ -195,17 +215,61 @@ static class ExclusiveTask extends RecursiveAction { this.testTask = testTask; } + /** + * Always returns {@code null}. + * + * @return {@code null} always + */ + public final Void getRawResult() { + return null; + } + + /** + * Requires null completion value. + */ + protected final void setRawResult(Void mustBeNull) { + } + + void execSync() { + boolean completed = exec(); + if (!completed) { + throw new IllegalStateException( + "Task was deferred but should have been executed synchronously: " + testTask); + } + } + @SuppressWarnings("try") @Override - public void compute() { - try (ResourceLock lock = testTask.getResourceLock().acquire()) { + public boolean exec() { + // Check if this task is compatible with the current resource lock, if there is any. + // If not, we put this task in the thread local as a deferred task + // and let the worker thread fork it once it is done with the current task. + ResourceLock resourceLock = testTask.getResourceLock(); + ThreadLock threadLock = threadLocks.get(); + if (!threadLock.areAllHeldLocksCompatibleWith(resourceLock)) { + threadLock.addDeferredTask(this); + taskEventListener.deferred(testTask); + // Return false to indicate that this task is not done yet + // this means that .join() will wait. + return false; + } + try (ResourceLock lock = resourceLock.acquire()) { + threadLock.incrementNesting(lock); testTask.execute(); + return true; } catch (InterruptedException e) { throw ExceptionUtils.throwAsUncheckedException(e); } + finally { + threadLock.decrementNesting(); + } } + @Override + public String toString() { + return "ExclusiveTask [" + testTask + "]"; + } } static class WorkerThreadFactory implements ForkJoinPool.ForkJoinWorkerThreadFactory { @@ -228,4 +292,34 @@ static class WorkerThread extends ForkJoinWorkerThread { } + static class ThreadLock { + private final Deque locks = new ArrayDeque<>(2); + private final List deferredTasks = new ArrayList<>(); + + void addDeferredTask(ExclusiveTask task) { + deferredTasks.add(task); + } + + void incrementNesting(ResourceLock lock) { + locks.push(lock); + } + + @SuppressWarnings("resource") + void decrementNesting() { + locks.pop(); + } + + boolean areAllHeldLocksCompatibleWith(ResourceLock lock) { + return locks.stream().allMatch(l -> l.isCompatible(lock)); + } + } + + interface TaskEventListener { + + TaskEventListener NOOP = __ -> { + }; + + void deferred(TestTask testTask); + } + } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/LockManager.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/LockManager.java index 223f7873525d..be997dc5715a 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/LockManager.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/LockManager.java @@ -10,12 +10,16 @@ package org.junit.platform.engine.support.hierarchical; +import static java.util.Collections.emptyList; +import static java.util.Collections.singletonList; import static java.util.Comparator.comparing; import static java.util.Comparator.naturalOrder; import static java.util.stream.Collectors.groupingBy; import static java.util.stream.Collectors.toList; import static org.junit.platform.commons.util.CollectionUtils.getOnlyElement; import static org.junit.platform.engine.support.hierarchical.ExclusiveResource.GLOBAL_KEY; +import static org.junit.platform.engine.support.hierarchical.ExclusiveResource.GLOBAL_READ; +import static org.junit.platform.engine.support.hierarchical.ExclusiveResource.GLOBAL_READ_WRITE; import static org.junit.platform.engine.support.hierarchical.ExclusiveResource.LockMode.READ; import java.util.Collection; @@ -28,6 +32,9 @@ import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; +import org.junit.platform.engine.support.hierarchical.SingleLock.GlobalReadLock; +import org.junit.platform.engine.support.hierarchical.SingleLock.GlobalReadWriteLock; + /** * @since 1.3 */ @@ -42,20 +49,29 @@ private static Comparator globalKeyFirst() { } private final Map locksByKey = new ConcurrentHashMap<>(); + private final GlobalReadLock globalReadLock; + private final GlobalReadWriteLock globalReadWriteLock; + + public LockManager() { + globalReadLock = new GlobalReadLock(toLock(GLOBAL_READ)); + globalReadWriteLock = new GlobalReadWriteLock(toLock(GLOBAL_READ_WRITE)); + } ResourceLock getLockForResources(Collection resources) { - if (resources.size() == 1) { - return getLockForResource(getOnlyElement(resources)); - } - List locks = getDistinctSortedLocks(resources); - return toResourceLock(locks); + return toResourceLock(toDistinctSortedLocks(resources)); } ResourceLock getLockForResource(ExclusiveResource resource) { - return new SingleLock(toLock(resource)); + return toResourceLock(toLock(resource)); } - private List getDistinctSortedLocks(Collection resources) { + private List toDistinctSortedLocks(Collection resources) { + if (resources.isEmpty()) { + return emptyList(); + } + if (resources.size() == 1) { + return singletonList(toLock(getOnlyElement(resources))); + } // @formatter:off Map> resourcesByKey = resources.stream() .sorted(COMPARATOR) @@ -79,10 +95,20 @@ private ResourceLock toResourceLock(List locks) { case 0: return NopLock.INSTANCE; case 1: - return new SingleLock(locks.get(0)); + return toResourceLock(locks.get(0)); default: return new CompositeLock(locks); } } + private ResourceLock toResourceLock(Lock lock) { + if (lock == toLock(GLOBAL_READ)) { + return globalReadLock; + } + if (lock == toLock(GLOBAL_READ_WRITE)) { + return globalReadWriteLock; + } + return new SingleLock(lock); + } + } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTestTask.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTestTask.java index e4d2208f2bc3..8e602b990ba9 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTestTask.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTestTask.java @@ -79,6 +79,11 @@ public ExecutionMode getExecutionMode() { return taskContext.getExecutionAdvisor().getForcedExecutionMode(testDescriptor).orElse(node.getExecutionMode()); } + @Override + public String toString() { + return "NodeTestTask [" + testDescriptor + "]"; + } + void setParentContext(C parentContext) { this.parentContext = parentContext; } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ResourceLock.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ResourceLock.java index 1dcdb5601881..19f6b4da061b 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ResourceLock.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ResourceLock.java @@ -43,4 +43,12 @@ default void close() { release(); } + /** + * {@return whether the given lock is compatible with this lock} + * @param other the other lock to check for compatibility + */ + default boolean isCompatible(ResourceLock other) { + return this instanceof NopLock || other instanceof NopLock; + } + } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleLock.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleLock.java index e568b9a8f5c0..f3853dce4ee8 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleLock.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleLock.java @@ -60,4 +60,20 @@ public boolean isReleasable() { } + static class GlobalReadLock extends SingleLock { + GlobalReadLock(Lock lock) { + super(lock); + } + + @Override + public boolean isCompatible(ResourceLock other) { + return !(other instanceof GlobalReadWriteLock); + } + } + + static class GlobalReadWriteLock extends SingleLock { + GlobalReadWriteLock(Lock lock) { + super(lock); + } + } } diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinDeadLockTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinDeadLockTests.java new file mode 100644 index 000000000000..b50b2e23c700 --- /dev/null +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinDeadLockTests.java @@ -0,0 +1,179 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.engine.support.hierarchical; + +import static org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT; +import static org.junit.jupiter.api.parallel.ExecutionMode.SAME_THREAD; +import static org.junit.jupiter.api.parallel.ResourceAccessMode.READ; +import static org.junit.jupiter.api.parallel.ResourceAccessMode.READ_WRITE; +import static org.junit.jupiter.api.parallel.Resources.SYSTEM_PROPERTIES; + +import java.time.LocalTime; +import java.util.Arrays; +import java.util.concurrent.CountDownLatch; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Timeout; +import org.junit.jupiter.api.extension.AfterAllCallback; +import org.junit.jupiter.api.extension.AfterTestExecutionCallback; +import org.junit.jupiter.api.extension.BeforeAllCallback; +import org.junit.jupiter.api.extension.BeforeTestExecutionCallback; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.parallel.Execution; +import org.junit.jupiter.api.parallel.Isolated; +import org.junit.jupiter.api.parallel.ResourceLock; +import org.junit.jupiter.engine.Constants; +import org.junit.platform.engine.discovery.ClassSelector; +import org.junit.platform.engine.discovery.DiscoverySelectors; +import org.junit.platform.testkit.engine.EngineTestKit; + +// https://github.com/junit-team/junit5/issues/3945 +@Timeout(10) +public class ForkJoinDeadLockTests { + + @Test + void forkJoinExecutionDoesNotLeadToDeadLock() { + run(NonIsolatedTestCase.class, IsolatedTestCase.class, Isolated2TestCase.class); + } + + @Test + void nestedResourceLocksShouldStillWork() { + run(SharedResourceTestCase.class); + } + + @Test + void multiLevelLocks() { + run(ClassLevelTestCase.class); + } + + private static void run(Class... classes) { + EngineTestKit.engine("junit-jupiter") // + .selectors(Arrays.stream(classes).map(DiscoverySelectors::selectClass).toArray(ClassSelector[]::new)) // + .configurationParameter(Constants.PARALLEL_EXECUTION_ENABLED_PROPERTY_NAME, "true") // + .configurationParameter(Constants.DEFAULT_PARALLEL_EXECUTION_MODE, "concurrent") // + .configurationParameter(Constants.DEFAULT_CLASSES_EXECUTION_MODE_PROPERTY_NAME, "concurrent") // + .configurationParameter(Constants.PARALLEL_CONFIG_STRATEGY_PROPERTY_NAME, "fixed") // + .configurationParameter(Constants.PARALLEL_CONFIG_FIXED_MAX_POOL_SIZE_PROPERTY_NAME, "3") // + .configurationParameter(Constants.PARALLEL_CONFIG_FIXED_PARALLELISM_PROPERTY_NAME, "3") // + .configurationParameter(Constants.PARALLEL_CONFIG_FIXED_SATURATE_PROPERTY_NAME, "false") // + .execute(); + } + + @ExtendWith(StartFinishLogger.class) + static class BaseTestCase { + } + + @SuppressWarnings("JUnitMalformedDeclaration") + @Execution(CONCURRENT) + public static class NonIsolatedTestCase extends BaseTestCase { + + public static CountDownLatch otherThreadRunning = new CountDownLatch(1); + public static CountDownLatch sameThreadFinishing = new CountDownLatch(1); + + @Test + @Execution(CONCURRENT) + void otherThread() throws Exception { + otherThreadRunning.countDown(); + sameThreadFinishing.await(); + Thread.sleep(100); + } + + @Test + @Execution(SAME_THREAD) + void sameThread() throws Exception { + otherThreadRunning.await(); + sameThreadFinishing.countDown(); + } + } + + @SuppressWarnings("JUnitMalformedDeclaration") + @Isolated + public static class IsolatedTestCase extends BaseTestCase { + + @Test + void test() throws Exception { + Thread.sleep(100); + } + } + + static class Isolated2TestCase extends IsolatedTestCase { + } + + @SuppressWarnings("JUnitMalformedDeclaration") + public static class SharedResourceTestCase { + + @Test + @ResourceLock(value = SYSTEM_PROPERTIES, mode = READ) + void customPropertyIsNotSetByDefault() { + } + + @Test + @ResourceLock(value = SYSTEM_PROPERTIES, mode = READ_WRITE) + void canSetCustomPropertyToApple() { + } + + @Test + @ResourceLock(value = SYSTEM_PROPERTIES, mode = READ_WRITE) + void canSetCustomPropertyToBanana() { + } + } + + @SuppressWarnings("JUnitMalformedDeclaration") + @ResourceLock(value = "foo", mode = READ_WRITE) + public static class ClassLevelTestCase { + + @Test + @ResourceLock(value = SYSTEM_PROPERTIES, mode = READ) + void customPropertyIsNotSetByDefault() { + } + + @Test + @ResourceLock(value = SYSTEM_PROPERTIES, mode = READ_WRITE) + void canSetCustomPropertyToApple() { + } + + @Test + @ResourceLock(value = SYSTEM_PROPERTIES, mode = READ_WRITE) + void canSetCustomPropertyToBanana() { + } + } + + static class StartFinishLogger + implements BeforeTestExecutionCallback, AfterTestExecutionCallback, BeforeAllCallback, AfterAllCallback { + + @Override + public void beforeAll(ExtensionContext context) { + log("starting class " + context.getTestClass().orElseThrow().getSimpleName()); + } + + @Override + public void beforeTestExecution(ExtensionContext context) { + log("starting method " + context.getTestClass().orElseThrow().getSimpleName() + "." + + context.getTestMethod().orElseThrow().getName()); + } + + @Override + public void afterTestExecution(ExtensionContext context) { + log("finishing method " + context.getTestClass().orElseThrow().getSimpleName() + "." + + context.getTestMethod().orElseThrow().getName()); + } + + @Override + public void afterAll(ExtensionContext context) { + log("finishing class " + context.getTestClass().orElseThrow().getSimpleName()); + } + } + + private static void log(String message) { + System.out.println("[" + LocalTime.now() + "] " + Thread.currentThread().getName() + " - " + message); + } +} diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java index 79120bf40d17..f3ee3d923ab6 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java @@ -11,11 +11,26 @@ package org.junit.platform.engine.support.hierarchical; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.platform.engine.support.hierarchical.ExclusiveResource.GLOBAL_READ; +import static org.junit.platform.engine.support.hierarchical.ExclusiveResource.GLOBAL_READ_WRITE; +import static org.junit.platform.engine.support.hierarchical.Node.ExecutionMode.CONCURRENT; + +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicReference; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Timeout; +import org.junit.jupiter.api.function.ThrowingConsumer; import org.junit.platform.commons.JUnitException; +import org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService.TaskEventListener; +import org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutorService.TestTask; +import org.junit.platform.engine.support.hierarchical.Node.ExecutionMode; class ForkJoinPoolHierarchicalTestExecutorServiceTests { @@ -33,4 +48,86 @@ void exceptionsFromInvalidConfigurationAreNotSwallowed() { assertThat(exception).rootCause().isInstanceOf(IllegalArgumentException.class); } + @Test + @Timeout(5) + void defersTasksWithIncompatibleLocks() throws Exception { + var configuration = new DefaultParallelExecutionConfiguration(2, 2, 2, 2, 1, __ -> true); + + var lockManager = new LockManager(); + var globalReadLock = lockManager.getLockForResource(GLOBAL_READ); + var globalReadWriteLock = lockManager.getLockForResource(GLOBAL_READ_WRITE); + var nopLock = NopLock.INSTANCE; + + var threadNamesByTaskIdentifier = new ConcurrentHashMap(); + var deferred = new CountDownLatch(1); + var deferredTask = new AtomicReference(); + + TaskEventListener taskEventListener = testTask -> { + deferredTask.set(testTask); + deferred.countDown(); + }; + + var isolatedTask = new DummyTestTask("isolatedTask", globalReadWriteLock, + t -> threadNamesByTaskIdentifier.put(t.identifier(), Thread.currentThread().getName())); + + try (var pool = new ForkJoinPoolHierarchicalTestExecutorService(configuration, taskEventListener)) { + + var bothLeafTasksAreRunning = new CountDownLatch(2); + var nestedTask = new DummyTestTask("nestedTask", globalReadLock, t -> { + threadNamesByTaskIdentifier.put(t.identifier(), Thread.currentThread().getName()); + var leafTask1 = new DummyTestTask("leafTask1", nopLock, t1 -> { + threadNamesByTaskIdentifier.put(t1.identifier(), Thread.currentThread().getName()); + pool.new ExclusiveTask(isolatedTask).fork(); + bothLeafTasksAreRunning.countDown(); + bothLeafTasksAreRunning.await(); + try { + deferred.await(); + } + catch (InterruptedException e) { + System.out.println("Interrupted while waiting for task to be deferred"); + } + }); + var leafTask2 = new DummyTestTask("leafTask2", nopLock, t2 -> { + threadNamesByTaskIdentifier.put(t2.identifier(), Thread.currentThread().getName()); + bothLeafTasksAreRunning.countDown(); + bothLeafTasksAreRunning.await(); + }); + pool.invokeAll(List.of(leafTask1, leafTask2)); + }); + + pool.submit(nestedTask).get(); + } + + assertEquals(isolatedTask, deferredTask.get()); + assertEquals(threadNamesByTaskIdentifier.get("nestedTask"), threadNamesByTaskIdentifier.get("leafTask2")); + assertNotEquals(threadNamesByTaskIdentifier.get("leafTask1"), threadNamesByTaskIdentifier.get("leafTask2")); + } + + record DummyTestTask(String identifier, ResourceLock resourceLock, ThrowingConsumer action) + implements TestTask { + @Override + public ExecutionMode getExecutionMode() { + return CONCURRENT; + } + + @Override + public ResourceLock getResourceLock() { + return resourceLock; + } + + @Override + public void execute() { + try { + action.accept(this); + } + catch (Throwable e) { + throw new RuntimeException("Action " + identifier + " failed", e); + } + } + + @Override + public String toString() { + return identifier; + } + } } diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/LockManagerTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/LockManagerTests.java index 5fca505147f1..c9cb0570027e 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/LockManagerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/LockManagerTests.java @@ -32,7 +32,7 @@ */ class LockManagerTests { - private LockManager lockManager = new LockManager(); + private final LockManager lockManager = new LockManager(); @Test void returnsNopLockWithoutExclusiveResources() { @@ -50,7 +50,7 @@ void returnsSingleLockForSingleExclusiveResource() { var locks = getLocks(resources, SingleLock.class); assertThat(locks).hasSize(1); - assertThat(locks.get(0)).isInstanceOf(ReadLock.class); + assertThat(locks.getFirst()).isInstanceOf(ReadLock.class); } @Test @@ -75,7 +75,7 @@ void reusesSameLockForExclusiveResourceWithSameKey() { assertThat(locks1).hasSize(1); assertThat(locks2).hasSize(1); - assertThat(locks1.get(0)).isSameAs(locks2.get(0)); + assertThat(locks1.getFirst()).isSameAs(locks2.getFirst()); } @Test @@ -111,8 +111,26 @@ void globalLockComesFirst(LockMode globalLockMode) { assertThat(locks.get(3)).isEqualTo(getSingleLock("foo", READ_WRITE)); } - private Lock getSingleLock(String globalResourceLockKey, LockMode read) { - return getLocks(Set.of(new ExclusiveResource(globalResourceLockKey, read)), SingleLock.class).get(0); + @Test + void usesSpecialClassForGlobalReadLock() { + var lock = lockManager.getLockForResources(List.of(ExclusiveResource.GLOBAL_READ)); + + assertThat(lock) // + .isInstanceOf(SingleLock.GlobalReadLock.class) // + .isSameAs(lockManager.getLockForResource(ExclusiveResource.GLOBAL_READ)); + } + + @Test + void usesSpecialClassForGlobalReadWriteLock() { + var lock = lockManager.getLockForResources(List.of(ExclusiveResource.GLOBAL_READ_WRITE)); + + assertThat(lock) // + .isInstanceOf(SingleLock.GlobalReadWriteLock.class) // + .isSameAs(lockManager.getLockForResource(ExclusiveResource.GLOBAL_READ_WRITE)); + } + + private Lock getSingleLock(String key, LockMode lockMode) { + return getLocks(Set.of(new ExclusiveResource(key, lockMode)), SingleLock.class).getFirst(); } private List getLocks(Collection resources, Class type) { diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ResourceLockTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ResourceLockTests.java new file mode 100644 index 000000000000..ca80c33d6131 --- /dev/null +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ResourceLockTests.java @@ -0,0 +1,82 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.engine.support.hierarchical; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.List; +import java.util.concurrent.locks.ReentrantLock; + +import org.junit.jupiter.api.Test; + +@SuppressWarnings("resource") +class ResourceLockTests { + + @Test + void nopLocksAreCompatibleWithEverything() { + var nopLock = NopLock.INSTANCE; + + assertTrue(nopLock.isCompatible(NopLock.INSTANCE)); + assertTrue(nopLock.isCompatible(new SingleLock(anyReentrantLock()))); + assertTrue(nopLock.isCompatible(new SingleLock.GlobalReadLock(anyReentrantLock()))); + assertTrue(nopLock.isCompatible(new SingleLock.GlobalReadWriteLock(anyReentrantLock()))); + assertTrue(nopLock.isCompatible(new CompositeLock(List.of(anyReentrantLock())))); + } + + @Test + void singleLocksAreIncompatibleWithNonNopLocks() { + var singleLock = new SingleLock(anyReentrantLock()); + + assertTrue(singleLock.isCompatible(NopLock.INSTANCE)); + assertFalse(singleLock.isCompatible(new SingleLock(anyReentrantLock()))); + assertFalse(singleLock.isCompatible(new SingleLock.GlobalReadLock(anyReentrantLock()))); + assertFalse(singleLock.isCompatible(new SingleLock.GlobalReadWriteLock(anyReentrantLock()))); + assertFalse(singleLock.isCompatible(new CompositeLock(List.of(anyReentrantLock())))); + } + + @Test + void globalReadLockIsCompatibleWithEverythingExceptGlobalReadWriteLock() { + var globalReadLock = new SingleLock.GlobalReadLock(anyReentrantLock()); + + assertTrue(globalReadLock.isCompatible(NopLock.INSTANCE)); + assertTrue(globalReadLock.isCompatible(new SingleLock(anyReentrantLock()))); + assertTrue(globalReadLock.isCompatible(new SingleLock.GlobalReadLock(anyReentrantLock()))); + assertFalse(globalReadLock.isCompatible(new SingleLock.GlobalReadWriteLock(anyReentrantLock()))); + assertTrue(globalReadLock.isCompatible(new CompositeLock(List.of(anyReentrantLock())))); + } + + @Test + void globalReadWriteLockIsIncompatibleWithWithNonNopLocks() { + var globalReadWriteLock = new SingleLock.GlobalReadWriteLock(anyReentrantLock()); + + assertTrue(globalReadWriteLock.isCompatible(NopLock.INSTANCE)); + assertFalse(globalReadWriteLock.isCompatible(new SingleLock(anyReentrantLock()))); + assertFalse(globalReadWriteLock.isCompatible(new SingleLock.GlobalReadLock(anyReentrantLock()))); + assertFalse(globalReadWriteLock.isCompatible(new SingleLock.GlobalReadWriteLock(anyReentrantLock()))); + assertFalse(globalReadWriteLock.isCompatible(new CompositeLock(List.of(anyReentrantLock())))); + } + + @Test + void compositeLocksAreIncompatibleWithNonNopLocks() { + CompositeLock compositeLock = new CompositeLock(List.of(anyReentrantLock())); + + assertTrue(compositeLock.isCompatible(NopLock.INSTANCE)); + assertFalse(compositeLock.isCompatible(new SingleLock(anyReentrantLock()))); + assertFalse(compositeLock.isCompatible(new SingleLock.GlobalReadLock(anyReentrantLock()))); + assertFalse(compositeLock.isCompatible(new SingleLock.GlobalReadWriteLock(anyReentrantLock()))); + assertFalse(compositeLock.isCompatible(compositeLock)); + } + + private static ReentrantLock anyReentrantLock() { + return new ReentrantLock(); + } +} From 73c8ca2f062988bad7f56b5193ba3624f3df7b80 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 17 Sep 2024 14:46:33 +0200 Subject: [PATCH 085/611] Ensure nesting is only decremented when lock was acquired successfully When running Spock's tests with the latest snapshot, `pop()` seems to have been called without a prior call to `push()` on the `Deque` of resource locks. --- ...inPoolHierarchicalTestExecutorService.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorService.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorService.java index 9b5d2efea14c..4b2e332fd07a 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorService.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorService.java @@ -253,17 +253,17 @@ public boolean exec() { // this means that .join() will wait. return false; } - try (ResourceLock lock = resourceLock.acquire()) { - threadLock.incrementNesting(lock); + try ( // + ResourceLock lock = resourceLock.acquire(); // + @SuppressWarnings("unused") + ThreadLock.NestedResourceLock nested = threadLock.withNesting(lock) // + ) { testTask.execute(); return true; } catch (InterruptedException e) { throw ExceptionUtils.throwAsUncheckedException(e); } - finally { - threadLock.decrementNesting(); - } } @Override @@ -300,18 +300,19 @@ void addDeferredTask(ExclusiveTask task) { deferredTasks.add(task); } - void incrementNesting(ResourceLock lock) { + NestedResourceLock withNesting(ResourceLock lock) { locks.push(lock); - } - - @SuppressWarnings("resource") - void decrementNesting() { - locks.pop(); + return locks::pop; } boolean areAllHeldLocksCompatibleWith(ResourceLock lock) { return locks.stream().allMatch(l -> l.isCompatible(lock)); } + + interface NestedResourceLock extends AutoCloseable { + @Override + void close(); + } } interface TaskEventListener { From b04b4b852349f1ba62eb358462c12b58e7400db2 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 17 Sep 2024 15:01:53 +0200 Subject: [PATCH 086/611] Update `oracle-actions/setup-java` to v1.4.0 --- .github/workflows/cross-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cross-version.yml b/.github/workflows/cross-version.yml index 9a9cc5712455..a0bed54025cb 100644 --- a/.github/workflows/cross-version.yml +++ b/.github/workflows/cross-version.yml @@ -35,7 +35,7 @@ jobs: - name: Set up Test JDK uses: ./.github/actions/setup-test-jdk - name: "Set up JDK ${{ matrix.jdk.version }} (${{ matrix.jdk.release || 'ea' }})" - uses: oracle-actions/setup-java@v1 + uses: oracle-actions/setup-java@v1.4.0 with: website: jdk.java.net release: ${{ matrix.jdk.release || matrix.jdk.version }} From 8c29bdad4437671d75fb468df8e688edbca7bfdb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 17 Sep 2024 14:18:44 +0000 Subject: [PATCH 087/611] Pin oracle-actions/setup-java action to 2e744f7 --- .github/workflows/cross-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cross-version.yml b/.github/workflows/cross-version.yml index a0bed54025cb..3822f7379aec 100644 --- a/.github/workflows/cross-version.yml +++ b/.github/workflows/cross-version.yml @@ -35,7 +35,7 @@ jobs: - name: Set up Test JDK uses: ./.github/actions/setup-test-jdk - name: "Set up JDK ${{ matrix.jdk.version }} (${{ matrix.jdk.release || 'ea' }})" - uses: oracle-actions/setup-java@v1.4.0 + uses: oracle-actions/setup-java@2e744f723b003fdd759727d0ff654c8717024845 # v1.4.0 with: website: jdk.java.net release: ${{ matrix.jdk.release || matrix.jdk.version }} From 59f216cba96e2d20fbad1dcba0f29fc91b44f128 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 17 Sep 2024 16:45:34 +0200 Subject: [PATCH 088/611] Install GA releases using proper distributions rather than jdk.java.net --- .github/workflows/cross-version.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cross-version.yml b/.github/workflows/cross-version.yml index 3822f7379aec..1563db258ee4 100644 --- a/.github/workflows/cross-version.yml +++ b/.github/workflows/cross-version.yml @@ -21,11 +21,17 @@ jobs: matrix: jdk: - version: 22 + type: ga + distribution: temurin - version: 23 + type: ga + distribution: oracle - version: 24 + type: ea - version: 24 + type: ea release: leyden - name: "OpenJDK ${{ matrix.jdk.version }} (${{ matrix.jdk.release || 'ea' }})" + name: "OpenJDK ${{ matrix.jdk.version }} (${{ matrix.jdk.release || matrix.jdk.type }})" runs-on: ubuntu-latest steps: - name: Check out repository @@ -35,11 +41,19 @@ jobs: - name: Set up Test JDK uses: ./.github/actions/setup-test-jdk - name: "Set up JDK ${{ matrix.jdk.version }} (${{ matrix.jdk.release || 'ea' }})" + if: matrix.jdk.type == 'ea' uses: oracle-actions/setup-java@2e744f723b003fdd759727d0ff654c8717024845 # v1.4.0 with: website: jdk.java.net release: ${{ matrix.jdk.release || matrix.jdk.version }} version: latest + - name: "Set up JDK ${{ matrix.jdk.version }} (${{ matrix.jdk.distribution }})" + if: matrix.jdk.type == 'ga' + uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 + with: + distribution: ${{ matrix.jdk.distribution }} + java-version: ${{ matrix.jdk.version }} + check-latest: true - name: 'Prepare JDK${{ matrix.jdk.version }} env var' shell: bash run: echo "JDK${{ matrix.jdk.version }}=$JAVA_HOME" >> $GITHUB_ENV From 3b85a030a7a0ecb328eef89c993feb3b81256e43 Mon Sep 17 00:00:00 2001 From: Chris C Date: Tue, 17 Sep 2024 17:02:09 +0200 Subject: [PATCH 089/611] Document benefits of `messageSupplier` in `Assertions` (#3938) Resolves #3153. --- .../src/docs/asciidoc/user-guide/writing-tests.adoc | 7 +++++++ documentation/src/test/java/example/AssertionsDemo.java | 9 +++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc index 3a161bf3185f..463faad468c8 100644 --- a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc +++ b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc @@ -293,6 +293,13 @@ JUnit Jupiter comes with many of the assertion methods that JUnit 4 has and adds that lend themselves well to being used with Java 8 lambdas. All JUnit Jupiter assertions are `static` methods in the `{Assertions}` class. +Assertion methods optionally accept the assertion message as their third parameter, which +can be either a `String` or a `Supplier`. + +When using a `Supplier` (e.g., a lambda expression), the message is evaluated +lazily. This can provide a performance benefit, especially if message construction is +complex or time-consuming, as it is only evaluated when the assertion fails. + [source,java,indent=0] ---- include::{testDir}/example/AssertionsDemo.java[tags=user_guide] diff --git a/documentation/src/test/java/example/AssertionsDemo.java b/documentation/src/test/java/example/AssertionsDemo.java index 24d8c0691769..c1b1c47873d9 100644 --- a/documentation/src/test/java/example/AssertionsDemo.java +++ b/documentation/src/test/java/example/AssertionsDemo.java @@ -41,8 +41,9 @@ void standardAssertions() { assertEquals(2, calculator.add(1, 1)); assertEquals(4, calculator.multiply(2, 2), "The optional failure message is now the last parameter"); - assertTrue('a' < 'b', () -> "Assertion messages can be lazily evaluated -- " - + "to avoid constructing complex messages unnecessarily."); + + // Lazily evaluates generateFailureMessage('a','b'). + assertTrue('a' < 'b', () -> generateFailureMessage('a','b')); } @Test @@ -160,6 +161,10 @@ private static String greeting() { return "Hello, World!"; } + private static String generateFailureMessage(char a, char b) { + return "Assertion messages can be lazily evaluated -- " + + "to avoid constructing complex messages unnecessarily." + (a < b); + } } // end::user_guide[] // @formatter:on From 7069420085ddd246ae223113e09d2612d439f952 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 17 Sep 2024 21:27:42 +0000 Subject: [PATCH 090/611] Update dependency io.github.classgraph:classgraph to v4.8.176 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a282cf48cb7b..932f97af7b5f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -32,7 +32,7 @@ assertj = { module = "org.assertj:assertj-core", version.ref = "assertj" } bartholdy = { module = "de.sormuras:bartholdy", version = "0.2.3" } bndlib = { module = "biz.aQute.bnd:biz.aQute.bndlib", version.ref = "bnd" } checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checkstyle" } -classgraph = { module = "io.github.classgraph:classgraph", version = "4.8.175" } +classgraph = { module = "io.github.classgraph:classgraph", version = "4.8.176" } commons-io = { module = "commons-io:commons-io", version = "2.16.1" } groovy4 = { module = "org.apache.groovy:groovy", version = "4.0.23" } groovy2-bom = { module = "org.codehaus.groovy:groovy-bom", version = "2.5.23" } From 40907ee498318782839ed93d3dea9941be894eb0 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 18 Sep 2024 08:25:01 +0200 Subject: [PATCH 091/611] Move release note entry to 5.12.0-M1 Closes #3925. --- .../src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc | 3 +-- .../docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc index 41114a7b0230..8dc92f6310d9 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc @@ -31,8 +31,7 @@ on GitHub. [[release-notes-5.11.1-junit-platform-new-features-and-improvements]] ==== New Features and Improvements -* Introduce `ReflectionSupport.makeAccessible(Field)` for third-party use rather than - calling the internal `ReflectionUtils.makeAccessible(Field)` method directly. +* ❓ [[release-notes-5.11.1-junit-jupiter]] diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index b935ad8a9832..a2de2236b463 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -27,7 +27,8 @@ JUnit repository on GitHub. [[release-notes-5.12.0-M1-junit-platform-new-features-and-improvements]] ==== New Features and Improvements -* ❓ +* Introduce `ReflectionSupport.makeAccessible(Field)` for third-party use rather than + calling the internal `ReflectionUtils.makeAccessible(Field)` method directly. [[release-notes-5.12.0-M1-junit-jupiter]] From c8496a2e331097ee4a093edd5523ac6d530ce8c3 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 18 Sep 2024 11:56:39 +0200 Subject: [PATCH 092/611] Run isolated tasks last (#4004) Rather than executing tasks requiring the global read-write lock while forked tasks are still being executed and thus causing contention, such isolated tasks are now executed after all other work is done. Resolves #3928. --- .../release-notes/release-notes-5.11.1.adoc | 7 +- ...inPoolHierarchicalTestExecutorService.java | 29 +++++--- .../ParallelExecutionIntegrationTests.java | 73 +++++++++++++++---- 3 files changed, 80 insertions(+), 29 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc index 8dc92f6310d9..f720d245b68b 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc @@ -31,7 +31,9 @@ on GitHub. [[release-notes-5.11.1-junit-platform-new-features-and-improvements]] ==== New Features and Improvements -* ❓ +* Improve parallelism and reduce number of blocked threads used by + `HierarchicalTestEngine` implementations when parallel execution is enabled and the + global read-write lock is used. [[release-notes-5.11.1-junit-jupiter]] @@ -51,7 +53,8 @@ on GitHub. [[release-notes-5.11.1-junit-jupiter-new-features-and-improvements]] ==== New Features and Improvements -* ❓ +* Improve parallelism and reduce number of blocked threads in the presence of `@Isolated` + tests when parallel execution is enabled [[release-notes-5.11.1-junit-vintage]] diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorService.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorService.java index 4b2e332fd07a..c6ed2cb4b585 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorService.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorService.java @@ -13,6 +13,7 @@ import static java.util.concurrent.CompletableFuture.completedFuture; import static org.apiguardian.api.API.Status.STABLE; import static org.junit.platform.engine.support.hierarchical.Node.ExecutionMode.CONCURRENT; +import static org.junit.platform.engine.support.hierarchical.Node.ExecutionMode.SAME_THREAD; import java.lang.Thread.UncaughtExceptionHandler; import java.lang.reflect.Constructor; @@ -38,6 +39,7 @@ import org.junit.platform.commons.logging.LoggerFactory; import org.junit.platform.commons.util.ExceptionUtils; import org.junit.platform.engine.ConfigurationParameters; +import org.junit.platform.engine.support.hierarchical.SingleLock.GlobalReadWriteLock; /** * A {@link ForkJoinPool}-based @@ -155,29 +157,34 @@ public void invokeAll(List tasks) { new ExclusiveTask(tasks.get(0)).execSync(); return; } - Deque nonConcurrentTasks = new LinkedList<>(); + Deque isolatedTasks = new LinkedList<>(); + Deque sameThreadTasks = new LinkedList<>(); Deque concurrentTasksInReverseOrder = new LinkedList<>(); - forkConcurrentTasks(tasks, nonConcurrentTasks, concurrentTasksInReverseOrder); - executeNonConcurrentTasks(nonConcurrentTasks); + forkConcurrentTasks(tasks, isolatedTasks, sameThreadTasks, concurrentTasksInReverseOrder); + executeSync(sameThreadTasks); joinConcurrentTasksInReverseOrderToEnableWorkStealing(concurrentTasksInReverseOrder); + executeSync(isolatedTasks); } - private void forkConcurrentTasks(List tasks, Deque nonConcurrentTasks, - Deque concurrentTasksInReverseOrder) { + private void forkConcurrentTasks(List tasks, Deque isolatedTasks, + Deque sameThreadTasks, Deque concurrentTasksInReverseOrder) { for (TestTask testTask : tasks) { ExclusiveTask exclusiveTask = new ExclusiveTask(testTask); - if (testTask.getExecutionMode() == CONCURRENT) { - exclusiveTask.fork(); - concurrentTasksInReverseOrder.addFirst(exclusiveTask); + if (testTask.getResourceLock() instanceof GlobalReadWriteLock) { + isolatedTasks.add(exclusiveTask); + } + else if (testTask.getExecutionMode() == SAME_THREAD) { + sameThreadTasks.add(exclusiveTask); } else { - nonConcurrentTasks.add(exclusiveTask); + exclusiveTask.fork(); + concurrentTasksInReverseOrder.addFirst(exclusiveTask); } } } - private void executeNonConcurrentTasks(Deque nonConcurrentTasks) { - for (ExclusiveTask task : nonConcurrentTasks) { + private void executeSync(Deque tasks) { + for (ExclusiveTask task : tasks) { task.execSync(); } } diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionIntegrationTests.java index dbd5d519be63..b556240bc295 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionIntegrationTests.java @@ -20,10 +20,11 @@ import static org.junit.jupiter.api.parallel.ExecutionMode.SAME_THREAD; import static org.junit.jupiter.engine.Constants.DEFAULT_CLASSES_EXECUTION_MODE_PROPERTY_NAME; import static org.junit.jupiter.engine.Constants.DEFAULT_PARALLEL_EXECUTION_MODE; +import static org.junit.jupiter.engine.Constants.PARALLEL_CONFIG_FIXED_MAX_POOL_SIZE_PROPERTY_NAME; import static org.junit.jupiter.engine.Constants.PARALLEL_CONFIG_FIXED_PARALLELISM_PROPERTY_NAME; import static org.junit.jupiter.engine.Constants.PARALLEL_CONFIG_STRATEGY_PROPERTY_NAME; import static org.junit.jupiter.engine.Constants.PARALLEL_EXECUTION_ENABLED_PROPERTY_NAME; -import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; +import static org.junit.platform.commons.util.CollectionUtils.getOnlyElement; import static org.junit.platform.testkit.engine.EventConditions.container; import static org.junit.platform.testkit.engine.EventConditions.event; import static org.junit.platform.testkit.engine.EventConditions.finishedSuccessfully; @@ -65,8 +66,10 @@ import org.junit.jupiter.api.parallel.Isolated; import org.junit.jupiter.api.parallel.ResourceLock; import org.junit.platform.engine.TestDescriptor; +import org.junit.platform.engine.discovery.ClassSelector; import org.junit.platform.engine.discovery.DiscoverySelectors; import org.junit.platform.engine.reporting.ReportEntry; +import org.junit.platform.engine.support.descriptor.MethodSource; import org.junit.platform.testkit.engine.EngineExecutionResults; import org.junit.platform.testkit.engine.EngineTestKit; import org.junit.platform.testkit.engine.Event; @@ -74,6 +77,7 @@ /** * @since 1.3 */ +@SuppressWarnings({ "JUnitMalformedDeclaration", "NewClassNamingConvention" }) class ParallelExecutionIntegrationTests { @Test @@ -250,6 +254,35 @@ void canRunTestsIsolatedFromEachOtherAcrossClassesWithOtherResourceLocks() { assertThat(events.stream().filter(event(test(), finishedWithFailure())::matches)).isEmpty(); } + @Test + void runsIsolatedTestsLastToMaximizeParallelism() { + var configParams = Map.of( // + DEFAULT_PARALLEL_EXECUTION_MODE, "concurrent", // + PARALLEL_CONFIG_FIXED_MAX_POOL_SIZE_PROPERTY_NAME, "3" // + ); + Class[] testClasses = { IsolatedTestCase.class, SuccessfulParallelTestCase.class }; + var events = executeWithFixedParallelism(3, configParams, testClasses) // + .allEvents(); + + assertThat(events.stream().filter(event(test(), finishedWithFailure())::matches)).isEmpty(); + + List parallelTestMethodEvents = events.reportingEntryPublished() // + .filter(e -> e.getTestDescriptor().getSource() // + .filter(it -> // + it instanceof MethodSource + && SuccessfulParallelTestCase.class.equals(((MethodSource) it).getJavaClass()) // + ).isPresent() // + ) // + .toList(); + assertThat(ThreadReporter.getThreadNames(parallelTestMethodEvents)).hasSize(3); + + var parallelClassFinish = getOnlyElement(getTimestampsFor(events.list(), + event(container(SuccessfulParallelTestCase.class), finishedSuccessfully()))); + var isolatedClassStart = getOnlyElement( + getTimestampsFor(events.list(), event(container(IsolatedTestCase.class), started()))); + assertThat(isolatedClassStart).isAfterOrEqualTo(parallelClassFinish); + } + @Isolated("testing") static class IsolatedTestCase { static AtomicInteger sharedResource; @@ -384,27 +417,30 @@ private List getTimestampsFor(List events, Condition cond } private List executeConcurrently(int parallelism, Class... testClasses) { - return executeWithFixedParallelism(parallelism, Map.of(DEFAULT_PARALLEL_EXECUTION_MODE, "concurrent"), - testClasses).allEvents().list(); + Map configParams = Map.of(DEFAULT_PARALLEL_EXECUTION_MODE, "concurrent"); + return executeWithFixedParallelism(parallelism, configParams, testClasses) // + .allEvents() // + .list(); } private EngineExecutionResults executeWithFixedParallelism(int parallelism, Map configParams, Class... testClasses) { - // @formatter:off - var discoveryRequest = request() - .selectors(Arrays.stream(testClasses).map(DiscoverySelectors::selectClass).collect(toList())) - .configurationParameter(PARALLEL_EXECUTION_ENABLED_PROPERTY_NAME, String.valueOf(true)) - .configurationParameter(PARALLEL_CONFIG_STRATEGY_PROPERTY_NAME, "fixed") - .configurationParameter(PARALLEL_CONFIG_FIXED_PARALLELISM_PROPERTY_NAME, String.valueOf(parallelism)) - .configurationParameters(configParams) - .build(); - // @formatter:on - return EngineTestKit.execute("junit-jupiter", discoveryRequest); + var classSelectors = Arrays.stream(testClasses) // + .map(DiscoverySelectors::selectClass) // + .toArray(ClassSelector[]::new); + return EngineTestKit.engine("junit-jupiter") // + .selectors(classSelectors) // + .configurationParameter(PARALLEL_EXECUTION_ENABLED_PROPERTY_NAME, String.valueOf(true)) // + .configurationParameter(PARALLEL_CONFIG_STRATEGY_PROPERTY_NAME, "fixed") // + .configurationParameter(PARALLEL_CONFIG_FIXED_PARALLELISM_PROPERTY_NAME, String.valueOf(parallelism)) // + .configurationParameters(configParams) // + .execute(); } // ------------------------------------------------------------------------- @ExtendWith(ThreadReporter.class) + @Execution(SAME_THREAD) static class SuccessfulParallelTestCase { static AtomicInteger sharedResource; @@ -417,16 +453,19 @@ static void initialize() { } @Test + @Execution(CONCURRENT) void firstTest() throws Exception { incrementAndBlock(sharedResource, countDownLatch); } @Test + @Execution(CONCURRENT) void secondTest() throws Exception { incrementAndBlock(sharedResource, countDownLatch); } @Test + @Execution(CONCURRENT) void thirdTest() throws Exception { incrementAndBlock(sharedResource, countDownLatch); } @@ -782,6 +821,7 @@ private static void incrementBlockAndCheck(AtomicInteger sharedResource, CountDo assertEquals(value, sharedResource.get()); } + @SuppressWarnings("ResultOfMethodCallIgnored") private static int incrementAndBlock(AtomicInteger sharedResource, CountDownLatch countDownLatch) throws InterruptedException { var value = sharedResource.incrementAndGet(); @@ -790,6 +830,7 @@ private static int incrementAndBlock(AtomicInteger sharedResource, CountDownLatc return value; } + @SuppressWarnings("ResultOfMethodCallIgnored") private static void storeAndBlockAndCheck(AtomicInteger sharedResource, CountDownLatch countDownLatch) throws InterruptedException { var value = sharedResource.get(); @@ -798,7 +839,7 @@ private static void storeAndBlockAndCheck(AtomicInteger sharedResource, CountDow assertEquals(value, sharedResource.get()); } - /** + /* * To simulate tests running in parallel tests will modify a shared * resource, simulate work by waiting, then check if the shared resource was * not modified by any other thread. @@ -806,10 +847,10 @@ private static void storeAndBlockAndCheck(AtomicInteger sharedResource, CountDow * Depending on system performance the simulation of work needs to be longer * on slower systems to ensure tests can run in parallel. * - * Currently CI is known to be slow. + * Currently, CI is known to be slow. */ private static long estimateSimulatedTestDurationInMiliseconds() { - var runningInCi = Boolean.valueOf(System.getenv("CI")); + var runningInCi = Boolean.parseBoolean(System.getenv("CI")); return runningInCi ? 1000 : 100; } From 837e25934c1a2617cb45f05138fb6a5d53e5dfdf Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 18 Sep 2024 15:29:11 +0200 Subject: [PATCH 093/611] Switch to Temurin for JDK 23 (#4005) --- .github/workflows/cross-version.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/cross-version.yml b/.github/workflows/cross-version.yml index 1563db258ee4..6447cff19f84 100644 --- a/.github/workflows/cross-version.yml +++ b/.github/workflows/cross-version.yml @@ -22,10 +22,8 @@ jobs: jdk: - version: 22 type: ga - distribution: temurin - version: 23 type: ga - distribution: oracle - version: 24 type: ea - version: 24 @@ -51,7 +49,7 @@ jobs: if: matrix.jdk.type == 'ga' uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 with: - distribution: ${{ matrix.jdk.distribution }} + distribution: ${{ matrix.jdk.distribution || 'temurin' }} java-version: ${{ matrix.jdk.version }} check-latest: true - name: 'Prepare JDK${{ matrix.jdk.version }} env var' From f7684f6f06740f0b483d53953ae3ea754ed36d82 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 18 Sep 2024 16:27:55 +0200 Subject: [PATCH 094/611] Work around Log4J error being logged when running test tasks Related issue: gradle/gradle#30554 --- .../src/main/kotlin/junitbuild.testing-conventions.gradle.kts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts index 95fcb06f8139..23a24ae2c5ee 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts @@ -42,6 +42,8 @@ tasks.withType().configureEach { } } systemProperty("java.util.logging.manager", "org.apache.logging.log4j.jul.LogManager") + // https://github.com/gradle/gradle/issues/30554 + systemProperty("log4j2.julLoggerAdapter", "org.apache.logging.log4j.jul.CoreLoggerAdapter") // Avoid overhead (see https://logging.apache.org/log4j/2.x/manual/jmx.html#enabling-jmx) systemProperty("log4j2.disableJmx", "true") // Required until ASM officially supports the JDK 14 From 67a5a2fdfef70aa6ffc605e64a78b908bea5defb Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 18 Sep 2024 16:43:15 +0200 Subject: [PATCH 095/611] Simplify global lock coarsening (#4007) Only acquire global read/write lock on the nodes immediately below the engine descriptor and ignore other locks when a global read-write lock is requested. --- .../support/hierarchical/NodeTreeWalker.java | 17 ++++++++++++----- .../NodeTreeWalkerIntegrationTests.java | 6 ++++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalker.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalker.java index c972b0565e77..8e47d006849c 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalker.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalker.java @@ -52,7 +52,9 @@ private void walk(TestDescriptor globalLockDescriptor, TestDescriptor testDescri NodeExecutionAdvisor advisor) { Set exclusiveResources = getExclusiveResources(testDescriptor); if (exclusiveResources.isEmpty()) { - advisor.useResourceLock(testDescriptor, globalReadLock); + if (globalLockDescriptor.equals(testDescriptor)) { + advisor.useResourceLock(globalLockDescriptor, globalReadLock); + } testDescriptor.getChildren().forEach(child -> walk(globalLockDescriptor, child, advisor)); } else { @@ -70,14 +72,19 @@ private void walk(TestDescriptor globalLockDescriptor, TestDescriptor testDescri advisor.forceDescendantExecutionMode(child, SAME_THREAD); }); } - if (!globalLockDescriptor.equals(testDescriptor) && allResources.contains(GLOBAL_READ_WRITE)) { + if (allResources.contains(GLOBAL_READ_WRITE)) { forceDescendantExecutionModeRecursively(advisor, globalLockDescriptor); advisor.useResourceLock(globalLockDescriptor, globalReadWriteLock); } - if (globalLockDescriptor.equals(testDescriptor) && !allResources.contains(GLOBAL_READ_WRITE)) { - allResources.add(GLOBAL_READ); + else { + if (globalLockDescriptor.equals(testDescriptor)) { + allResources.add(GLOBAL_READ); + } + else { + allResources.remove(GLOBAL_READ); + } + advisor.useResourceLock(testDescriptor, lockManager.getLockForResources(allResources)); } - advisor.useResourceLock(testDescriptor, lockManager.getLockForResources(allResources)); } } diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalkerIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalkerIntegrationTests.java index 531c61b66cf3..afb9addda85f 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalkerIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalkerIntegrationTests.java @@ -28,6 +28,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.parallel.ResourceAccessMode; import org.junit.jupiter.api.parallel.ResourceLock; +import org.junit.jupiter.api.parallel.Resources; import org.junit.jupiter.engine.JupiterTestEngine; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.UniqueId; @@ -161,12 +162,12 @@ void coarsensGlobalLockToEngineDescriptorChild() { var nestedTestClassDescriptor = getOnlyElement(testClassDescriptor.getChildren()); assertThat(advisor.getResourceLock(nestedTestClassDescriptor)).extracting(allLocks()) // - .isEqualTo(List.of(getLock(GLOBAL_READ))); + .isEqualTo(List.of()); assertThat(advisor.getForcedExecutionMode(nestedTestClassDescriptor)).contains(SAME_THREAD); var testMethodDescriptor = getOnlyElement(nestedTestClassDescriptor.getChildren()); assertThat(advisor.getResourceLock(testMethodDescriptor)).extracting(allLocks()) // - .isEqualTo(List.of(getLock(GLOBAL_READ_WRITE))); + .isEqualTo(List.of()); assertThat(advisor.getForcedExecutionMode(testMethodDescriptor)).contains(SAME_THREAD); } @@ -215,6 +216,7 @@ void test() { } } + @ResourceLock(Resources.SYSTEM_PROPERTIES) static class TestCaseWithGlobalLockRequiringChild { @Nested class NestedTestCaseWithResourceLock { From 447f83a39a5c7fe49eab883dec9687e011ded92d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:44:03 +0000 Subject: [PATCH 096/611] Update plugin shadow to v8.3.2 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 932f97af7b5f..38f572d9bb6c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -91,6 +91,6 @@ gitPublish = { id = "org.ajoberstar.git-publish", version = "4.2.2" } jmh = { id = "me.champeau.jmh", version = "0.7.2" } nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" } plantuml = { id = "io.freefair.plantuml", version = "8.10" } -shadow = { id = "com.gradleup.shadow", version = "8.3.1" } +shadow = { id = "com.gradleup.shadow", version = "8.3.2" } spotless = { id = "com.diffplug.spotless", version = "7.0.0.BETA2" } versions = { id = "com.github.ben-manes.versions", version = "0.51.0" } From 4a38d9b7d0ff79a7d5c64d0c7600c1d9aadcf0a8 Mon Sep 17 00:00:00 2001 From: Goooler Date: Thu, 19 Sep 2024 08:18:41 +0800 Subject: [PATCH 097/611] Remove the workaround for updating Shadow 8.3.1 --- .../kotlin/junitbuild/generator/GenerateJreRelatedSourceCode.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/gradle/plugins/code-generator/src/main/kotlin/junitbuild/generator/GenerateJreRelatedSourceCode.kt b/gradle/plugins/code-generator/src/main/kotlin/junitbuild/generator/GenerateJreRelatedSourceCode.kt index 918bcd53c468..b76ad39345d6 100644 --- a/gradle/plugins/code-generator/src/main/kotlin/junitbuild/generator/GenerateJreRelatedSourceCode.kt +++ b/gradle/plugins/code-generator/src/main/kotlin/junitbuild/generator/GenerateJreRelatedSourceCode.kt @@ -45,7 +45,6 @@ abstract class GenerateJreRelatedSourceCode : DefaultTask() { val codeResolver = DirectoryCodeResolver(templateDir.toPath()) val templateEngine = TemplateEngine.create(codeResolver, temporaryDir.toPath(), ContentType.Plain, javaClass.classLoader) - templateEngine.setCompileArgs("-proc:none") val templates = templateDir.walkTopDown() .filter { it.extension == "jte" } From 6be5547cf61318deefa14b693dd1adb2615106fc Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 05:28:16 +0000 Subject: [PATCH 098/611] Update dependency commons-io:commons-io to v2.17.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 38f572d9bb6c..c2bfa5d60d58 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -33,7 +33,7 @@ bartholdy = { module = "de.sormuras:bartholdy", version = "0.2.3" } bndlib = { module = "biz.aQute.bnd:biz.aQute.bndlib", version.ref = "bnd" } checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checkstyle" } classgraph = { module = "io.github.classgraph:classgraph", version = "4.8.176" } -commons-io = { module = "commons-io:commons-io", version = "2.16.1" } +commons-io = { module = "commons-io:commons-io", version = "2.17.0" } groovy4 = { module = "org.apache.groovy:groovy", version = "4.0.23" } groovy2-bom = { module = "org.codehaus.groovy:groovy-bom", version = "2.5.23" } hamcrest = { module = "org.hamcrest:hamcrest", version = "3.0" } From 81d347986208573a654196dfcb3e2ed09ab493a5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 19 Sep 2024 10:35:02 +0000 Subject: [PATCH 099/611] Update github/codeql-action digest to 294a9d9 --- .github/workflows/codeql-analysis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index dd0e5c3f69b9..c5749b412e72 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -32,7 +32,7 @@ jobs: - name: Check out repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - name: Initialize CodeQL - uses: github/codeql-action/init@8214744c546c1e5c8f03dde8fab3a7353211988d # v3 + uses: github/codeql-action/init@294a9d92911152fe08befb9ec03e240add280cb3 # v3 with: languages: ${{ matrix.language }} tools: latest @@ -44,4 +44,4 @@ jobs: -Dscan.tag.CodeQL \ allMainClasses - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@8214744c546c1e5c8f03dde8fab3a7353211988d # v3 + uses: github/codeql-action/analyze@294a9d92911152fe08befb9ec03e240add280cb3 # v3 From 014efd6c58b95b74d0e7ea257f3bd332dba28c80 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 20 Sep 2024 13:01:08 +0200 Subject: [PATCH 100/611] Fix step label --- .github/workflows/cross-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cross-version.yml b/.github/workflows/cross-version.yml index 6447cff19f84..9df3eeea19d7 100644 --- a/.github/workflows/cross-version.yml +++ b/.github/workflows/cross-version.yml @@ -45,7 +45,7 @@ jobs: website: jdk.java.net release: ${{ matrix.jdk.release || matrix.jdk.version }} version: latest - - name: "Set up JDK ${{ matrix.jdk.version }} (${{ matrix.jdk.distribution }})" + - name: "Set up JDK ${{ matrix.jdk.version }} (${{ matrix.jdk.distribution || 'temurin' }})" if: matrix.jdk.type == 'ga' uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 with: From ebbf1344ee53f67150d7a0280f8380cafec74908 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sat, 21 Sep 2024 10:58:46 +0200 Subject: [PATCH 101/611] Allow for work stealing when only holding read locks (#4012) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows tasks with only read locks to be stolen by threads that are currently holding only read locks. --------- Co-authored-by: Leonard Brünings --- .../support/hierarchical/CompositeLock.java | 28 +- .../hierarchical/ExclusiveResource.java | 11 + ...inPoolHierarchicalTestExecutorService.java | 12 +- .../support/hierarchical/LockManager.java | 67 ++-- .../engine/support/hierarchical/NopLock.java | 20 ++ .../support/hierarchical/ResourceLock.java | 45 ++- .../support/hierarchical/SingleLock.java | 44 +-- .../hierarchical/CompositeLockTests.java | 14 +- ...lHierarchicalTestExecutorServiceTests.java | 306 +++++++++++++++--- .../hierarchical/LockManagerTests.java | 8 +- .../hierarchical/ResourceLockTests.java | 146 ++++++--- .../support/hierarchical/SingleLockTests.java | 9 +- 12 files changed, 560 insertions(+), 150 deletions(-) diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/CompositeLock.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/CompositeLock.java index b09f1236f570..aff3111df90b 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/CompositeLock.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/CompositeLock.java @@ -10,22 +10,36 @@ package org.junit.platform.engine.support.hierarchical; +import static java.util.Collections.unmodifiableList; + import java.util.ArrayList; import java.util.List; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.locks.Lock; import org.junit.platform.commons.util.Preconditions; +import org.junit.platform.commons.util.ToStringBuilder; /** * @since 1.3 */ class CompositeLock implements ResourceLock { + private final List resources; private final List locks; + private final boolean exclusive; - CompositeLock(List locks) { + CompositeLock(List resources, List locks) { + Preconditions.condition(resources.size() == locks.size(), "Resources and locks must have the same size"); + this.resources = unmodifiableList(resources); this.locks = Preconditions.notEmpty(locks, "Locks must not be empty"); + this.exclusive = resources.stream().anyMatch( + resource -> resource.getLockMode() == ExclusiveResource.LockMode.READ_WRITE); + } + + @Override + public List getResources() { + return resources; } // for tests only @@ -64,6 +78,18 @@ private void release(List acquiredLocks) { } } + @Override + public boolean isExclusive() { + return exclusive; + } + + @Override + public String toString() { + return new ToStringBuilder(this) // + .append("resources", resources) // + .toString(); + } + private class CompositeLockManagedBlocker implements ForkJoinPool.ManagedBlocker { private volatile boolean acquired; diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ExclusiveResource.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ExclusiveResource.java index 4d090c3a69d9..621fe2ed211b 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ExclusiveResource.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ExclusiveResource.java @@ -10,8 +10,11 @@ package org.junit.platform.engine.support.hierarchical; +import static java.util.Comparator.comparing; +import static java.util.Comparator.naturalOrder; import static org.apiguardian.api.API.Status.STABLE; +import java.util.Comparator; import java.util.Objects; import java.util.concurrent.locks.ReadWriteLock; @@ -50,6 +53,14 @@ public class ExclusiveResource { static final ExclusiveResource GLOBAL_READ = new ExclusiveResource(GLOBAL_KEY, LockMode.READ); static final ExclusiveResource GLOBAL_READ_WRITE = new ExclusiveResource(GLOBAL_KEY, LockMode.READ_WRITE); + static final Comparator COMPARATOR // + = comparing(ExclusiveResource::getKey, globalKeyFirst().thenComparing(naturalOrder())) // + .thenComparing(ExclusiveResource::getLockMode); + + private static Comparator globalKeyFirst() { + return comparing(key -> !GLOBAL_KEY.equals(key)); + } + private final String key; private final LockMode lockMode; private int hash; diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorService.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorService.java index c6ed2cb4b585..fc0aae08f68c 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorService.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorService.java @@ -12,6 +12,7 @@ import static java.util.concurrent.CompletableFuture.completedFuture; import static org.apiguardian.api.API.Status.STABLE; +import static org.junit.platform.engine.support.hierarchical.ExclusiveResource.GLOBAL_READ_WRITE; import static org.junit.platform.engine.support.hierarchical.Node.ExecutionMode.CONCURRENT; import static org.junit.platform.engine.support.hierarchical.Node.ExecutionMode.SAME_THREAD; @@ -39,7 +40,6 @@ import org.junit.platform.commons.logging.LoggerFactory; import org.junit.platform.commons.util.ExceptionUtils; import org.junit.platform.engine.ConfigurationParameters; -import org.junit.platform.engine.support.hierarchical.SingleLock.GlobalReadWriteLock; /** * A {@link ForkJoinPool}-based @@ -53,7 +53,9 @@ @API(status = STABLE, since = "1.10") public class ForkJoinPoolHierarchicalTestExecutorService implements HierarchicalTestExecutorService { - private final ForkJoinPool forkJoinPool; + // package-private for testing + final ForkJoinPool forkJoinPool; + private final TaskEventListener taskEventListener; private final int parallelism; private final ThreadLocal threadLocks = ThreadLocal.withInitial(ThreadLock::new); @@ -170,7 +172,7 @@ private void forkConcurrentTasks(List tasks, Deque sameThreadTasks, Deque concurrentTasksInReverseOrder) { for (TestTask testTask : tasks) { ExclusiveTask exclusiveTask = new ExclusiveTask(testTask); - if (testTask.getResourceLock() instanceof GlobalReadWriteLock) { + if (requiresGlobalReadWriteLock(testTask)) { isolatedTasks.add(exclusiveTask); } else if (testTask.getExecutionMode() == SAME_THREAD) { @@ -183,6 +185,10 @@ else if (testTask.getExecutionMode() == SAME_THREAD) { } } + private static boolean requiresGlobalReadWriteLock(TestTask testTask) { + return testTask.getResourceLock().getResources().contains(GLOBAL_READ_WRITE); + } + private void executeSync(Deque tasks) { for (ExclusiveTask task : tasks) { task.execSync(); diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/LockManager.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/LockManager.java index be997dc5715a..8e055cab7f36 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/LockManager.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/LockManager.java @@ -12,18 +12,15 @@ import static java.util.Collections.emptyList; import static java.util.Collections.singletonList; -import static java.util.Comparator.comparing; -import static java.util.Comparator.naturalOrder; import static java.util.stream.Collectors.groupingBy; import static java.util.stream.Collectors.toList; import static org.junit.platform.commons.util.CollectionUtils.getOnlyElement; -import static org.junit.platform.engine.support.hierarchical.ExclusiveResource.GLOBAL_KEY; +import static org.junit.platform.commons.util.CollectionUtils.toUnmodifiableList; import static org.junit.platform.engine.support.hierarchical.ExclusiveResource.GLOBAL_READ; import static org.junit.platform.engine.support.hierarchical.ExclusiveResource.GLOBAL_READ_WRITE; import static org.junit.platform.engine.support.hierarchical.ExclusiveResource.LockMode.READ; import java.util.Collection; -import java.util.Comparator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -32,83 +29,75 @@ import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; -import org.junit.platform.engine.support.hierarchical.SingleLock.GlobalReadLock; -import org.junit.platform.engine.support.hierarchical.SingleLock.GlobalReadWriteLock; - /** * @since 1.3 */ class LockManager { - private static final Comparator COMPARATOR // - = comparing(ExclusiveResource::getKey, globalKeyFirst().thenComparing(naturalOrder())) // - .thenComparing(ExclusiveResource::getLockMode); - - private static Comparator globalKeyFirst() { - return comparing(key -> !GLOBAL_KEY.equals(key)); - } - private final Map locksByKey = new ConcurrentHashMap<>(); - private final GlobalReadLock globalReadLock; - private final GlobalReadWriteLock globalReadWriteLock; + private final SingleLock globalReadLock; + private final SingleLock globalReadWriteLock; public LockManager() { - globalReadLock = new GlobalReadLock(toLock(GLOBAL_READ)); - globalReadWriteLock = new GlobalReadWriteLock(toLock(GLOBAL_READ_WRITE)); + globalReadLock = new SingleLock(GLOBAL_READ, toLock(GLOBAL_READ)); + globalReadWriteLock = new SingleLock(GLOBAL_READ_WRITE, toLock(GLOBAL_READ_WRITE)); } ResourceLock getLockForResources(Collection resources) { - return toResourceLock(toDistinctSortedLocks(resources)); + return toResourceLock(toDistinctSortedResources(resources)); } ResourceLock getLockForResource(ExclusiveResource resource) { - return toResourceLock(toLock(resource)); + return toResourceLock(singletonList(resource)); } - private List toDistinctSortedLocks(Collection resources) { + private List toDistinctSortedResources(Collection resources) { if (resources.isEmpty()) { return emptyList(); } if (resources.size() == 1) { - return singletonList(toLock(getOnlyElement(resources))); + return singletonList(getOnlyElement(resources)); } // @formatter:off Map> resourcesByKey = resources.stream() - .sorted(COMPARATOR) + .sorted(ExclusiveResource.COMPARATOR) .distinct() .collect(groupingBy(ExclusiveResource::getKey, LinkedHashMap::new, toList())); return resourcesByKey.values().stream() .map(resourcesWithSameKey -> resourcesWithSameKey.get(0)) - .map(this::toLock) - .collect(toList()); + .collect(toUnmodifiableList()); // @formatter:on } - private Lock toLock(ExclusiveResource resource) { - ReadWriteLock lock = this.locksByKey.computeIfAbsent(resource.getKey(), key -> new ReentrantReadWriteLock()); - return resource.getLockMode() == READ ? lock.readLock() : lock.writeLock(); - } - - private ResourceLock toResourceLock(List locks) { - switch (locks.size()) { + private ResourceLock toResourceLock(List resources) { + switch (resources.size()) { case 0: return NopLock.INSTANCE; case 1: - return toResourceLock(locks.get(0)); + return toSingleLock(getOnlyElement(resources)); default: - return new CompositeLock(locks); + return new CompositeLock(resources, toLocks(resources)); } } - private ResourceLock toResourceLock(Lock lock) { - if (lock == toLock(GLOBAL_READ)) { + private SingleLock toSingleLock(ExclusiveResource resource) { + if (GLOBAL_READ.equals(resource)) { return globalReadLock; } - if (lock == toLock(GLOBAL_READ_WRITE)) { + if (GLOBAL_READ_WRITE.equals(resource)) { return globalReadWriteLock; } - return new SingleLock(lock); + return new SingleLock(resource, toLock(resource)); + } + + private List toLocks(List resources) { + return resources.stream().map(this::toLock).collect(toUnmodifiableList()); + } + + private Lock toLock(ExclusiveResource resource) { + ReadWriteLock lock = this.locksByKey.computeIfAbsent(resource.getKey(), key -> new ReentrantReadWriteLock()); + return resource.getLockMode() == READ ? lock.readLock() : lock.writeLock(); } } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NopLock.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NopLock.java index 6c885ecb0403..7cdd79592d53 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NopLock.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NopLock.java @@ -10,6 +10,12 @@ package org.junit.platform.engine.support.hierarchical; +import static java.util.Collections.emptyList; + +import java.util.List; + +import org.junit.platform.commons.util.ToStringBuilder; + /** * No-op {@link ResourceLock} implementation. * @@ -22,6 +28,11 @@ class NopLock implements ResourceLock { private NopLock() { } + @Override + public List getResources() { + return emptyList(); + } + @Override public ResourceLock acquire() { return this; @@ -32,4 +43,13 @@ public void release() { // nothing to do } + @Override + public boolean isExclusive() { + return false; + } + + @Override + public String toString() { + return new ToStringBuilder(this).toString(); + } } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ResourceLock.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ResourceLock.java index 19f6b4da061b..7e10c3ba7941 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ResourceLock.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ResourceLock.java @@ -12,6 +12,9 @@ import static org.apiguardian.api.API.Status.STABLE; +import java.util.List; +import java.util.Optional; + import org.apiguardian.api.API; /** @@ -43,12 +46,50 @@ default void close() { release(); } + /** + * {@return the exclusive resources this lock represents} + */ + List getResources(); + + /** + * {@return whether this lock requires exclusiveness} + */ + boolean isExclusive(); + /** * {@return whether the given lock is compatible with this lock} * @param other the other lock to check for compatibility */ default boolean isCompatible(ResourceLock other) { - return this instanceof NopLock || other instanceof NopLock; - } + List ownResources = this.getResources(); + List otherResources = other.getResources(); + + if (ownResources.isEmpty() || otherResources.isEmpty()) { + return true; + } + + // Whenever there's a READ_WRITE lock, it's incompatible with any other lock + // because we guarantee that all children will have exclusive access to the + // resource in question. In practice, whenever a READ_WRITE lock is present, + // NodeTreeWalker will force all children to run in the same thread so that + // it should never attempt to steal work from another thread, and we shouldn't + // actually reach this point. + // The global read lock (which is always on direct children of the engine node) + // needs special treatment so that it is compatible with the first write lock + // (which may be on a test method). + boolean isGlobalReadLock = ownResources.size() == 1 + && ExclusiveResource.GLOBAL_READ.equals(ownResources.get(0)); + if ((!isGlobalReadLock && other.isExclusive()) || this.isExclusive()) { + return false; + } + + Optional potentiallyDeadlockCausingAdditionalResource = otherResources.stream() // + .filter(resource -> !ownResources.contains(resource)) // + .findFirst() // + .filter(resource -> ExclusiveResource.COMPARATOR.compare(resource, + ownResources.get(ownResources.size() - 1)) < 0); + + return !(potentiallyDeadlockCausingAdditionalResource.isPresent()); + } } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleLock.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleLock.java index f3853dce4ee8..cfa9d2f3acf0 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleLock.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleLock.java @@ -10,20 +10,33 @@ package org.junit.platform.engine.support.hierarchical; +import static java.util.Collections.singletonList; +import static org.junit.platform.commons.util.CollectionUtils.getOnlyElement; + +import java.util.List; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.locks.Lock; +import org.junit.platform.commons.util.ToStringBuilder; + /** * @since 1.3 */ class SingleLock implements ResourceLock { + private final List resources; private final Lock lock; - SingleLock(Lock lock) { + SingleLock(ExclusiveResource resource, Lock lock) { + this.resources = singletonList(resource); this.lock = lock; } + @Override + public List getResources() { + return resources; + } + // for tests only Lock getLock() { return this.lock; @@ -40,6 +53,18 @@ public void release() { this.lock.unlock(); } + @Override + public boolean isExclusive() { + return resources.get(0).getLockMode() == ExclusiveResource.LockMode.READ_WRITE; + } + + @Override + public String toString() { + return new ToStringBuilder(this) // + .append("resource", getOnlyElement(resources)) // + .toString(); + } + private class SingleLockManagedBlocker implements ForkJoinPool.ManagedBlocker { private volatile boolean acquired; @@ -59,21 +84,4 @@ public boolean isReleasable() { } } - - static class GlobalReadLock extends SingleLock { - GlobalReadLock(Lock lock) { - super(lock); - } - - @Override - public boolean isCompatible(ResourceLock other) { - return !(other instanceof GlobalReadWriteLock); - } - } - - static class GlobalReadWriteLock extends SingleLock { - GlobalReadWriteLock(Lock lock) { - super(lock); - } - } } diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/CompositeLockTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/CompositeLockTests.java index 756c710e25c6..75e0a262f98e 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/CompositeLockTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/CompositeLockTests.java @@ -19,9 +19,11 @@ import java.util.List; import java.util.concurrent.CountDownLatch; import java.util.concurrent.locks.Lock; +import java.util.stream.IntStream; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.function.Executable; +import org.junit.platform.engine.support.hierarchical.ExclusiveResource.LockMode; /** * @since 1.3 @@ -34,7 +36,7 @@ void acquiresAllLocksInOrder() throws Exception { var lock1 = mock(Lock.class); var lock2 = mock(Lock.class); - new CompositeLock(List.of(lock1, lock2)).acquire(); + new CompositeLock(anyResources(2), List.of(lock1, lock2)).acquire(); var inOrder = inOrder(lock1, lock2); inOrder.verify(lock1).lockInterruptibly(); @@ -47,7 +49,7 @@ void releasesAllLocksInReverseOrder() throws Exception { var lock1 = mock(Lock.class); var lock2 = mock(Lock.class); - new CompositeLock(List.of(lock1, lock2)).acquire().close(); + new CompositeLock(anyResources(2), List.of(lock1, lock2)).acquire().close(); var inOrder = inOrder(lock1, lock2); inOrder.verify(lock2).unlock(); @@ -64,7 +66,7 @@ void releasesLocksInReverseOrderWhenInterruptedDuringAcquire() throws Exception var thread = new Thread(() -> { try { - new CompositeLock(List.of(firstLock, secondLock, unavailableLock)).acquire(); + new CompositeLock(anyResources(3), List.of(firstLock, secondLock, unavailableLock)).acquire(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); @@ -90,4 +92,10 @@ private Lock mockLock(String name, Executable lockAction) throws InterruptedExce return lock; } + private List anyResources(int n) { + return IntStream.range(0, n) // + .mapToObj(j -> new ExclusiveResource("key" + j, LockMode.READ)) // + .toList(); + } + } diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java index f3ee3d923ab6..2e0648df63bf 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java @@ -10,30 +10,48 @@ package org.junit.platform.engine.support.hierarchical; +import static java.util.concurrent.TimeUnit.SECONDS; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.params.provider.Arguments.arguments; import static org.junit.platform.engine.support.hierarchical.ExclusiveResource.GLOBAL_READ; import static org.junit.platform.engine.support.hierarchical.ExclusiveResource.GLOBAL_READ_WRITE; import static org.junit.platform.engine.support.hierarchical.Node.ExecutionMode.CONCURRENT; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicReference; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; +import org.junit.jupiter.api.function.Executable; import org.junit.jupiter.api.function.ThrowingConsumer; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; import org.junit.platform.commons.JUnitException; +import org.junit.platform.engine.support.hierarchical.ExclusiveResource.LockMode; import org.junit.platform.engine.support.hierarchical.ForkJoinPoolHierarchicalTestExecutorService.TaskEventListener; import org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutorService.TestTask; import org.junit.platform.engine.support.hierarchical.Node.ExecutionMode; +@Timeout(5) class ForkJoinPoolHierarchicalTestExecutorServiceTests { + DummyTaskFactory taskFactory = new DummyTaskFactory(); + LockManager lockManager = new LockManager(); + @Test void exceptionsFromInvalidConfigurationAreNotSwallowed() { var configuration = new DefaultParallelExecutionConfiguration(2, 1, 1, 1, 0, __ -> true); @@ -48,17 +66,53 @@ void exceptionsFromInvalidConfigurationAreNotSwallowed() { assertThat(exception).rootCause().isInstanceOf(IllegalArgumentException.class); } - @Test - @Timeout(5) - void defersTasksWithIncompatibleLocks() throws Exception { - var configuration = new DefaultParallelExecutionConfiguration(2, 2, 2, 2, 1, __ -> true); + static List incompatibleLockCombinations() { + return List.of(// + arguments(// + Set.of(GLOBAL_READ), // + Set.of(GLOBAL_READ_WRITE) // + ), // + arguments(// + Set.of(new ExclusiveResource("a", LockMode.READ)), // + Set.of(new ExclusiveResource("a", LockMode.READ_WRITE)) // + ), // + arguments(// + Set.of(new ExclusiveResource("a", LockMode.READ_WRITE)), // + Set.of(new ExclusiveResource("a", LockMode.READ_WRITE)) // + ), // + arguments(// + Set.of(GLOBAL_READ, new ExclusiveResource("a", LockMode.READ_WRITE)), // + Set.of(GLOBAL_READ, new ExclusiveResource("b", LockMode.READ_WRITE)) // + ), // + arguments(// + Set.of(new ExclusiveResource("b", LockMode.READ)), // + Set.of(new ExclusiveResource("a", LockMode.READ)) // + ), // + arguments(// + Set.of(GLOBAL_READ, new ExclusiveResource("a", LockMode.READ_WRITE)), // + Set.of(GLOBAL_READ, new ExclusiveResource("a", LockMode.READ)) // + ), // + arguments(// + Set.of(GLOBAL_READ_WRITE), // + Set.of(GLOBAL_READ) // + ), // + arguments(// + Set.of(GLOBAL_READ, new ExclusiveResource("a", LockMode.READ), + new ExclusiveResource("b", LockMode.READ), new ExclusiveResource("d", LockMode.READ)), + Set.of(GLOBAL_READ, new ExclusiveResource("a", LockMode.READ), + new ExclusiveResource("c", LockMode.READ)) // + )// + ); + } + + @ParameterizedTest + @MethodSource("incompatibleLockCombinations") + void defersTasksWithIncompatibleLocks(Set initialResources, + Set incompatibleResources) throws Throwable { - var lockManager = new LockManager(); - var globalReadLock = lockManager.getLockForResource(GLOBAL_READ); - var globalReadWriteLock = lockManager.getLockForResource(GLOBAL_READ_WRITE); - var nopLock = NopLock.INSTANCE; + var initialLock = lockManager.getLockForResources(initialResources); + var incompatibleLock = lockManager.getLockForResources(incompatibleResources); - var threadNamesByTaskIdentifier = new ConcurrentHashMap(); var deferred = new CountDownLatch(1); var deferredTask = new AtomicReference(); @@ -67,44 +121,198 @@ void defersTasksWithIncompatibleLocks() throws Exception { deferred.countDown(); }; - var isolatedTask = new DummyTestTask("isolatedTask", globalReadWriteLock, - t -> threadNamesByTaskIdentifier.put(t.identifier(), Thread.currentThread().getName())); + var incompatibleTask = taskFactory.create("incompatibleTask", incompatibleLock); - try (var pool = new ForkJoinPoolHierarchicalTestExecutorService(configuration, taskEventListener)) { + var tasks = runWithAttemptedWorkStealing(taskEventListener, incompatibleTask, initialLock, + () -> await(deferred, "Interrupted while waiting for task to be deferred")); - var bothLeafTasksAreRunning = new CountDownLatch(2); - var nestedTask = new DummyTestTask("nestedTask", globalReadLock, t -> { - threadNamesByTaskIdentifier.put(t.identifier(), Thread.currentThread().getName()); - var leafTask1 = new DummyTestTask("leafTask1", nopLock, t1 -> { - threadNamesByTaskIdentifier.put(t1.identifier(), Thread.currentThread().getName()); - pool.new ExclusiveTask(isolatedTask).fork(); - bothLeafTasksAreRunning.countDown(); - bothLeafTasksAreRunning.await(); - try { - deferred.await(); - } - catch (InterruptedException e) { - System.out.println("Interrupted while waiting for task to be deferred"); - } - }); - var leafTask2 = new DummyTestTask("leafTask2", nopLock, t2 -> { - threadNamesByTaskIdentifier.put(t2.identifier(), Thread.currentThread().getName()); - bothLeafTasksAreRunning.countDown(); - bothLeafTasksAreRunning.await(); + assertEquals(incompatibleTask, deferredTask.get()); + assertEquals(tasks.get("nestedTask").threadName, tasks.get("leafTaskB").threadName); + assertNotEquals(tasks.get("leafTaskA").threadName, tasks.get("leafTaskB").threadName); + } + + static List compatibleLockCombinations() { + return List.of(// + arguments(// + Set.of(GLOBAL_READ), // + Set.of(new ExclusiveResource("a", LockMode.READ)) // + ), // + arguments(// + Set.of(GLOBAL_READ), // + Set.of(new ExclusiveResource("a", LockMode.READ_WRITE)) // + ), // + arguments(// + Set.of(GLOBAL_READ), // + Set.of(GLOBAL_READ, new ExclusiveResource("a", LockMode.READ_WRITE)) // + ), // + arguments(// + Set.of(GLOBAL_READ), // + Set.of(GLOBAL_READ, new ExclusiveResource("a", LockMode.READ)) // + ), // + arguments(// + Set.of(GLOBAL_READ, new ExclusiveResource("a", LockMode.READ)), // + Set.of(GLOBAL_READ, new ExclusiveResource("a", LockMode.READ), + new ExclusiveResource("b", LockMode.READ), new ExclusiveResource("c", LockMode.READ)) // + ), // + arguments(// + Set.of(GLOBAL_READ, new ExclusiveResource("a", LockMode.READ)), // + Set.of(GLOBAL_READ, new ExclusiveResource("b", LockMode.READ)) // + ), // + arguments(// + Set.of(GLOBAL_READ, new ExclusiveResource("a", LockMode.READ)), // + Set.of(new ExclusiveResource("a", LockMode.READ), new ExclusiveResource("b", LockMode.READ), + new ExclusiveResource("c", LockMode.READ)) // + )// + ); + } + + @ParameterizedTest + @MethodSource("compatibleLockCombinations") + void canWorkStealTaskWithCompatibleLocks(Set initialResources, + Set compatibleResources) throws Throwable { + + var initialLock = lockManager.getLockForResources(initialResources); + var compatibleLock = lockManager.getLockForResources(compatibleResources); + + var deferredTask = new AtomicReference(); + + var workStolen = new CountDownLatch(1); + var compatibleTask = taskFactory.create("compatibleTask", compatibleLock, workStolen::countDown); + + var tasks = runWithAttemptedWorkStealing(deferredTask::set, compatibleTask, initialLock, + () -> await(workStolen, "Interrupted while waiting for work to be stolen")); + + assertNull(deferredTask.get()); + assertEquals(tasks.get("nestedTask").threadName, tasks.get("leafTaskB").threadName); + assertNotEquals(tasks.get("leafTaskA").threadName, tasks.get("leafTaskB").threadName); + } + + @Test + void defersTasksWithIncompatibleLocksOnMultipleLevels() throws Throwable { + + var initialLock = lockManager.getLockForResources( + Set.of(GLOBAL_READ, new ExclusiveResource("a", LockMode.READ))); + var incompatibleLock1 = lockManager.getLockForResource(new ExclusiveResource("a", LockMode.READ_WRITE)); + var compatibleLock1 = lockManager.getLockForResource(new ExclusiveResource("b", LockMode.READ)); + var incompatibleLock2 = lockManager.getLockForResource(new ExclusiveResource("b", LockMode.READ_WRITE)); + + var deferred = new ConcurrentHashMap(); + var deferredTasks = new CopyOnWriteArrayList(); + TaskEventListener taskEventListener = testTask -> { + deferredTasks.add(testTask); + deferred.get(testTask).countDown(); + }; + + var incompatibleTask1 = taskFactory.create("incompatibleTask1", incompatibleLock1); + deferred.put(incompatibleTask1, new CountDownLatch(1)); + + var incompatibleTask2 = taskFactory.create("incompatibleTask2", incompatibleLock2); + deferred.put(incompatibleTask2, new CountDownLatch(1)); + + var configuration = new DefaultParallelExecutionConfiguration(2, 2, 2, 2, 1, __1 -> true); + + withForkJoinPoolHierarchicalTestExecutorService(configuration, taskEventListener, service -> { + + var nestedTask2 = createNestedTaskWithTwoConcurrentLeafTasks(service, "2", compatibleLock1, + List.of(incompatibleTask2), // + () -> await(deferred.get(incompatibleTask2), incompatibleTask2.identifier + " to be deferred")); + + var nestedTask1 = createNestedTaskWithTwoConcurrentLeafTasks(service, "1", initialLock, + List.of(incompatibleTask1, nestedTask2), // + () -> { + await(deferred.get(incompatibleTask1), incompatibleTask1.identifier + " to be deferred"); + await(nestedTask2.started, nestedTask2.identifier + " to be started"); }); - pool.invokeAll(List.of(leafTask1, leafTask2)); + + service.submit(nestedTask1).get(); + }); + + assertThat(deferredTasks) // + .containsExactly(incompatibleTask1, incompatibleTask2, incompatibleTask1); // incompatibleTask1 may be deferred multiple times + assertThat(taskFactory.tasks) // + .hasSize(3 + 3 + 2) // + .values().extracting(it -> it.completion.isDone()).containsOnly(true); + assertThat(taskFactory.tasks) // + .values().extracting(it -> it.completion.isCompletedExceptionally()).containsOnly(false); + } + + private Map runWithAttemptedWorkStealing(TaskEventListener taskEventListener, + DummyTestTask taskToBeStolen, ResourceLock initialLock, Runnable waitAction) throws Throwable { + + var configuration = new DefaultParallelExecutionConfiguration(2, 2, 2, 2, 1, __ -> true); + + withForkJoinPoolHierarchicalTestExecutorService(configuration, taskEventListener, service -> { + + var nestedTask = createNestedTaskWithTwoConcurrentLeafTasks(service, "", initialLock, + List.of(taskToBeStolen), waitAction); + + service.submit(nestedTask).get(); + }); + + return taskFactory.tasks; + } + + private DummyTestTask createNestedTaskWithTwoConcurrentLeafTasks( + ForkJoinPoolHierarchicalTestExecutorService service, String identifierSuffix, ResourceLock parentLock, + List tasksToFork, Runnable waitAction) { + + return taskFactory.create("nestedTask" + identifierSuffix, parentLock, () -> { + + var bothLeafTasksAreRunning = new CountDownLatch(2); + + var leafTaskA = taskFactory.create("leafTaskA" + identifierSuffix, NopLock.INSTANCE, () -> { + tasksToFork.forEach(task -> service.new ExclusiveTask(task).fork()); + bothLeafTasksAreRunning.countDown(); + bothLeafTasksAreRunning.await(); + waitAction.run(); + }); + + var leafTaskB = taskFactory.create("leafTaskB" + identifierSuffix, NopLock.INSTANCE, () -> { + bothLeafTasksAreRunning.countDown(); + bothLeafTasksAreRunning.await(); }); - pool.submit(nestedTask).get(); + service.invokeAll(List.of(leafTaskA, leafTaskB)); + }); + } + + private static void await(CountDownLatch latch, String message) { + try { + latch.await(); + } + catch (InterruptedException e) { + System.out.println("Interrupted while waiting for " + message); } + } + + private void withForkJoinPoolHierarchicalTestExecutorService(ParallelExecutionConfiguration configuration, + TaskEventListener taskEventListener, ThrowingConsumer action) + throws Throwable { + try (var service = new ForkJoinPoolHierarchicalTestExecutorService(configuration, taskEventListener)) { + + action.accept(service); - assertEquals(isolatedTask, deferredTask.get()); - assertEquals(threadNamesByTaskIdentifier.get("nestedTask"), threadNamesByTaskIdentifier.get("leafTask2")); - assertNotEquals(threadNamesByTaskIdentifier.get("leafTask1"), threadNamesByTaskIdentifier.get("leafTask2")); + service.forkJoinPool.shutdown(); + assertTrue(service.forkJoinPool.awaitTermination(5, SECONDS), "Pool did not terminate within timeout"); + } } - record DummyTestTask(String identifier, ResourceLock resourceLock, ThrowingConsumer action) - implements TestTask { + static final class DummyTestTask implements TestTask { + + private final String identifier; + private final ResourceLock resourceLock; + private final Executable action; + + private volatile String threadName; + private final CountDownLatch started = new CountDownLatch(1); + private final CompletableFuture completion = new CompletableFuture<>(); + + DummyTestTask(String identifier, ResourceLock resourceLock, Executable action) { + this.identifier = identifier; + this.resourceLock = resourceLock; + this.action = action; + } + @Override public ExecutionMode getExecutionMode() { return CONCURRENT; @@ -117,10 +325,14 @@ public ResourceLock getResourceLock() { @Override public void execute() { + threadName = Thread.currentThread().getName(); + started.countDown(); try { - action.accept(this); + action.execute(); + completion.complete(null); } catch (Throwable e) { + completion.completeExceptionally(e); throw new RuntimeException("Action " + identifier + " failed", e); } } @@ -130,4 +342,20 @@ public String toString() { return identifier; } } + + static final class DummyTaskFactory { + + final Map tasks = new HashMap<>(); + + DummyTestTask create(String identifier, ResourceLock resourceLock) { + return create(identifier, resourceLock, () -> { + }); + } + + DummyTestTask create(String identifier, ResourceLock resourceLock, Executable action) { + DummyTestTask task = new DummyTestTask(identifier, resourceLock, action); + tasks.put(task.identifier, task); + return task; + } + } } diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/LockManagerTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/LockManagerTests.java index c9cb0570027e..a1cb3efd1483 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/LockManagerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/LockManagerTests.java @@ -112,20 +112,20 @@ void globalLockComesFirst(LockMode globalLockMode) { } @Test - void usesSpecialClassForGlobalReadLock() { + void usesSingleInstanceForGlobalReadLock() { var lock = lockManager.getLockForResources(List.of(ExclusiveResource.GLOBAL_READ)); assertThat(lock) // - .isInstanceOf(SingleLock.GlobalReadLock.class) // + .isInstanceOf(SingleLock.class) // .isSameAs(lockManager.getLockForResource(ExclusiveResource.GLOBAL_READ)); } @Test - void usesSpecialClassForGlobalReadWriteLock() { + void usesSingleInstanceForGlobalReadWriteLock() { var lock = lockManager.getLockForResources(List.of(ExclusiveResource.GLOBAL_READ_WRITE)); assertThat(lock) // - .isInstanceOf(SingleLock.GlobalReadWriteLock.class) // + .isInstanceOf(SingleLock.class) // .isSameAs(lockManager.getLockForResource(ExclusiveResource.GLOBAL_READ_WRITE)); } diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ResourceLockTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ResourceLockTests.java index ca80c33d6131..2372ff27de42 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ResourceLockTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ResourceLockTests.java @@ -12,71 +12,139 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.platform.engine.support.hierarchical.ExclusiveResource.GLOBAL_READ; +import static org.junit.platform.engine.support.hierarchical.ExclusiveResource.GLOBAL_READ_WRITE; +import java.util.Arrays; import java.util.List; +import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import org.junit.jupiter.api.Test; +import org.junit.platform.engine.support.hierarchical.ExclusiveResource.LockMode; -@SuppressWarnings("resource") class ResourceLockTests { @Test - void nopLocksAreCompatibleWithEverything() { - var nopLock = NopLock.INSTANCE; - - assertTrue(nopLock.isCompatible(NopLock.INSTANCE)); - assertTrue(nopLock.isCompatible(new SingleLock(anyReentrantLock()))); - assertTrue(nopLock.isCompatible(new SingleLock.GlobalReadLock(anyReentrantLock()))); - assertTrue(nopLock.isCompatible(new SingleLock.GlobalReadWriteLock(anyReentrantLock()))); - assertTrue(nopLock.isCompatible(new CompositeLock(List.of(anyReentrantLock())))); + void nopLocks() { + assertCompatible(nopLock(), nopLock()); + assertCompatible(nopLock(), singleLock(anyReadOnlyResource())); + assertCompatible(nopLock(), compositeLock(anyReadOnlyResource())); } @Test - void singleLocksAreIncompatibleWithNonNopLocks() { - var singleLock = new SingleLock(anyReentrantLock()); + void readOnlySingleLocks() { + ExclusiveResource bR = readOnlyResource("b"); + + assertCompatible(singleLock(bR), nopLock()); + assertCompatible(singleLock(bR), singleLock(bR)); + assertIncompatible(singleLock(bR), singleLock(readWriteResource("b")), "read-write conflict"); + assertIncompatible(singleLock(bR), singleLock(readOnlyResource("a")), "lock acquisition order"); + assertCompatible(singleLock(bR), singleLock(readOnlyResource("c"))); + assertIncompatible(singleLock(bR), singleLock(GLOBAL_READ), "lock acquisition order"); + assertIncompatible(singleLock(bR), singleLock(GLOBAL_READ_WRITE), "lock acquisition order"); + assertCompatible(singleLock(bR), compositeLock(bR, readOnlyResource("c"))); + assertIncompatible(singleLock(bR), compositeLock(readOnlyResource("a1"), readOnlyResource("a2"), bR), + "lock acquisition order"); + } - assertTrue(singleLock.isCompatible(NopLock.INSTANCE)); - assertFalse(singleLock.isCompatible(new SingleLock(anyReentrantLock()))); - assertFalse(singleLock.isCompatible(new SingleLock.GlobalReadLock(anyReentrantLock()))); - assertFalse(singleLock.isCompatible(new SingleLock.GlobalReadWriteLock(anyReentrantLock()))); - assertFalse(singleLock.isCompatible(new CompositeLock(List.of(anyReentrantLock())))); + @Test + void readWriteSingleLocks() { + ExclusiveResource bRW = readWriteResource("b"); + + assertCompatible(singleLock(bRW), nopLock()); + assertIncompatible(singleLock(bRW), singleLock(bRW), "isolation guarantees"); + assertIncompatible(singleLock(bRW), compositeLock(bRW), "isolation guarantees"); + assertIncompatible(singleLock(bRW), singleLock(readOnlyResource("a")), "lock acquisition order"); + assertIncompatible(singleLock(bRW), singleLock(readOnlyResource("b")), "isolation guarantees"); + assertIncompatible(singleLock(bRW), singleLock(readOnlyResource("c")), "isolation guarantees"); + assertIncompatible(singleLock(bRW), singleLock(GLOBAL_READ), "lock acquisition order"); + assertIncompatible(singleLock(bRW), singleLock(GLOBAL_READ_WRITE), "lock acquisition order"); + assertIncompatible(singleLock(bRW), compositeLock(bRW, readOnlyResource("c")), "isolation guarantees"); + assertIncompatible(singleLock(bRW), compositeLock(readOnlyResource("a1"), readOnlyResource("a2"), bRW), + "lock acquisition order"); } @Test - void globalReadLockIsCompatibleWithEverythingExceptGlobalReadWriteLock() { - var globalReadLock = new SingleLock.GlobalReadLock(anyReentrantLock()); + void globalReadLock() { + assertCompatible(singleLock(GLOBAL_READ), nopLock()); + assertCompatible(singleLock(GLOBAL_READ), singleLock(GLOBAL_READ)); + assertCompatible(singleLock(GLOBAL_READ), singleLock(anyReadOnlyResource())); + assertCompatible(singleLock(GLOBAL_READ), singleLock(anyReadWriteResource())); + assertIncompatible(singleLock(GLOBAL_READ), singleLock(GLOBAL_READ_WRITE), "read-write conflict"); + } - assertTrue(globalReadLock.isCompatible(NopLock.INSTANCE)); - assertTrue(globalReadLock.isCompatible(new SingleLock(anyReentrantLock()))); - assertTrue(globalReadLock.isCompatible(new SingleLock.GlobalReadLock(anyReentrantLock()))); - assertFalse(globalReadLock.isCompatible(new SingleLock.GlobalReadWriteLock(anyReentrantLock()))); - assertTrue(globalReadLock.isCompatible(new CompositeLock(List.of(anyReentrantLock())))); + @Test + void readOnlyCompositeLocks() { + ExclusiveResource bR = readOnlyResource("b"); + + assertCompatible(compositeLock(bR), nopLock()); + assertCompatible(compositeLock(bR), singleLock(bR)); + assertCompatible(compositeLock(bR), compositeLock(bR)); + assertIncompatible(compositeLock(bR), singleLock(GLOBAL_READ), "lock acquisition order"); + assertIncompatible(compositeLock(bR), singleLock(GLOBAL_READ_WRITE), "lock acquisition order"); + assertIncompatible(compositeLock(bR), compositeLock(readOnlyResource("a")), "lock acquisition order"); + assertCompatible(compositeLock(bR), compositeLock(readOnlyResource("c"))); + assertIncompatible(compositeLock(bR), compositeLock(readWriteResource("b")), "read-write conflict"); + assertIncompatible(compositeLock(bR), compositeLock(bR, readWriteResource("b")), "read-write conflict"); } @Test - void globalReadWriteLockIsIncompatibleWithWithNonNopLocks() { - var globalReadWriteLock = new SingleLock.GlobalReadWriteLock(anyReentrantLock()); + void readWriteCompositeLocks() { + ExclusiveResource bRW = readWriteResource("b"); + + assertCompatible(compositeLock(bRW), nopLock()); + assertIncompatible(compositeLock(bRW), singleLock(bRW), "isolation guarantees"); + assertIncompatible(compositeLock(bRW), compositeLock(bRW), "isolation guarantees"); + assertIncompatible(compositeLock(bRW), singleLock(readOnlyResource("a")), "lock acquisition order"); + assertIncompatible(compositeLock(bRW), singleLock(readOnlyResource("b")), "isolation guarantees"); + assertIncompatible(compositeLock(bRW), singleLock(readOnlyResource("c")), "isolation guarantees"); + assertIncompatible(compositeLock(bRW), singleLock(GLOBAL_READ), "lock acquisition order"); + assertIncompatible(compositeLock(bRW), singleLock(GLOBAL_READ_WRITE), "lock acquisition order"); + assertIncompatible(compositeLock(bRW), compositeLock(readOnlyResource("a")), "lock acquisition order"); + assertIncompatible(compositeLock(bRW), compositeLock(readOnlyResource("b"), readOnlyResource("c")), + "isolation guarantees"); + } - assertTrue(globalReadWriteLock.isCompatible(NopLock.INSTANCE)); - assertFalse(globalReadWriteLock.isCompatible(new SingleLock(anyReentrantLock()))); - assertFalse(globalReadWriteLock.isCompatible(new SingleLock.GlobalReadLock(anyReentrantLock()))); - assertFalse(globalReadWriteLock.isCompatible(new SingleLock.GlobalReadWriteLock(anyReentrantLock()))); - assertFalse(globalReadWriteLock.isCompatible(new CompositeLock(List.of(anyReentrantLock())))); + private static void assertCompatible(ResourceLock first, ResourceLock second) { + assertTrue(first.isCompatible(second), + "Expected locks to be compatible:\n(1) %s\n(2) %s".formatted(first, second)); } - @Test - void compositeLocksAreIncompatibleWithNonNopLocks() { - CompositeLock compositeLock = new CompositeLock(List.of(anyReentrantLock())); + private static void assertIncompatible(ResourceLock first, ResourceLock second, String reason) { + assertFalse(first.isCompatible(second), + "Expected locks to be incompatible due to %s:\n(1) %s\n(2) %s".formatted(reason, first, second)); + } + + private static ResourceLock nopLock() { + return NopLock.INSTANCE; + } + + private static SingleLock singleLock(ExclusiveResource resource) { + return new SingleLock(resource, anyLock()); + } + + private static CompositeLock compositeLock(ExclusiveResource... resources) { + return new CompositeLock(List.of(resources), Arrays.stream(resources).map(__ -> anyLock()).toList()); + } + + private static ExclusiveResource anyReadOnlyResource() { + return readOnlyResource("key"); + } + + private static ExclusiveResource anyReadWriteResource() { + return readWriteResource("key"); + } + + private static ExclusiveResource readOnlyResource(String key) { + return new ExclusiveResource(key, LockMode.READ); + } - assertTrue(compositeLock.isCompatible(NopLock.INSTANCE)); - assertFalse(compositeLock.isCompatible(new SingleLock(anyReentrantLock()))); - assertFalse(compositeLock.isCompatible(new SingleLock.GlobalReadLock(anyReentrantLock()))); - assertFalse(compositeLock.isCompatible(new SingleLock.GlobalReadWriteLock(anyReentrantLock()))); - assertFalse(compositeLock.isCompatible(compositeLock)); + private static ExclusiveResource readWriteResource(String key) { + return new ExclusiveResource(key, LockMode.READ_WRITE); } - private static ReentrantLock anyReentrantLock() { + private static Lock anyLock() { return new ReentrantLock(); } } diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SingleLockTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SingleLockTests.java index edf36cf66d4e..d4a9ef75e0cb 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SingleLockTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SingleLockTests.java @@ -16,6 +16,7 @@ import java.util.concurrent.locks.ReentrantLock; import org.junit.jupiter.api.Test; +import org.junit.platform.engine.support.hierarchical.ExclusiveResource.LockMode; /** * @since 1.3 @@ -27,7 +28,7 @@ class SingleLockTests { void acquire() throws Exception { var lock = new ReentrantLock(); - new SingleLock(lock).acquire(); + new SingleLock(anyResource(), lock).acquire(); assertTrue(lock.isLocked()); } @@ -37,9 +38,13 @@ void acquire() throws Exception { void release() throws Exception { var lock = new ReentrantLock(); - new SingleLock(lock).acquire().close(); + new SingleLock(anyResource(), lock).acquire().close(); assertFalse(lock.isLocked()); } + private static ExclusiveResource anyResource() { + return new ExclusiveResource("key", LockMode.READ); + } + } From 464516ab5816420f2298e179a2629d2b40478b25 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 22 Sep 2024 15:23:40 +0000 Subject: [PATCH 102/611] Update dependency com.github.marschall:memoryfilesystem to v2.8.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c2bfa5d60d58..0a66e230564e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -52,7 +52,7 @@ log4j-core = { module = "org.apache.logging.log4j:log4j-core", version.ref = "lo log4j-jul = { module = "org.apache.logging.log4j:log4j-jul", version.ref = "log4j" } maven = { module = "org.apache.maven:apache-maven", version = "3.9.9" } mavenSurefirePlugin = { module = "org.apache.maven.plugins:maven-surefire-plugin", version.ref = "surefire" } -memoryfilesystem = { module = "com.github.marschall:memoryfilesystem", version = "2.8.0" } +memoryfilesystem = { module = "com.github.marschall:memoryfilesystem", version = "2.8.1" } mockito = { module = "org.mockito:mockito-junit-jupiter", version = "5.13.0" } nohttp-checkstyle = { module = "io.spring.nohttp:nohttp-checkstyle", version = "0.0.11" } opentest4j = { module = "org.opentest4j:opentest4j", version.ref = "opentest4j" } From eba01d8de45ff1b160ab03facf88ef204798f069 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 23 Sep 2024 08:05:09 +0200 Subject: [PATCH 103/611] Reduce flakiness --- .../ForkJoinPoolHierarchicalTestExecutorServiceTests.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java index 2e0648df63bf..46c5bcc6cafe 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java @@ -228,7 +228,9 @@ void defersTasksWithIncompatibleLocksOnMultipleLevels() throws Throwable { }); assertThat(deferredTasks) // - .containsExactly(incompatibleTask1, incompatibleTask2, incompatibleTask1); // incompatibleTask1 may be deferred multiple times + .startsWith(incompatibleTask1, incompatibleTask2) // + .containsOnly(incompatibleTask1, incompatibleTask2) // incompatibleTask1 may be deferred multiple times + .containsOnlyOnce(incompatibleTask2); assertThat(taskFactory.tasks) // .hasSize(3 + 3 + 2) // .values().extracting(it -> it.completion.isDone()).containsOnly(true); From 6dbfd468f49b458f44aa21bc92cf3e8aac848f3b Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 23 Sep 2024 08:24:49 +0200 Subject: [PATCH 104/611] Improve failure message to investigate flakiness --- .../junit/platform/commons/util/ClasspathResource.java | 8 ++++++++ .../commons/support/ReflectionSupportTests.java | 10 ++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathResource.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathResource.java index 720c5166c297..af1944cc20e4 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathResource.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathResource.java @@ -52,4 +52,12 @@ public boolean equals(Object o) { public int hashCode() { return Objects.hash(name, uri); } + + @Override + public String toString() { + return new ToStringBuilder(this) // + .append("name", name) // + .append("uri", uri) // + .toString(); + } } diff --git a/platform-tests/src/test/java/org/junit/platform/commons/support/ReflectionSupportTests.java b/platform-tests/src/test/java/org/junit/platform/commons/support/ReflectionSupportTests.java index adb986154b79..549a2bee7f8f 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/support/ReflectionSupportTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/support/ReflectionSupportTests.java @@ -142,8 +142,9 @@ List findAllResourcesInClasspathRootDelegates() throws Throwable { for (var path : paths) { var root = path.toUri(); tests.add(DynamicTest.dynamicTest(createDisplayName(root), - () -> assertEquals(ReflectionUtils.findAllResourcesInClasspathRoot(root, allResources), - ReflectionSupport.findAllResourcesInClasspathRoot(root, allResources)))); + () -> assertThat(ReflectionUtils.findAllResourcesInClasspathRoot(root, allResources)) // + .containsExactlyElementsOf( + ReflectionSupport.findAllResourcesInClasspathRoot(root, allResources)))); } return tests; } @@ -172,8 +173,9 @@ List streamAllResourcesInClasspathRootDelegates() throws Throwable for (var path : paths) { var root = path.toUri(); tests.add(DynamicTest.dynamicTest(createDisplayName(root), - () -> assertEquals(ReflectionUtils.streamAllResourcesInClasspathRoot(root, allResources).toList(), - ReflectionSupport.streamAllResourcesInClasspathRoot(root, allResources).toList()))); + () -> assertThat(ReflectionUtils.streamAllResourcesInClasspathRoot(root, allResources)) // + .containsExactlyElementsOf( + ReflectionSupport.streamAllResourcesInClasspathRoot(root, allResources).toList()))); } return tests; } From e8c92f8cdeafe80ae485da4b4d8bd77f7b33e345 Mon Sep 17 00:00:00 2001 From: Clemens L Date: Thu, 19 Sep 2024 15:05:00 +0200 Subject: [PATCH 105/611] =?UTF-8?q?Support=20nullable=20Java=20Date/Time?= =?UTF-8?q?=20arguments=20in=20@=E2=81=A0ParameterizedTests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #4010 Closes #4013 --- .../release-notes-5.12.0-M1.adoc | 4 ++- .../converter/JavaTimeArgumentConverter.java | 6 ++++- .../converter/JavaTimeConversionPattern.java | 12 +++++++++ .../JavaTimeArgumentConverterTests.java | 25 +++++++++++++++++++ 4 files changed, 45 insertions(+), 2 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index a2de2236b463..c37680f13b5d 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -47,7 +47,9 @@ JUnit repository on GitHub. [[release-notes-5.12.0-M1-junit-jupiter-new-features-and-improvements]] ==== New Features and Improvements -* ❓ +* In a `@ParameterizedTest` method, a `null` value can now be supplied for Java Date/Time + types such as `LocalDate` if the new `nullable` attribute in + `@JavaTimeConversionPattern` is set to `true`. [[release-notes-5.12.0-M1-junit-vintage]] diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/JavaTimeArgumentConverter.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/JavaTimeArgumentConverter.java index 26fe98e29df0..eb688ae3fd6b 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/JavaTimeArgumentConverter.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/JavaTimeArgumentConverter.java @@ -52,7 +52,11 @@ class JavaTimeArgumentConverter extends AnnotationBasedArgumentConverter targetClass, JavaTimeConversionPattern annotation) { if (input == null) { - throw new ArgumentConversionException("Cannot convert null to " + targetClass.getName()); + if (annotation.nullable()) { + return null; + } + throw new ArgumentConversionException( + "Cannot convert null to " + targetClass.getName() + "; consider setting 'nullable = true'"); } TemporalQuery temporalQuery = TEMPORAL_QUERIES.get(targetClass); if (temporalQuery == null) { diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/JavaTimeConversionPattern.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/JavaTimeConversionPattern.java index d5ec9d509453..3c8d26526d44 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/JavaTimeConversionPattern.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/JavaTimeConversionPattern.java @@ -10,6 +10,7 @@ package org.junit.jupiter.params.converter; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.STABLE; import java.lang.annotation.Documented; @@ -45,4 +46,15 @@ */ String value(); + /** + * Whether {@code null} argument values are allowed. + * + *

Defaults to {@code false}, in which case a {@code null} value will result in + * an exception. + * + * @since 5.12 + */ + @API(status = EXPERIMENTAL, since = "5.12") + boolean nullable() default false; + } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/JavaTimeArgumentConverterTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/JavaTimeArgumentConverterTests.java index 3983886cd476..095fcb983176 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/JavaTimeArgumentConverterTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/JavaTimeArgumentConverterTests.java @@ -110,10 +110,35 @@ void throwsExceptionOnInvalidTargetType() { assertThat(exception).hasMessage("Cannot convert to java.lang.Integer: 2017"); } + /** + * @since 5.12 + */ + @Test + void throwsExceptionOnNullParameterWithoutNullable() { + var exception = assertThrows(ArgumentConversionException.class, + () -> convert(null, "dd.MM.yyyy", LocalDate.class)); + + assertThat(exception).hasMessage( + "Cannot convert null to java.time.LocalDate; consider setting 'nullable = true'"); + } + + /** + * @since 5.12 + */ + @Test + void convertsNullableParameter() { + assertThat(convert(null, "dd.MM.yyyy", true, LocalDate.class)).isNull(); + } + private Object convert(Object input, String pattern, Class targetClass) { + return convert(input, pattern, false, targetClass); + } + + private Object convert(Object input, String pattern, boolean nullable, Class targetClass) { var converter = new JavaTimeArgumentConverter(); var annotation = mock(JavaTimeConversionPattern.class); when(annotation.value()).thenReturn(pattern); + when(annotation.nullable()).thenReturn(nullable); return converter.convert(input, targetClass, annotation); } From 926e31f87334ababc45bd31b0accdb54f909041b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2024 22:57:29 +0000 Subject: [PATCH 106/611] Update dependency gradle to v8.10.2 --- gradle/wrapper/gradle-wrapper.jar | Bin 43504 -> 43583 bytes gradle/wrapper/gradle-wrapper.properties | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 2c3521197d7c4586c843d1d3e9090525f1898cde..a4b76b9530d66f5e68d973ea569d8e19de379189 100644 GIT binary patch delta 3990 zcmV;H4{7l5(*nQL0Kr1kzC=_KMxQY0|W5(lc#i zH*M1^P4B}|{x<+fkObwl)u#`$GxKKV&3pg*-y6R6txw)0qU|Clf9Uds3x{_-**c=7 z&*)~RHPM>Rw#Hi1R({;bX|7?J@w}DMF>dQQU2}9yj%iLjJ*KD6IEB2^n#gK7M~}6R zkH+)bc--JU^pV~7W=3{E*4|ZFpDpBa7;wh4_%;?XM-5ZgZNnVJ=vm!%a2CdQb?oTa z70>8rTb~M$5Tp!Se+4_OKWOB1LF+7gv~$$fGC95ToUM(I>vrd$>9|@h=O?eARj0MH zT4zo(M>`LWoYvE>pXvqG=d96D-4?VySz~=tPVNyD$XMshoTX(1ZLB5OU!I2OI{kb) zS8$B8Qm>wLT6diNnyJZC?yp{Kn67S{TCOt-!OonOK7$K)e-13U9GlnQXPAb&SJ0#3 z+vs~+4Qovv(%i8g$I#FCpCG^C4DdyQw3phJ(f#y*pvNDQCRZ~MvW<}fUs~PL=4??j zmhPyg<*I4RbTz|NHFE-DC7lf2=}-sGkE5e!RM%3ohM7_I^IF=?O{m*uUPH(V?gqyc(Rp?-Qu(3bBIL4Fz(v?=_Sh?LbK{nqZMD>#9D_hNhaV$0ef3@9V90|0u#|PUNTO>$F=qRhg1duaE z0`v~X3G{8RVT@kOa-pU+z8{JWyP6GF*u2e8eKr7a2t1fuqQy)@d|Qn(%YLZ62TWtoX@$nL}9?atE#Yw`rd(>cr0gY;dT9~^oL;u)zgHUvxc2I*b&ZkGM-iq=&(?kyO(3}=P! zRp=rErEyMT5UE9GjPHZ#T<`cnD)jyIL!8P{H@IU#`e8cAG5jMK zVyKw7--dAC;?-qEu*rMr$5@y535qZ6p(R#+fLA_)G~!wnT~~)|s`}&fA(s6xXN`9j zP#Fd3GBa#HeS{5&8p?%DKUyN^X9cYUc6vq}D_3xJ&d@=6j(6BZKPl?!k1?!`f3z&a zR4ZF60Mx7oBxLSxGuzA*Dy5n-d2K=+)6VMZh_0KetK|{e;E{8NJJ!)=_E~1uu=A=r zrn&gh)h*SFhsQJo!f+wKMIE;-EOaMSMB@aXRU(UcnJhZW^B^mgs|M9@5WF@s6B0p& zm#CTz)yiQCgURE{%hjxHcJ6G&>G9i`7MyftL!QQd5 z@RflRs?7)99?X`kHNt>W3l7YqscBpi*R2+fsgABor>KVOu(i(`03aytf2UA!&SC9v z!E}whj#^9~=XHMinFZ;6UOJjo=mmNaWkv~nC=qH9$s-8roGeyaW-E~SzZ3Gg>j zZ8}<320rg4=$`M0nxN!w(PtHUjeeU?MvYgWKZ6kkzABK;vMN0|U;X9abJleJA(xy<}5h5P(5 z{RzAFPvMnX2m0yH0Jn2Uo-p`daE|(O`YQiC#jB8;6bVIUf?SY(k$#C0`d6qT`>Xe0+0}Oj0=F&*D;PVe=Z<=0AGI<6$gYLwa#r` zm449x*fU;_+J>Mz!wa;T-wldoBB%&OEMJgtm#oaI60TSYCy7;+$5?q!zi5K`u66Wq zvg)Fx$s`V3Em{=OEY{3lmh_7|08ykS&U9w!kp@Ctuzqe1JFOGz6%i5}Kmm9>^=gih z?kRxqLA<3@e=}G4R_?phW{4DVr?`tPfyZSN@R=^;P;?!2bh~F1I|fB7P=V=9a6XU5 z<#0f>RS0O&rhc&nTRFOW7&QhevP0#>j0eq<1@D5yAlgMl5n&O9X|Vq}%RX}iNyRFF z7sX&u#6?E~bm~N|z&YikXC=I0E*8Z$v7PtWfjy)$e_Ez25fnR1Q=q1`;U!~U>|&YS zaOS8y!^ORmr2L4ik!IYR8@Dcx8MTC=(b4P6iE5CnrbI~7j7DmM8em$!da&D!6Xu)!vKPdLG z9f#)se|6=5yOCe)N6xDhPI!m81*dNe7u985zi%IVfOfJh69+#ag4ELzGne?o`eA`42K4T)h3S+s)5IT97%O>du- z0U54L8m4}rkRQ?QBfJ%DLssy^+a7Ajw;0&`NOTY4o;0-ivm9 zBz1C%nr_hQ)X)^QM6T1?=yeLkuG9Lf50(eH}`tFye;01&(p?8i+6h};VV-2B~qdxeC#=X z(JLlzy&fHkyi9Ksbcs~&r^%lh^2COldLz^H@X!s~mr9Dr6z!j+4?zkD@Ls7F8(t(f z9`U?P$Lmn*Y{K}aR4N&1N=?xtQ1%jqf1~pJyQ4SgBrEtR`j4lQuh7cqP49Em5cO=I zB(He2`iPN5M=Y0}h(IU$37ANTGx&|b-u1BYA*#dE(L-lptoOpo&th~E)_)y-`6kSH z3vvyVrcBwW^_XYReJ=JYd9OBQrzv;f2AQdZH#$Y{Y+Oa33M70XFI((fs;mB4e`<<{ ze4dv2B0V_?Ytsi>>g%qs*}oDGd5d(RNZ*6?7qNbdp7wP4T72=F&r?Ud#kZr8Ze5tB z_oNb7{G+(o2ajL$!69FW@jjPQ2a5C)m!MKKRirC$_VYIuVQCpf9rIms0GRDf)8AH${I`q^~5rjot@#3$2#zT2f`(N^P7Z;6(@EK$q*Jgif00I6*^ZGV+XB5uw*1R-@23yTw&WKD{s1;HTL;dO)%5i#`dc6b7;5@^{KU%N|A-$zsYw4)7LA{3`Zp>1 z-?K9_IE&z)dayUM)wd8K^29m-l$lFhi$zj0l!u~4;VGR6Y!?MAfBC^?QD53hy6VdD z@eUZIui}~L%#SmajaRq1J|#> z4m=o$vZ*34=ZWK2!QMNEcp2Lbc5N1q!lEDq(bz0b;WI9;e>l=CG9^n#ro`w>_0F$Q zfZ={2QyTkfByC&gy;x!r*NyXXbk=a%~~(#K?< zTke0HuF5{Q+~?@!KDXR|g+43$+;ab`^flS%miup_0OUTm=nIc%d5nLP)i308PIjl_YMF6cpQ__6&$n6it8K- z8PIjl_YMF6cpQ_!r)L8IivW`WdK8mBs6PXdjR2DYdK8nCs73=4j{uVadK8oNjwX|E wpAeHLsTu^*Y>Trk?aBtSQ(D-o$(D8Px^?ZI-PUB? z*1fv!{YdHme3Fc8%cR@*@zc5A_nq&2=R47Hp@$-JF4Fz*;SLw5}K^y>s-s;V!}b2i=5=M- zComP?ju>8Fe@=H@rlwe1l`J*6BTTo`9b$zjQ@HxrAhp0D#u?M~TxGC_!?ccCHCjt| zF*PgJf@kJB`|Ml}cmsyrAjO#Kjr^E5p29w+#>$C`Q|54BoDv$fQ9D?3n32P9LPMIzu?LjNqggOH=1@T{9bMn*u8(GI z!;MLTtFPHal^S>VcJdiYqX0VU|Rn@A}C1xOlxCribxes0~+n2 z6qDaIA2$?e`opx3_KW!rAgbpzU)gFdjAKXh|5w``#F0R|c)Y)Du0_Ihhz^S?k^pk% zP>9|pIDx)xHH^_~+aA=^$M!<8K~Hy(71nJGf6`HnjtS=4X4=Hk^O71oNia2V{HUCC zoN3RSBS?mZCLw;l4W4a+D8qc)XJS`pUJ5X-f^1ytxwr`@si$lAE?{4G|o; zO0l>`rr?;~c;{ZEFJ!!3=7=FdGJ?Q^xfNQh4A?i;IJ4}B+A?4olTK(fN++3CRBP97 ze~lG9h%oegkn)lpW-4F8o2`*WW0mZHwHez`ko@>U1_;EC_6ig|Drn@=DMV9YEUSCa zIf$kHei3(u#zm9I!Jf(4t`Vm1lltJ&lVHy(eIXE8sy9sUpmz%I_gA#8x^Zv8%w?r2 z{GdkX1SkzRIr>prRK@rqn9j2wG|rUvf6PJbbin=yy-TAXrguvzN8jL$hUrIXzr^s5 zVM?H4;eM-QeRFr06@ifV(ocvk?_)~N@1c2ien56UjWXid6W%6ievIh)>dk|rIs##^kY67ib8Kw%#-oVFaXG7$ERyA9(NSJUvWiOA5H(!{uOpcW zg&-?iqPhds%3%tFspHDqqr;A!e@B#iPQjHd=c>N1LoOEGRehVoPOdxJ>b6>yc#o#+ zl8s8!(|NMeqjsy@0x{8^j0d00SqRZjp{Kj)&4UHYGxG+z9b-)72I*&J70?+8e?p_@ z=>-(>l6z5vYlP~<2%DU02b!mA{7mS)NS_eLe=t)sm&+Pmk?asOEKlkPQ)EUvvfC=;4M&*|I!w}(@V_)eUKLA_t^%`o z0PM9LV|UKTLnk|?M3u!|f2S0?UqZsEIH9*NJS-8lzu;A6-rr-ot=dg9SASoluZUkFH$7X; zP=?kYX!K?JL-b~<#7wU;b;eS)O;@?h%sPPk{4xEBxb{!sm0AY|f9cNvx6>$3F!*0c z75H=dy8JvTyO8}g1w{$9T$p~5en}AeSLoCF>_RT9YPMpChUjl310o*$QocjbH& zbnwg#gssR#jDVN{uEi3n(PZ%PFZ|6J2 z5_rBf0-u>e4sFe0*Km49ATi7>Kn0f9!uc|rRMR1Dtt6m1LW8^>qFlo}h$@br=Rmpi z;mI&>OF64Be{dVeHI8utrh)v^wsZ0jii%x8UgZ8TC%K~@I(4E};GFW&(;WVov}3%H zH;IhRkfD^(vt^DjZz(MyHLZxv8}qzPc(%itBkBwf_fC~sDBgh<3XAv5cxxfF3<2U! z03Xe&z`is!JDHbe;mNmfkH+_LFE*I2^mdL@7(@9DfAcP6O04V-ko;Rpgp<%Cj5r8Z zd0`sXoIjV$j)--;jA6Zy^D5&5v$o^>e%>Q?9GLm{i~p^lAn!%ZtF$I~>39XVZxk0b zROh^Bk9cE0AJBLozZIEmy7xG(yHWGztvfnr0(2ro1%>zsGMS^EMu+S$r=_;9 zWwZkgf7Q7`H9sLf2Go^Xy6&h~a&%s2_T@_Csf19MntF$aVFiFkvE3_hUg(B@&Xw@YJ zpL$wNYf78=0c@!QU6_a$>CPiXT7QAGDM}7Z(0z#_ZA=fmLUj{2z7@Ypo71UDy8GHr z-&TLKf6a5WCf@Adle3VglBt4>Z>;xF}}-S~B7<(%B;Y z0QR55{z-buw>8ilNM3u6I+D$S%?)(p>=eBx-HpvZj{7c*_?K=d()*7q?93us}1dq%FAFYLsW8ZTQ_XZLh`P2*6(NgS}qGcfGXVWpwsp#Rs}IuKbk*`2}&) zI^Vsk6S&Q4@oYS?dJ`NwMVBs6f57+RxdqVub#PvMu?$=^OJy5xEl0<5SLsSRy%%a0 zi}Y#1-F3m;Ieh#Y12UgW?-R)|eX>ZuF-2cc!1>~NS|XSF-6In>zBoZg+ml!6%fk7U zw0LHcz8VQk(jOJ+Yu)|^|15ufl$KQd_1eUZZzj`aC%umU6F1&D5XVWce_wAe(qCSZ zpX-QF4e{EmEVN9~6%bR5U*UT{eMHfcUo`jw*u?4r2s_$`}U{?NjvEm(u&<>B|%mq$Q3weshxk z76<``8vh{+nX`@9CB6IE&z)I%IFjR^LH{s1p|eppv=x za(g_jLU|xjWMAn-V7th$f({|LG8zzIE0g?cyW;%Dmtv%C+0@xVxPE^ zyZzi9P%JAD6ynwHptuzP`Kox7*9h7XSMonCalv;Md0i9Vb-c*!f0ubfk?&T&T}AHh z4m8Bz{JllKcdNg?D^%a5MFQ;#1z|*}H^qHLzW)L}wp?2tY7RejtSh8<;Zw)QGJYUm z|MbTxyj*McKlStlT9I5XlSWtQGN&-LTr2XyNU+`490rg?LYLMRnz-@oKqT1hpCGqP zyRXt4=_Woj$%n5ee<3zhLF>5>`?m9a#xQH+Jk_+|RM8Vi;2*XbK- zEL6sCpaGPzP>k8f4Kh|##_imt#zJMB;ir|JrMPGW`rityK1vHXMLy18%qmMQAm4WZ zP)i30KR&5vs15)C+8dM66&$k~i|ZT;KR&5vs15)C+8dJ(sAmGPijyIz6_bsqKLSFH zlOd=TljEpH0>h4zA*dCTK&emy#FCRCs1=i^sZ9bFmXjf<6_X39E(XY)00000#N437 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8e876e1c5571..fb602ee2af06 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=1541fa36599e12857140465f3c91a97409b4512501c26f9631fb113e392c5bd1 -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip +distributionSha256Sum=31c55713e40233a8303827ceb42ca48a47267a0ad4bab9177123121e71524c26 +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME From 6c1cfe89ddf88f471a70a12b8a2260c180b13581 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 24 Sep 2024 17:35:40 +0000 Subject: [PATCH 107/611] Update actions/setup-java digest to b36c23c --- .github/actions/run-gradle/action.yml | 2 +- .github/actions/setup-test-jdk/action.yml | 2 +- .github/workflows/cross-version.yml | 4 ++-- .github/workflows/gradle-dependency-submission.yml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/actions/run-gradle/action.yml b/.github/actions/run-gradle/action.yml index f0ba06a50fd0..eb62935c74aa 100644 --- a/.github/actions/run-gradle/action.yml +++ b/.github/actions/run-gradle/action.yml @@ -8,7 +8,7 @@ inputs: runs: using: "composite" steps: - - uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 + - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 id: setup-gradle-jdk with: distribution: temurin diff --git a/.github/actions/setup-test-jdk/action.yml b/.github/actions/setup-test-jdk/action.yml index 9492cfae4ad6..69eeef2cccbc 100644 --- a/.github/actions/setup-test-jdk/action.yml +++ b/.github/actions/setup-test-jdk/action.yml @@ -8,7 +8,7 @@ inputs: runs: using: "composite" steps: - - uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 + - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 with: distribution: ${{ inputs.distribution }} java-version: 8 diff --git a/.github/workflows/cross-version.yml b/.github/workflows/cross-version.yml index 9df3eeea19d7..edc49ffb3429 100644 --- a/.github/workflows/cross-version.yml +++ b/.github/workflows/cross-version.yml @@ -47,7 +47,7 @@ jobs: version: latest - name: "Set up JDK ${{ matrix.jdk.version }} (${{ matrix.jdk.distribution || 'temurin' }})" if: matrix.jdk.type == 'ga' - uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 + uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 with: distribution: ${{ matrix.jdk.distribution || 'temurin' }} java-version: ${{ matrix.jdk.version }} @@ -80,7 +80,7 @@ jobs: with: distribution: semeru - name: 'Set up JDK ${{ matrix.jdk }}' - uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 + uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 with: distribution: semeru java-version: ${{ matrix.jdk }} diff --git a/.github/workflows/gradle-dependency-submission.yml b/.github/workflows/gradle-dependency-submission.yml index a2f98e37c62e..defbcfc5c0fe 100644 --- a/.github/workflows/gradle-dependency-submission.yml +++ b/.github/workflows/gradle-dependency-submission.yml @@ -18,7 +18,7 @@ jobs: with: fetch-depth: 1 - name: Setup Java - uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 + uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 with: distribution: temurin java-version: 21 From 12e6bae6f0c48cf24ec15f484c40f25db28d4275 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 25 Sep 2024 08:41:36 +0200 Subject: [PATCH 108/611] Switch to active fork of univocity-parsers --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0a66e230564e..f6bb172ea941 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -61,7 +61,7 @@ openTestReporting-tooling = { module = "org.opentest4j.reporting:open-test-repor picocli = { module = "info.picocli:picocli", version = "4.7.6" } slf4j-julBinding = { module = "org.slf4j:slf4j-jdk14", version = "2.0.16" } spock1 = { module = "org.spockframework:spock-core", version = "1.3-groovy-2.5" } -univocity-parsers = { module = "com.univocity:univocity-parsers", version = "2.9.1" } +univocity-parsers = { module = "com.sonofab1rd:univocity-parsers", version = "2.10.1" } xmlunit-assertj = { module = "org.xmlunit:xmlunit-assertj3", version.ref = "xmlunit" } xmlunit-placeholders = { module = "org.xmlunit:xmlunit-placeholders", version.ref = "xmlunit" } testingAnnotations = { module = "com.gradle:develocity-testing-annotations", version = "2.0.1" } From 88c30de09291755eff2bb9d2c6bf99984073a4fe Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 25 Sep 2024 06:42:17 +0000 Subject: [PATCH 109/611] Update github/codeql-action digest to 461ef6c --- .github/workflows/codeql-analysis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index c5749b412e72..59ef104881a6 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -32,7 +32,7 @@ jobs: - name: Check out repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - name: Initialize CodeQL - uses: github/codeql-action/init@294a9d92911152fe08befb9ec03e240add280cb3 # v3 + uses: github/codeql-action/init@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3 with: languages: ${{ matrix.language }} tools: latest @@ -44,4 +44,4 @@ jobs: -Dscan.tag.CodeQL \ allMainClasses - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@294a9d92911152fe08befb9ec03e240add280cb3 # v3 + uses: github/codeql-action/analyze@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3 From e8e69b85ec535c4a4b5fcb4f9594e5ba2cf1dbcc Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 24 Sep 2024 15:02:13 +0200 Subject: [PATCH 110/611] Finalize 5.11.1 release notes --- .../release-notes/release-notes-5.11.1.adoc | 35 ++++--------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc index f720d245b68b..4160643efd34 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc @@ -1,9 +1,9 @@ [[release-notes-5.11.1]] == 5.11.1 -*Date of Release:* ❓ +*Date of Release:* September 25, 2024 -*Scope:* minor bug fixes and improvements since 5.11.0 +*Scope:* Bug fixes and enhancements since 5.11.0 For a complete list of all _closed_ issues and pull requests for this release, consult the link:{junit5-repo}+/milestone/79?closed=1+[5.11.1] milestone page in the JUnit repository @@ -16,17 +16,14 @@ on GitHub. [[release-notes-5.11.1-junit-platform-bug-fixes]] ==== Bug Fixes -* Fixed potential locking issue with `ExclusiveResource` in the - `HierarchicalTestExecutorService`, which could lead to deadlocks in certain scenarios. +* Fix support for disabling ANSI colors on the console when the `NO_COLOR` environment + variable is available. * `NamespacedHierarchicalStore` no longer throws an exception after it has been closed if the store is queried via one of the `get(...)` or `getOrComputeIfAbsent(...)` methods; however, if a `getOrComputeIfAbsent(...)` invocation results in the computation of a new value, an exception will still be thrown. - -[[release-notes-5.11.1-junit-platform-deprecations-and-breaking-changes]] -==== Deprecations and Breaking Changes - -* ❓ +* Fixed potential locking issue with `ExclusiveResource` in the + `HierarchicalTestExecutorService`, which could lead to deadlocks in certain scenarios. [[release-notes-5.11.1-junit-platform-new-features-and-improvements]] ==== New Features and Improvements @@ -45,11 +42,6 @@ on GitHub. * `TestWatcher` callback methods can once again access data in the `ExtensionContext.Store`. -[[release-notes-5.11.1-junit-jupiter-deprecations-and-breaking-changes]] -==== Deprecations and Breaking Changes - -* ❓ - [[release-notes-5.11.1-junit-jupiter-new-features-and-improvements]] ==== New Features and Improvements @@ -60,17 +52,4 @@ on GitHub. [[release-notes-5.11.1-junit-vintage]] === JUnit Vintage -[[release-notes-5.11.1-junit-vintage-bug-fixes]] -==== Bug Fixes - -* ❓ - -[[release-notes-5.11.1-junit-vintage-deprecations-and-breaking-changes]] -==== Deprecations and Breaking Changes - -* ❓ - -[[release-notes-5.11.1-junit-vintage-new-features-and-improvements]] -==== New Features and Improvements - -* ❓ +No changes. From 212f6caa283222decfa7606cd86518a9ac2d31a9 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 25 Sep 2024 08:58:13 +0200 Subject: [PATCH 111/611] Release 5.11.1 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 58e6661c5847..059bbb33077b 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This repository is the home of _JUnit 5_. ## Latest Releases -- General Availability (GA): [JUnit 5.11.0](https://github.com/junit-team/junit5/releases/tag/r5.11.0) (August 14, 2024) +- General Availability (GA): [JUnit 5.11.1](https://github.com/junit-team/junit5/releases/tag/r5.11.1) (September 25, 2024) - Preview (Milestone/Release Candidate): N/A ## Documentation From 4ca72eaae58f649de1c486ef0eeaf59abf3ddf0e Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 25 Sep 2024 09:44:24 +0200 Subject: [PATCH 112/611] Resolve warning --- .github/workflows/codeql-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 59ef104881a6..f54716729bc6 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -35,7 +35,7 @@ jobs: uses: github/codeql-action/init@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3 with: languages: ${{ matrix.language }} - tools: latest + tools: linked - name: Build uses: ./.github/actions/run-gradle with: From ee104a3a2d78ad842384ae592396f0be17a226d5 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 25 Sep 2024 09:53:05 +0200 Subject: [PATCH 113/611] Use execute subcommand to avoid interlaced output making test flaky The deprecation warning was sometimes printed in between the regular output causing `AntStarterTests` to fail. --- platform-tooling-support-tests/projects/ant-starter/build.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/platform-tooling-support-tests/projects/ant-starter/build.xml b/platform-tooling-support-tests/projects/ant-starter/build.xml index 6c805ceb1ad7..79d22fcebc4a 100644 --- a/platform-tooling-support-tests/projects/ant-starter/build.xml +++ b/platform-tooling-support-tests/projects/ant-starter/build.xml @@ -51,6 +51,7 @@ + From 8491772aa3cde1f5e6b223b7838ba132266aac6a Mon Sep 17 00:00:00 2001 From: Tagir Valeev Date: Wed, 25 Sep 2024 09:54:52 +0200 Subject: [PATCH 114/611] Reduce stack utilization of TestTemplateTestDescriptor::execute (#4024) By getting rid of outer Stream API call. Resolves #4020. --- .../descriptor/TestTemplateTestDescriptor.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java index aa22bcbe70aa..90591e3c9a31 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java @@ -19,6 +19,7 @@ import java.util.List; import java.util.Optional; import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Stream; import org.apiguardian.api.API; import org.junit.jupiter.api.extension.ExtensionContext; @@ -100,14 +101,14 @@ public JupiterEngineExecutionContext execute(JupiterEngineExecutionContext conte List providers = validateProviders(extensionContext, context.getExtensionRegistry()); AtomicInteger invocationIndex = new AtomicInteger(); - // @formatter:off - providers.stream() - .flatMap(provider -> provider.provideTestTemplateInvocationContexts(extensionContext)) - .map(invocationContext -> createInvocationTestDescriptor(invocationContext, invocationIndex.incrementAndGet())) - .filter(Optional::isPresent) - .map(Optional::get) - .forEach(invocationTestDescriptor -> execute(dynamicTestExecutor, invocationTestDescriptor)); - // @formatter:on + for (TestTemplateInvocationContextProvider provider : providers) { + try (Stream stream = provider.provideTestTemplateInvocationContexts( + extensionContext)) { + stream.forEach(invocationContext -> createInvocationTestDescriptor(invocationContext, + invocationIndex.incrementAndGet()).ifPresent( + invocationTestDescriptor -> execute(dynamicTestExecutor, invocationTestDescriptor))); + } + } validateWasAtLeastInvokedOnce(invocationIndex.get(), providers); return context; } From c29dbb2d7f78161bf6adfe3bc187918610ce98ac Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 25 Sep 2024 10:01:42 +0200 Subject: [PATCH 115/611] Improve readability by renaming/extracting methods --- .../descriptor/TestTemplateTestDescriptor.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java index 90591e3c9a31..e6d78207d055 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java @@ -102,17 +102,21 @@ public JupiterEngineExecutionContext execute(JupiterEngineExecutionContext conte context.getExtensionRegistry()); AtomicInteger invocationIndex = new AtomicInteger(); for (TestTemplateInvocationContextProvider provider : providers) { - try (Stream stream = provider.provideTestTemplateInvocationContexts( - extensionContext)) { - stream.forEach(invocationContext -> createInvocationTestDescriptor(invocationContext, - invocationIndex.incrementAndGet()).ifPresent( - invocationTestDescriptor -> execute(dynamicTestExecutor, invocationTestDescriptor))); + try (Stream stream = invocationContexts(provider, extensionContext)) { + stream.forEach( + invocationContext -> toTestDescriptor(invocationContext, invocationIndex.incrementAndGet()) // + .ifPresent(testDescriptor -> execute(dynamicTestExecutor, testDescriptor))); } } validateWasAtLeastInvokedOnce(invocationIndex.get(), providers); return context; } + private static Stream invocationContexts( + TestTemplateInvocationContextProvider provider, ExtensionContext extensionContext) { + return provider.provideTestTemplateInvocationContexts(extensionContext); + } + private List validateProviders(ExtensionContext extensionContext, ExtensionRegistry extensionRegistry) { @@ -127,8 +131,7 @@ private List validateProviders(ExtensionC TestTemplateInvocationContextProvider.class.getSimpleName(), getTestMethod())); } - private Optional createInvocationTestDescriptor(TestTemplateInvocationContext invocationContext, - int index) { + private Optional toTestDescriptor(TestTemplateInvocationContext invocationContext, int index) { UniqueId uniqueId = getUniqueId().append(TestTemplateInvocationTestDescriptor.SEGMENT_TYPE, "#" + index); if (getDynamicDescendantFilter().test(uniqueId, index - 1)) { return Optional.of(new TestTemplateInvocationTestDescriptor(uniqueId, getTestClass(), getTestMethod(), From 54a6cb16e53f31885ede29e002d171bd588d558c Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 25 Sep 2024 10:55:24 +0200 Subject: [PATCH 116/611] Fix link to milestone page --- .../src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc index 4160643efd34..80af4a1a53d3 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.1.adoc @@ -6,7 +6,7 @@ *Scope:* Bug fixes and enhancements since 5.11.0 For a complete list of all _closed_ issues and pull requests for this release, consult the -link:{junit5-repo}+/milestone/79?closed=1+[5.11.1] milestone page in the JUnit repository +link:{junit5-repo}+/milestone/80?closed=1+[5.11.1] milestone page in the JUnit repository on GitHub. From ef63ac991544d4fceba7a430d0568cb78fd53c79 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 25 Sep 2024 12:21:38 +0200 Subject: [PATCH 117/611] Allow ArgumentsProvider implementations to use constructor injection Issue: #4018 --- .../asciidoc/user-guide/writing-tests.adoc | 9 ++++ .../java/example/ParameterizedTestDemo.java | 23 ++++++++ .../params/ParameterizedTestExtension.java | 45 +++++++++++----- .../params/provider/ArgumentsProvider.java | 4 +- .../ParameterizedTestExtensionTests.java | 48 +++++++++++------ .../ParameterizedTestIntegrationTests.java | 52 +++++++++++++++++++ 6 files changed, 149 insertions(+), 32 deletions(-) diff --git a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc index 463faad468c8..2dc985d9a872 100644 --- a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc +++ b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc @@ -1984,6 +1984,15 @@ If you wish to implement a custom `ArgumentsProvider` that also consumes an anno (like built-in providers such as `{ValueArgumentsProvider}` or `{CsvArgumentsProvider}`), you have the possibility to extend the `{AnnotationBasedArgumentsProvider}` class. +Moreover, `ArgumentsProvider` implementations may declare constructor parameters in case +they need to be resolved by a registered `ParameterResolver` as demonstrated in the +following example. + +[source,java,indent=0] +---- +include::{testDir}/example/ParameterizedTestDemo.java[tags=ArgumentsProviderWithConstructorInjection_example] +---- + [[writing-tests-parameterized-repeatable-sources]] ===== Multiple sources using repeatable annotations Repeatable annotations provide a convenient way to specify multiple sources from diff --git a/documentation/src/test/java/example/ParameterizedTestDemo.java b/documentation/src/test/java/example/ParameterizedTestDemo.java index 4d99f22c9311..9027b86d67e4 100644 --- a/documentation/src/test/java/example/ParameterizedTestDemo.java +++ b/documentation/src/test/java/example/ParameterizedTestDemo.java @@ -348,6 +348,29 @@ public Stream provideArguments(ExtensionContext context) { } // end::ArgumentsProvider_example[] + @ParameterizedTest + @ArgumentsSource(MyArgumentsProviderWithConstructorInjection.class) + void testWithArgumentsSourceWithConstructorInjection(String argument) { + assertNotNull(argument); + } + + static + // tag::ArgumentsProviderWithConstructorInjection_example[] + public class MyArgumentsProviderWithConstructorInjection implements ArgumentsProvider { + + private final TestInfo testInfo; + + public MyArgumentsProviderWithConstructorInjection(TestInfo testInfo) { + this.testInfo = testInfo; + } + + @Override + public Stream provideArguments(ExtensionContext context) { + return Stream.of(Arguments.of(testInfo.getDisplayName())); + } + } + // end::ArgumentsProviderWithConstructorInjection_example[] + // tag::ParameterResolver_example[] @BeforeEach void beforeEach(TestInfo testInfo) { diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java index f625faac7f17..2de9e68aa5f7 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java @@ -13,8 +13,11 @@ import static org.junit.platform.commons.support.AnnotationSupport.findAnnotation; import static org.junit.platform.commons.support.AnnotationSupport.findRepeatableAnnotations; import static org.junit.platform.commons.support.AnnotationSupport.isAnnotated; +import static org.junit.platform.commons.util.CollectionUtils.getFirstElement; +import java.lang.reflect.Constructor; import java.lang.reflect.Method; +import java.util.Optional; import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Stream; @@ -27,9 +30,11 @@ import org.junit.jupiter.params.provider.ArgumentsSource; import org.junit.jupiter.params.support.AnnotationConsumerInitializer; import org.junit.platform.commons.JUnitException; -import org.junit.platform.commons.support.ReflectionSupport; +import org.junit.platform.commons.PreconditionViolationException; +import org.junit.platform.commons.support.ModifierSupport; import org.junit.platform.commons.util.ExceptionUtils; import org.junit.platform.commons.util.Preconditions; +import org.junit.platform.commons.util.ReflectionUtils; /** * @since 5.0 @@ -84,7 +89,7 @@ public Stream provideTestTemplateInvocationContex return findRepeatableAnnotations(templateMethod, ArgumentsSource.class) .stream() .map(ArgumentsSource::value) - .map(this::instantiateArgumentsProvider) + .map(clazz -> instantiateArgumentsProvider(clazz, extensionContext)) .map(provider -> AnnotationConsumerInitializer.initialize(templateMethod, provider)) .flatMap(provider -> arguments(provider, extensionContext)) .map(arguments -> { @@ -97,20 +102,32 @@ public Stream provideTestTemplateInvocationContex // @formatter:on } - @SuppressWarnings("ConstantConditions") - private ArgumentsProvider instantiateArgumentsProvider(Class clazz) { + private ArgumentsProvider instantiateArgumentsProvider(Class clazz, + ExtensionContext extensionContext) { + return extensionContext.getExecutableInvoker().invoke(findConstructor(ArgumentsProvider.class, clazz)); + } + + @SuppressWarnings("unchecked") + private static Constructor findConstructor(Class spiClass, Class clazz) { + Optional> defaultConstructor = getFirstElement( + ReflectionUtils.findConstructors(clazz, it -> it.getParameterCount() == 0)); + if (defaultConstructor.isPresent()) { + return (Constructor) defaultConstructor.get(); + } + if (ModifierSupport.isNotStatic(clazz)) { + String message = String.format("The %s [%s] must be either a top-level class or a static nested class", + spiClass.getSimpleName(), clazz.getName()); + throw new JUnitException(message); + } try { - return ReflectionSupport.newInstance(clazz); + return ReflectionUtils.getDeclaredConstructor(clazz); } - catch (Exception ex) { - if (ex instanceof NoSuchMethodException) { - String message = String.format("Failed to find a no-argument constructor for ArgumentsProvider [%s]. " - + "Please ensure that a no-argument constructor exists and " - + "that the class is either a top-level class or a static nested class", - clazz.getName()); - throw new JUnitException(message, ex); - } - throw ex; + catch (PreconditionViolationException ex) { + String message = String.format( + "Failed to find constructor for %s [%s]. " + + "Please ensure that a no-argument or a single constructor exists.", + spiClass.getSimpleName(), clazz.getName()); + throw new JUnitException(message); } } diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsProvider.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsProvider.java index 689517d607b8..c18d100ad3c5 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsProvider.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsProvider.java @@ -16,6 +16,7 @@ import org.apiguardian.api.API; import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.ParameterResolver; /** * An {@code ArgumentsProvider} is responsible for {@linkplain #provideArguments @@ -25,7 +26,8 @@ *

An {@code ArgumentsProvider} can be registered via the * {@link ArgumentsSource @ArgumentsSource} annotation. * - *

Implementations must provide a no-args constructor. + *

Implementations must provide a no-args constructor or a single unambiguous + * constructor to use {@linkplain ParameterResolver parameter resolution}. * * @since 5.0 * @see org.junit.jupiter.params.ParameterizedTest diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java index 69db68af81ba..3172140691ae 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java @@ -19,6 +19,7 @@ import java.io.FileNotFoundException; import java.lang.reflect.AnnotatedElement; +import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.util.Arrays; import java.util.Map; @@ -40,6 +41,7 @@ import org.junit.jupiter.params.provider.ArgumentsSource; import org.junit.platform.commons.JUnitException; import org.junit.platform.commons.PreconditionViolationException; +import org.junit.platform.commons.util.ReflectionUtils; import org.junit.platform.engine.support.store.NamespacedHierarchicalStore; /** @@ -150,11 +152,14 @@ void throwsExceptionWhenArgumentsProviderIsNotStatic() { var exception = assertThrows(JUnitException.class, stream::toArray); - assertArgumentsProviderInstantiationException(exception, NonStaticArgumentsProvider.class); + assertThat(exception) // + .hasMessage(String.format( + "The ArgumentsProvider [%s] must be either a top-level class or a static nested class", + NonStaticArgumentsProvider.class.getName())); } @Test - void throwsExceptionWhenArgumentsProviderDoesNotContainNoArgumentConstructor() { + void throwsExceptionWhenArgumentsProviderDoesNotContainUnambiguousConstructor() { var extensionContextWithAnnotatedTestMethod = getExtensionContextReturningSingleMethod( new MissingNoArgumentsConstructorArgumentsProviderTestCase()); @@ -163,15 +168,11 @@ void throwsExceptionWhenArgumentsProviderDoesNotContainNoArgumentConstructor() { var exception = assertThrows(JUnitException.class, stream::toArray); - assertArgumentsProviderInstantiationException(exception, MissingNoArgumentsConstructorArgumentsProvider.class); - } - - private void assertArgumentsProviderInstantiationException(JUnitException exception, Class clazz) { - assertThat(exception).hasMessage( - String.format("Failed to find a no-argument constructor for ArgumentsProvider [%s]. " - + "Please ensure that a no-argument constructor exists and " - + "that the class is either a top-level class or a static nested class", - clazz.getName())); + String className = AmbiguousConstructorArgumentsProvider.class.getName(); + assertThat(exception) // + .hasMessage(String.format("Failed to find constructor for ArgumentsProvider [%s]. " + + "Please ensure that a no-argument or a single constructor exists.", + className)); } private ExtensionContext getExtensionContextReturningSingleMethod(Object testCase) { @@ -277,7 +278,17 @@ public ExecutionMode getExecutionMode() { @Override public ExecutableInvoker getExecutableInvoker() { - return null; + return new ExecutableInvoker() { + @Override + public Object invoke(Method method, Object target) { + return null; + } + + @Override + public T invoke(Constructor constructor, Object outerInstance) { + return ReflectionUtils.newInstance(constructor); + } + }; } }; } @@ -334,7 +345,7 @@ public Stream provideArguments(ExtensionContext context) { static class MissingNoArgumentsConstructorArgumentsProviderTestCase { @ParameterizedTest - @ArgumentsSource(MissingNoArgumentsConstructorArgumentsProvider.class) + @ArgumentsSource(AmbiguousConstructorArgumentsProvider.class) void method() { } } @@ -342,7 +353,7 @@ void method() { static class EmptyDisplayNameProviderTestCase { @ParameterizedTest(name = "") - @ArgumentsSource(MissingNoArgumentsConstructorArgumentsProvider.class) + @ArgumentsSource(AmbiguousConstructorArgumentsProvider.class) void method() { } } @@ -350,14 +361,17 @@ void method() { static class DefaultDisplayNameProviderTestCase { @ParameterizedTest - @ArgumentsSource(MissingNoArgumentsConstructorArgumentsProvider.class) + @ArgumentsSource(AmbiguousConstructorArgumentsProvider.class) void method() { } } - static class MissingNoArgumentsConstructorArgumentsProvider implements ArgumentsProvider { + static class AmbiguousConstructorArgumentsProvider implements ArgumentsProvider { + + AmbiguousConstructorArgumentsProvider(String parameter) { + } - MissingNoArgumentsConstructorArgumentsProvider(String parameter) { + AmbiguousConstructorArgumentsProvider(int parameter) { } @Override diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java index 9fdd334754ed..78e5ee26ab1e 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java @@ -42,6 +42,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -84,6 +85,8 @@ import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ParameterContext; import org.junit.jupiter.api.extension.ParameterResolutionException; +import org.junit.jupiter.api.extension.ParameterResolver; +import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.engine.JupiterTestEngine; import org.junit.jupiter.params.ParameterizedTestIntegrationTests.RepeatableSourcesTestCase.Action; import org.junit.jupiter.params.aggregator.AggregateWith; @@ -1206,6 +1209,17 @@ void executesTwoIterationsBasedOnIterationAndUniqueIdSelector() { .haveExactly(1, event(test(), displayName("[3] argument=5"), finishedWithFailure())); } + @Nested + class SpiParameterInjectionIntegrationTests { + + @Test + void injectsParametersIntoArgumentsProviderConstructor() { + execute(SpiParameterInjectionTestCase.class, "argumentsProviderWithConstructorParameter", String.class) // + .testEvents() // + .assertStatistics(it -> it.succeeded(1)); + } + } + // ------------------------------------------------------------------------- static class TestCase { @@ -1307,6 +1321,7 @@ void testWithThreeIterations(int argument) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class NullSourceTestCase { @ParameterizedTest @@ -1342,6 +1357,7 @@ void testWithNullSourceForPrimitive(int argument) { } + @SuppressWarnings("JUnitMalformedDeclaration") static class EmptySourceTestCase { @ParameterizedTest @@ -1497,6 +1513,7 @@ void testWithEmptySourceForUnsupportedReferenceType(Integer argument) { } + @SuppressWarnings("JUnitMalformedDeclaration") static class NullAndEmptySourceTestCase { @ParameterizedTest @@ -1538,6 +1555,7 @@ void testWithNullAndEmptySourceForTwoDimensionalStringArray(String[][] argument) } + @SuppressWarnings("JUnitMalformedDeclaration") @TestMethodOrder(OrderAnnotation.class) static class MethodSourceTestCase { @@ -2119,6 +2137,40 @@ void testWithRepeatableArgumentsSource(String argument) { } } + static class SpiParameterInjectionTestCase { + + @RegisterExtension + static final ParameterResolver spiParameterResolver = new ParameterResolver() { + + @Override + public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) + throws ParameterResolutionException { + return parameterContext.getDeclaringExecutable() instanceof Constructor // + && String.class.equals(parameterContext.getParameter().getType()); + } + + @Override + public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) + throws ParameterResolutionException { + return "resolved value"; + } + }; + + @ParameterizedTest + @ArgumentsSource(ArgumentsProviderWithConstructorParameter.class) + void argumentsProviderWithConstructorParameter(String argument) { + assertEquals("resolved value", argument); + } + + record ArgumentsProviderWithConstructorParameter(String value) implements ArgumentsProvider { + + @Override + public Stream provideArguments(ExtensionContext context) { + return Stream.of(arguments(value)); + } + } + } + private static class TwoSingleStringArgumentsProvider implements ArgumentsProvider { @Override From 125e10b9b804ef270fbf3bc53bbed75689d7b96a Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 25 Sep 2024 12:41:51 +0200 Subject: [PATCH 118/611] Allow ArgumentConverter implementations to use constructor injection Issue: #4018 --- ...ameterizedTestNameFormatterBenchmarks.java | 3 +- .../params/ParameterizedTestExtension.java | 40 +----------- .../ParameterizedTestMethodContext.java | 15 +++-- .../ParameterizedTestSpiInstantiator.java | 63 +++++++++++++++++++ .../params/converter/ArgumentConverter.java | 10 +-- .../ParameterizedTestIntegrationTests.java | 22 +++++++ .../ParameterizedTestMethodContextTests.java | 5 +- .../ParameterizedTestNameFormatterTests.java | 4 +- 8 files changed, 109 insertions(+), 53 deletions(-) create mode 100644 junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestSpiInstantiator.java diff --git a/junit-jupiter-params/src/jmh/java/org/junit/jupiter/params/ParameterizedTestNameFormatterBenchmarks.java b/junit-jupiter-params/src/jmh/java/org/junit/jupiter/params/ParameterizedTestNameFormatterBenchmarks.java index bc296054ec36..e3e7df3c58c2 100644 --- a/junit-jupiter-params/src/jmh/java/org/junit/jupiter/params/ParameterizedTestNameFormatterBenchmarks.java +++ b/junit-jupiter-params/src/jmh/java/org/junit/jupiter/params/ParameterizedTestNameFormatterBenchmarks.java @@ -47,7 +47,8 @@ public void formatTestNames(Blackhole blackhole) throws Exception { var formatter = new ParameterizedTestNameFormatter( ParameterizedTest.DISPLAY_NAME_PLACEHOLDER + " " + ParameterizedTest.DEFAULT_DISPLAY_NAME + " ({0})", "displayName", - new ParameterizedTestMethodContext(TestCase.class.getDeclaredMethod("parameterizedTest", int.class)), 512); + new ParameterizedTestMethodContext(TestCase.class.getDeclaredMethod("parameterizedTest", int.class), null), + 512); for (int i = 0; i < argumentsList.size(); i++) { Arguments arguments = argumentsList.get(i); blackhole.consume(formatter.format(i, arguments, arguments.get())); diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java index 2de9e68aa5f7..aefbba1f2adc 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java @@ -13,11 +13,8 @@ import static org.junit.platform.commons.support.AnnotationSupport.findAnnotation; import static org.junit.platform.commons.support.AnnotationSupport.findRepeatableAnnotations; import static org.junit.platform.commons.support.AnnotationSupport.isAnnotated; -import static org.junit.platform.commons.util.CollectionUtils.getFirstElement; -import java.lang.reflect.Constructor; import java.lang.reflect.Method; -import java.util.Optional; import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Stream; @@ -29,12 +26,8 @@ import org.junit.jupiter.params.provider.ArgumentsProvider; import org.junit.jupiter.params.provider.ArgumentsSource; import org.junit.jupiter.params.support.AnnotationConsumerInitializer; -import org.junit.platform.commons.JUnitException; -import org.junit.platform.commons.PreconditionViolationException; -import org.junit.platform.commons.support.ModifierSupport; import org.junit.platform.commons.util.ExceptionUtils; import org.junit.platform.commons.util.Preconditions; -import org.junit.platform.commons.util.ReflectionUtils; /** * @since 5.0 @@ -57,7 +50,7 @@ public boolean supportsTestTemplate(ExtensionContext context) { return false; } - ParameterizedTestMethodContext methodContext = new ParameterizedTestMethodContext(testMethod); + ParameterizedTestMethodContext methodContext = new ParameterizedTestMethodContext(testMethod, context); Preconditions.condition(methodContext.hasPotentiallyValidSignature(), () -> String.format( @@ -89,7 +82,7 @@ public Stream provideTestTemplateInvocationContex return findRepeatableAnnotations(templateMethod, ArgumentsSource.class) .stream() .map(ArgumentsSource::value) - .map(clazz -> instantiateArgumentsProvider(clazz, extensionContext)) + .map(clazz -> ParameterizedTestSpiInstantiator.instantiate(ArgumentsProvider.class, clazz, extensionContext)) .map(provider -> AnnotationConsumerInitializer.initialize(templateMethod, provider)) .flatMap(provider -> arguments(provider, extensionContext)) .map(arguments -> { @@ -102,35 +95,6 @@ public Stream provideTestTemplateInvocationContex // @formatter:on } - private ArgumentsProvider instantiateArgumentsProvider(Class clazz, - ExtensionContext extensionContext) { - return extensionContext.getExecutableInvoker().invoke(findConstructor(ArgumentsProvider.class, clazz)); - } - - @SuppressWarnings("unchecked") - private static Constructor findConstructor(Class spiClass, Class clazz) { - Optional> defaultConstructor = getFirstElement( - ReflectionUtils.findConstructors(clazz, it -> it.getParameterCount() == 0)); - if (defaultConstructor.isPresent()) { - return (Constructor) defaultConstructor.get(); - } - if (ModifierSupport.isNotStatic(clazz)) { - String message = String.format("The %s [%s] must be either a top-level class or a static nested class", - spiClass.getSimpleName(), clazz.getName()); - throw new JUnitException(message); - } - try { - return ReflectionUtils.getDeclaredConstructor(clazz); - } - catch (PreconditionViolationException ex) { - String message = String.format( - "Failed to find constructor for %s [%s]. " - + "Please ensure that a no-argument or a single constructor exists.", - spiClass.getSimpleName(), clazz.getName()); - throw new JUnitException(message); - } - } - private ExtensionContext.Store getStore(ExtensionContext context) { return context.getStore(Namespace.create(ParameterizedTestExtension.class, context.getRequiredTestMethod())); } diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java index 1b88b3a14467..0b1a5933a9e6 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java @@ -20,6 +20,7 @@ import java.util.List; import java.util.Optional; +import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ParameterContext; import org.junit.jupiter.api.extension.ParameterResolutionException; import org.junit.jupiter.params.aggregator.AggregateWith; @@ -43,16 +44,18 @@ class ParameterizedTestMethodContext { private final Parameter[] parameters; + private final ExtensionContext extensionContext; private final Resolver[] resolvers; private final List resolverTypes; - ParameterizedTestMethodContext(Method testMethod) { + ParameterizedTestMethodContext(Method testMethod, ExtensionContext extensionContext) { this.parameters = testMethod.getParameters(); this.resolvers = new Resolver[this.parameters.length]; this.resolverTypes = new ArrayList<>(this.parameters.length); for (Parameter parameter : this.parameters) { this.resolverTypes.add(isAggregator(parameter) ? AGGREGATOR : CONVERTER); } + this.extensionContext = extensionContext; } /** @@ -167,7 +170,7 @@ Object resolve(ParameterContext parameterContext, Object[] arguments, int invoca private Resolver getResolver(ParameterContext parameterContext) { int index = parameterContext.getIndex(); if (resolvers[index] == null) { - resolvers[index] = resolverTypes.get(index).createResolver(parameterContext); + resolvers[index] = resolverTypes.get(index).createResolver(parameterContext, extensionContext); } return resolvers[index]; } @@ -176,11 +179,11 @@ enum ResolverType { CONVERTER { @Override - Resolver createResolver(ParameterContext parameterContext) { + Resolver createResolver(ParameterContext parameterContext, ExtensionContext extensionContext) { try { // @formatter:off return AnnotationSupport.findAnnotation(parameterContext.getParameter(), ConvertWith.class) .map(ConvertWith::value) - .map(clazz -> (ArgumentConverter) ReflectionSupport.newInstance(clazz)) + .map(clazz -> ParameterizedTestSpiInstantiator.instantiate(ArgumentConverter.class, clazz, extensionContext)) .map(converter -> AnnotationConsumerInitializer.initialize(parameterContext.getParameter(), converter)) .map(Converter::new) .orElse(Converter.DEFAULT); @@ -193,7 +196,7 @@ Resolver createResolver(ParameterContext parameterContext) { AGGREGATOR { @Override - Resolver createResolver(ParameterContext parameterContext) { + Resolver createResolver(ParameterContext parameterContext, ExtensionContext extensionContext) { try { // @formatter:off return AnnotationSupport.findAnnotation(parameterContext.getParameter(), AggregateWith.class) .map(AggregateWith::value) @@ -207,7 +210,7 @@ Resolver createResolver(ParameterContext parameterContext) { } }; - abstract Resolver createResolver(ParameterContext parameterContext); + abstract Resolver createResolver(ParameterContext parameterContext, ExtensionContext extensionContext); } diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestSpiInstantiator.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestSpiInstantiator.java new file mode 100644 index 000000000000..e3ebf4222fda --- /dev/null +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestSpiInstantiator.java @@ -0,0 +1,63 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.params; + +import static org.junit.platform.commons.util.CollectionUtils.getFirstElement; + +import java.lang.reflect.Constructor; +import java.util.Optional; + +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.platform.commons.JUnitException; +import org.junit.platform.commons.PreconditionViolationException; +import org.junit.platform.commons.support.ModifierSupport; +import org.junit.platform.commons.util.ReflectionUtils; + +/** + * @since 5.12 + */ +class ParameterizedTestSpiInstantiator { + + static T instantiate(Class spiClass, Class clazz, ExtensionContext extensionContext) { + return extensionContext.getExecutableInvoker().invoke(findConstructor(spiClass, clazz)); + } + + /** + * Find the "best" constructor for the supplied class. + * + *

For backward compatibility, it first checks for a default constructor + * which takes precedence over any other constructor. If no default + * constructor is found, it checks for a single constructor and returns it. + */ + @SuppressWarnings("unchecked") + private static Constructor findConstructor(Class spiClass, Class clazz) { + Optional> defaultConstructor = getFirstElement( + ReflectionUtils.findConstructors(clazz, it -> it.getParameterCount() == 0)); + if (defaultConstructor.isPresent()) { + return (Constructor) defaultConstructor.get(); + } + if (ModifierSupport.isNotStatic(clazz)) { + String message = String.format("The %s [%s] must be either a top-level class or a static nested class", + spiClass.getSimpleName(), clazz.getName()); + throw new JUnitException(message); + } + try { + return ReflectionUtils.getDeclaredConstructor(clazz); + } + catch (PreconditionViolationException ex) { + String message = String.format( + "Failed to find constructor for %s [%s]. " + + "Please ensure that a no-argument or a single constructor exists.", + spiClass.getSimpleName(), clazz.getName()); + throw new JUnitException(message); + } + } +} diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/ArgumentConverter.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/ArgumentConverter.java index 46f7e9a84b79..b18d96887069 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/ArgumentConverter.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/ArgumentConverter.java @@ -14,6 +14,7 @@ import org.apiguardian.api.API; import org.junit.jupiter.api.extension.ParameterContext; +import org.junit.jupiter.api.extension.ParameterResolver; /** * {@code ArgumentConverter} is an abstraction that allows an input object to @@ -24,10 +25,11 @@ * method with the help of a * {@link org.junit.jupiter.params.converter.ConvertWith @ConvertWith} annotation. * - *

Implementations must provide a no-args constructor and should not make any - * assumptions regarding when they are instantiated or how often they are called. - * Since instances may potentially be cached and called from different threads, - * they should be thread-safe and designed to be used as singletons. + *

Implementations must provide a no-args constructor or a single unambiguous + * constructor to use {@linkplain ParameterResolver parameter resolution}. They + * should not make any assumptions regarding when they are instantiated or how + * often they are called. Since instances may potentially be cached and called + * from different threads, they should be thread-safe. * *

Extend {@link SimpleArgumentConverter} if your implementation only needs * to know the target type and does not need access to the {@link ParameterContext} diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java index 78e5ee26ab1e..296a57b8908b 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java @@ -1218,6 +1218,13 @@ void injectsParametersIntoArgumentsProviderConstructor() { .testEvents() // .assertStatistics(it -> it.succeeded(1)); } + + @Test + void injectsParametersIntoArgumentConverterConstructor() { + execute(SpiParameterInjectionTestCase.class, "argumentConverterWithConstructorParameter", String.class) // + .testEvents() // + .assertStatistics(it -> it.succeeded(1)); + } } // ------------------------------------------------------------------------- @@ -2162,6 +2169,13 @@ void argumentsProviderWithConstructorParameter(String argument) { assertEquals("resolved value", argument); } + @ParameterizedTest + @ValueSource(strings = "value") + void argumentConverterWithConstructorParameter( + @ConvertWith(ArgumentConverterWithConstructorParameter.class) String argument) { + assertEquals("resolved value", argument); + } + record ArgumentsProviderWithConstructorParameter(String value) implements ArgumentsProvider { @Override @@ -2169,6 +2183,14 @@ public Stream provideArguments(ExtensionContext context) { return Stream.of(arguments(value)); } } + + record ArgumentConverterWithConstructorParameter(String value) implements ArgumentConverter { + + @Override + public Object convert(Object source, ParameterContext context) throws ArgumentConversionException { + return value; + } + } } private static class TwoSingleStringArgumentsProvider implements ArgumentsProvider { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestMethodContextTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestMethodContextTests.java index 3bf17b6d5759..fd9e1d702c64 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestMethodContextTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestMethodContextTests.java @@ -12,6 +12,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.Mockito.mock; import java.lang.reflect.Method; import java.util.Arrays; @@ -33,13 +34,13 @@ class ParameterizedTestMethodContextTests { @ValueSource(strings = { "onePrimitive", "twoPrimitives", "twoAggregators", "twoAggregatorsWithTestInfoAtTheEnd", "mixedMode" }) void validSignatures(String name) { - assertTrue(new ParameterizedTestMethodContext(method(name)).hasPotentiallyValidSignature()); + assertTrue(new ParameterizedTestMethodContext(method(name), mock()).hasPotentiallyValidSignature()); } @ParameterizedTest @ValueSource(strings = { "twoAggregatorsWithPrimitiveInTheMiddle", "twoAggregatorsWithTestInfoInTheMiddle" }) void invalidSignatures(String name) { - assertFalse(new ParameterizedTestMethodContext(method(name)).hasPotentiallyValidSignature()); + assertFalse(new ParameterizedTestMethodContext(method(name), mock()).hasPotentiallyValidSignature()); } private Method method(String name) { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestNameFormatterTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestNameFormatterTests.java index a438edba25c2..9bd77fb62b74 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestNameFormatterTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestNameFormatterTests.java @@ -330,8 +330,8 @@ private static ParameterizedTestNameFormatter formatter(String pattern, String d } private static ParameterizedTestNameFormatter formatter(String pattern, String displayName, Method method) { - return new ParameterizedTestNameFormatter(pattern, displayName, new ParameterizedTestMethodContext(method), - 512); + return new ParameterizedTestNameFormatter(pattern, displayName, + new ParameterizedTestMethodContext(method, mock()), 512); } private static String format(ParameterizedTestNameFormatter formatter, int invocationIndex, Arguments arguments) { From 9105afe998890cf0a6d204d026b6fb03b064ca13 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 25 Sep 2024 12:50:21 +0200 Subject: [PATCH 119/611] Allow ArgumentsAggregator implementations to use constructor injection Issue: #4018 --- .../ParameterizedTestMethodContext.java | 3 +-- .../aggregator/ArgumentsAggregator.java | 10 ++++---- .../ParameterizedTestIntegrationTests.java | 23 +++++++++++++++++++ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java index 0b1a5933a9e6..a7469d4f4003 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java @@ -32,7 +32,6 @@ import org.junit.jupiter.params.converter.DefaultArgumentConverter; import org.junit.jupiter.params.support.AnnotationConsumerInitializer; import org.junit.platform.commons.support.AnnotationSupport; -import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.util.StringUtils; /** @@ -200,7 +199,7 @@ Resolver createResolver(ParameterContext parameterContext, ExtensionContext exte try { // @formatter:off return AnnotationSupport.findAnnotation(parameterContext.getParameter(), AggregateWith.class) .map(AggregateWith::value) - .map(clazz -> (ArgumentsAggregator) ReflectionSupport.newInstance(clazz)) + .map(clazz -> ParameterizedTestSpiInstantiator.instantiate(ArgumentsAggregator.class, clazz, extensionContext)) .map(Aggregator::new) .orElse(Aggregator.DEFAULT); } // @formatter:on diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentsAggregator.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentsAggregator.java index e4ed9803f09f..c82d12cda961 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentsAggregator.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentsAggregator.java @@ -14,6 +14,7 @@ import org.apiguardian.api.API; import org.junit.jupiter.api.extension.ParameterContext; +import org.junit.jupiter.api.extension.ParameterResolver; /** * {@code ArgumentsAggregator} is an abstraction for the aggregation of arguments @@ -33,10 +34,11 @@ * in a CSV file into a domain object such as a {@code Person}, {@code Address}, * {@code Order}, etc. * - *

Implementations must provide a no-args constructor and should not make any - * assumptions regarding when they are instantiated or how often they are called. - * Since instances may potentially be cached and called from different threads, - * they should be thread-safe and designed to be used as singletons. + *

Implementations must provide a no-args constructor or a single unambiguous + * constructor to use {@linkplain ParameterResolver parameter resolution}. They + * should not make any assumptions regarding when they are instantiated or how + * often they are called. Since instances may potentially be cached and called + * from different threads, they should be thread-safe. * * @since 5.2 * @see AggregateWith diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java index 296a57b8908b..4ff8ba90e1e5 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java @@ -1225,6 +1225,13 @@ void injectsParametersIntoArgumentConverterConstructor() { .testEvents() // .assertStatistics(it -> it.succeeded(1)); } + + @Test + void injectsParametersIntoArgumentsAggregatorConstructor() { + execute(SpiParameterInjectionTestCase.class, "argumentsAggregatorWithConstructorParameter", String.class) // + .testEvents() // + .assertStatistics(it -> it.succeeded(1)); + } } // ------------------------------------------------------------------------- @@ -2176,6 +2183,13 @@ void argumentConverterWithConstructorParameter( assertEquals("resolved value", argument); } + @ParameterizedTest + @ValueSource(strings = "value") + void argumentsAggregatorWithConstructorParameter( + @AggregateWith(ArgumentsAggregatorWithConstructorParameter.class) String argument) { + assertEquals("resolved value", argument); + } + record ArgumentsProviderWithConstructorParameter(String value) implements ArgumentsProvider { @Override @@ -2191,6 +2205,15 @@ public Object convert(Object source, ParameterContext context) throws ArgumentCo return value; } } + + record ArgumentsAggregatorWithConstructorParameter(String value) implements ArgumentsAggregator { + + @Override + public Object aggregateArguments(ArgumentsAccessor accessor, ParameterContext context) + throws ArgumentsAggregationException { + return value; + } + } } private static class TwoSingleStringArgumentsProvider implements ArgumentsProvider { From b4e35c458992c4401cfae3162a027b8c1bbc0770 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 25 Sep 2024 12:53:43 +0200 Subject: [PATCH 120/611] Document constructor injection support in release notes Resolves #4018. --- .../docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index c37680f13b5d..e23dcb707c34 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -50,6 +50,10 @@ JUnit repository on GitHub. * In a `@ParameterizedTest` method, a `null` value can now be supplied for Java Date/Time types such as `LocalDate` if the new `nullable` attribute in `@JavaTimeConversionPattern` is set to `true`. +* `ArgumentsProvider` (declared via `@ArgumentsSource`), `ArgumentConverter` (declared via + `@ConvertWith`), and `ArgumentsAggregator` (declared via `@AggregateWith`) + implementations can now use constructor injection from registered `ParameterResolver` + extensions. [[release-notes-5.12.0-M1-junit-vintage]] From 48cd00d2c8e160acb9134b1cef07fe4503f0d8d1 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 25 Sep 2024 13:23:20 +0200 Subject: [PATCH 121/611] Use ReflectionUtils.isInnerClass and polish implementation --- .../ParameterizedTestSpiInstantiator.java | 42 ++++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestSpiInstantiator.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestSpiInstantiator.java index e3ebf4222fda..24c7163ac27a 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestSpiInstantiator.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestSpiInstantiator.java @@ -18,7 +18,7 @@ import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.platform.commons.JUnitException; import org.junit.platform.commons.PreconditionViolationException; -import org.junit.platform.commons.support.ModifierSupport; +import org.junit.platform.commons.util.Preconditions; import org.junit.platform.commons.util.ReflectionUtils; /** @@ -26,8 +26,10 @@ */ class ParameterizedTestSpiInstantiator { - static T instantiate(Class spiClass, Class clazz, ExtensionContext extensionContext) { - return extensionContext.getExecutableInvoker().invoke(findConstructor(spiClass, clazz)); + static T instantiate(Class spiInterface, Class implementationClass, + ExtensionContext extensionContext) { + return extensionContext.getExecutableInvoker() // + .invoke(findConstructor(spiInterface, implementationClass)); } /** @@ -37,26 +39,34 @@ static T instantiate(Class spiClass, Class clazz, ExtensionC * which takes precedence over any other constructor. If no default * constructor is found, it checks for a single constructor and returns it. */ + private static Constructor findConstructor(Class spiInterface, + Class implementationClass) { + + Preconditions.condition(!ReflectionUtils.isInnerClass(implementationClass), + () -> String.format("The %s [%s] must be either a top-level class or a static nested class", + spiInterface.getSimpleName(), implementationClass.getName())); + + return findDefaultConstructor(implementationClass) // + .orElseGet(() -> findSingleConstructor(spiInterface, implementationClass)); + } + @SuppressWarnings("unchecked") - private static Constructor findConstructor(Class spiClass, Class clazz) { - Optional> defaultConstructor = getFirstElement( - ReflectionUtils.findConstructors(clazz, it -> it.getParameterCount() == 0)); - if (defaultConstructor.isPresent()) { - return (Constructor) defaultConstructor.get(); - } - if (ModifierSupport.isNotStatic(clazz)) { - String message = String.format("The %s [%s] must be either a top-level class or a static nested class", - spiClass.getSimpleName(), clazz.getName()); - throw new JUnitException(message); - } + private static Optional> findDefaultConstructor(Class clazz) { + return getFirstElement(ReflectionUtils.findConstructors(clazz, it -> it.getParameterCount() == 0)) // + .map(it -> (Constructor) it); + } + + private static Constructor findSingleConstructor(Class spiInterface, + Class implementationClass) { + try { - return ReflectionUtils.getDeclaredConstructor(clazz); + return ReflectionUtils.getDeclaredConstructor(implementationClass); } catch (PreconditionViolationException ex) { String message = String.format( "Failed to find constructor for %s [%s]. " + "Please ensure that a no-argument or a single constructor exists.", - spiClass.getSimpleName(), clazz.getName()); + spiInterface.getSimpleName(), implementationClass.getName()); throw new JUnitException(message); } } From daea6f12c21ac664016087c1c5949dd3f06da232 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Wed, 25 Sep 2024 14:52:35 +0200 Subject: [PATCH 122/611] Improve performance of ParameterizedTestSpiInstantiator Since Class.getDeclaredConstructors() clones the constructors array AND makes "child copies" of the constructors, it's usually better to avoid repeated calls to getDeclaredConstructors() for a single use case. In addition, it's good to avoid the use of Optional, multiple Streams, and try-catch blocks if feasible. This commit reworks ParameterizedTestSpiInstantiator in order to achieve that by switching to old-school Java constructs like arrays, for-loops, and if-blocks. See #4018 See #4025 --- .../ParameterizedTestSpiInstantiator.java | 52 +++++++++---------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestSpiInstantiator.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestSpiInstantiator.java index 24c7163ac27a..480569525d73 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestSpiInstantiator.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestSpiInstantiator.java @@ -10,14 +10,10 @@ package org.junit.jupiter.params; -import static org.junit.platform.commons.util.CollectionUtils.getFirstElement; - import java.lang.reflect.Constructor; -import java.util.Optional; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.platform.commons.JUnitException; -import org.junit.platform.commons.PreconditionViolationException; import org.junit.platform.commons.util.Preconditions; import org.junit.platform.commons.util.ReflectionUtils; @@ -28,17 +24,21 @@ class ParameterizedTestSpiInstantiator { static T instantiate(Class spiInterface, Class implementationClass, ExtensionContext extensionContext) { + return extensionContext.getExecutableInvoker() // .invoke(findConstructor(spiInterface, implementationClass)); } /** - * Find the "best" constructor for the supplied class. + * Find the "best" constructor for the supplied implementation class. * - *

For backward compatibility, it first checks for a default constructor - * which takes precedence over any other constructor. If no default - * constructor is found, it checks for a single constructor and returns it. + *

For backward compatibility, it first checks for a single constructor + * and returns that. If there are multiple constructors, it checks for a + * default constructor which takes precedence over any other constructors. + * Otherwise, this method throws an exception stating that it failed to + * find a suitable constructor. */ + @SuppressWarnings("unchecked") private static Constructor findConstructor(Class spiInterface, Class implementationClass) { @@ -46,28 +46,24 @@ private static Constructor findConstructor(Class String.format("The %s [%s] must be either a top-level class or a static nested class", spiInterface.getSimpleName(), implementationClass.getName())); - return findDefaultConstructor(implementationClass) // - .orElseGet(() -> findSingleConstructor(spiInterface, implementationClass)); - } - - @SuppressWarnings("unchecked") - private static Optional> findDefaultConstructor(Class clazz) { - return getFirstElement(ReflectionUtils.findConstructors(clazz, it -> it.getParameterCount() == 0)) // - .map(it -> (Constructor) it); - } + Constructor[] constructors = implementationClass.getDeclaredConstructors(); - private static Constructor findSingleConstructor(Class spiInterface, - Class implementationClass) { - - try { - return ReflectionUtils.getDeclaredConstructor(implementationClass); + // Single constructor? + if (constructors.length == 1) { + return (Constructor) constructors[0]; } - catch (PreconditionViolationException ex) { - String message = String.format( - "Failed to find constructor for %s [%s]. " - + "Please ensure that a no-argument or a single constructor exists.", - spiInterface.getSimpleName(), implementationClass.getName()); - throw new JUnitException(message); + // Find default constructor. + for (Constructor constructor : constructors) { + if (constructor.getParameterCount() == 0) { + return (Constructor) constructor; + } } + // Otherwise... + String message = String.format( + "Failed to find constructor for %s [%s]. " + + "Please ensure that a no-argument or a single constructor exists.", + spiInterface.getSimpleName(), implementationClass.getName()); + throw new JUnitException(message); } + } From d0130853639346c962609e9f8b711336879e39ca Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 26 Sep 2024 08:52:01 +0200 Subject: [PATCH 123/611] Reduce scope of "unchecked" suppression --- .../params/ParameterizedTestSpiInstantiator.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestSpiInstantiator.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestSpiInstantiator.java index 480569525d73..fa4661f88b69 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestSpiInstantiator.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestSpiInstantiator.java @@ -29,6 +29,13 @@ static T instantiate(Class spiInterface, Class implementatio .invoke(findConstructor(spiInterface, implementationClass)); } + @SuppressWarnings("unchecked") + private static Constructor findConstructor(Class spiInterface, + Class implementationClass) { + + return (Constructor) findBestConstructor(spiInterface, implementationClass); + } + /** * Find the "best" constructor for the supplied implementation class. * @@ -38,9 +45,8 @@ static T instantiate(Class spiInterface, Class implementatio * Otherwise, this method throws an exception stating that it failed to * find a suitable constructor. */ - @SuppressWarnings("unchecked") - private static Constructor findConstructor(Class spiInterface, - Class implementationClass) { + private static Constructor findBestConstructor(Class spiInterface, + Class implementationClass) { Preconditions.condition(!ReflectionUtils.isInnerClass(implementationClass), () -> String.format("The %s [%s] must be either a top-level class or a static nested class", @@ -50,12 +56,12 @@ private static Constructor findConstructor(Class) constructors[0]; + return constructors[0]; } // Find default constructor. for (Constructor constructor : constructors) { if (constructor.getParameterCount() == 0) { - return (Constructor) constructor; + return constructor; } } // Otherwise... From 6e8a32cb3645c46c44f0c8bbda09e27498d96867 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 29 Sep 2024 16:46:15 +0000 Subject: [PATCH 124/611] Update log4j2 monorepo to v2.24.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f6bb172ea941..20c8c275e124 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -13,7 +13,7 @@ jmh = "1.37" junit4 = "4.13.2" junit4Min = "4.12" ktlint = "1.3.1" -log4j = "2.24.0" +log4j = "2.24.1" opentest4j = "1.3.0" openTestReporting = "0.1.0-M2" surefire = "3.5.0" From f11ceb013bb7d5441215f256933027d0c743a94d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 2 Oct 2024 06:02:39 +0000 Subject: [PATCH 125/611] Update codecov/codecov-action digest to b9fd7d1 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3d80d89a1f19..1b750c51d936 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,7 +37,7 @@ jobs: jacocoRootReport \ --configuration-cache - name: Upload to Codecov.io - uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4 + uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4 with: token: ${{ secrets.CODECOV_TOKEN }} From daec7959e7c0d7dd60109bb088216c91601c5e11 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 2 Oct 2024 13:15:53 +0200 Subject: [PATCH 126/611] Add initial 5.11.2 release notes from template --- .../docs/asciidoc/release-notes/index.adoc | 2 + .../release-notes/release-notes-5.11.2.adoc | 67 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 documentation/src/docs/asciidoc/release-notes/release-notes-5.11.2.adoc diff --git a/documentation/src/docs/asciidoc/release-notes/index.adoc b/documentation/src/docs/asciidoc/release-notes/index.adoc index 52572c188572..1b4ff5513511 100644 --- a/documentation/src/docs/asciidoc/release-notes/index.adoc +++ b/documentation/src/docs/asciidoc/release-notes/index.adoc @@ -19,6 +19,8 @@ include::{includedir}/link-attributes.adoc[] include::{basedir}/release-notes-5.12.0-M1.adoc[] +include::{basedir}/release-notes-5.11.2.adoc[] + include::{basedir}/release-notes-5.11.1.adoc[] include::{basedir}/release-notes-5.11.0.adoc[] diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.2.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.2.adoc new file mode 100644 index 000000000000..36d267b0e339 --- /dev/null +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.2.adoc @@ -0,0 +1,67 @@ +[[release-notes-5.11.2]] +== 5.11.2 + +*Date of Release:* ❓ + +*Scope:* ❓ + +For a complete list of all _closed_ issues and pull requests for this release, consult the +link:{junit5-repo}+/milestone/82?closed=1+[5.11.2] milestone page in the JUnit repository +on GitHub. + + +[[release-notes-5.11.2-junit-platform]] +=== JUnit Platform + +[[release-notes-5.11.2-junit-platform-bug-fixes]] +==== Bug Fixes + +* ❓ + +[[release-notes-5.11.2-junit-platform-deprecations-and-breaking-changes]] +==== Deprecations and Breaking Changes + +* ❓ + +[[release-notes-5.11.2-junit-platform-new-features-and-improvements]] +==== New Features and Improvements + +* ❓ + + +[[release-notes-5.11.2-junit-jupiter]] +=== JUnit Jupiter + +[[release-notes-5.11.2-junit-jupiter-bug-fixes]] +==== Bug Fixes + +* ❓ + +[[release-notes-5.11.2-junit-jupiter-deprecations-and-breaking-changes]] +==== Deprecations and Breaking Changes + +* ❓ + +[[release-notes-5.11.2-junit-jupiter-new-features-and-improvements]] +==== New Features and Improvements + +* ❓ + + +[[release-notes-5.11.2-junit-vintage]] +=== JUnit Vintage + +[[release-notes-5.11.2-junit-vintage-bug-fixes]] +==== Bug Fixes + +* ❓ + +[[release-notes-5.11.2-junit-vintage-deprecations-and-breaking-changes]] +==== Deprecations and Breaking Changes + +* ❓ + +[[release-notes-5.11.2-junit-vintage-new-features-and-improvements]] +==== New Features and Improvements + +* ❓ From 8501be41939dbfad1a39660357b133c56cfadb5d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:23:29 +0000 Subject: [PATCH 127/611] Update github/codeql-action digest to e2b3eaf --- .github/workflows/codeql-analysis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index f54716729bc6..d6077d07c295 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -32,7 +32,7 @@ jobs: - name: Check out repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - name: Initialize CodeQL - uses: github/codeql-action/init@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3 + uses: github/codeql-action/init@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3 with: languages: ${{ matrix.language }} tools: linked @@ -44,4 +44,4 @@ jobs: -Dscan.tag.CodeQL \ allMainClasses - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@461ef6c76dfe95d5c364de2f431ddbd31a417628 # v3 + uses: github/codeql-action/analyze@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3 From 876deba264d81e24bf6af8936aa827e48bdb3131 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 2 Oct 2024 12:03:05 +0000 Subject: [PATCH 128/611] Update dependency com.puppycrawl.tools:checkstyle to v10.18.2 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 20c8c275e124..87df85f0cf73 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ asciidoctorj-pdf = "2.3.18" asciidoctor-plugins = "4.0.3" # Check if workaround in documentation.gradle.kts can be removed when upgrading assertj = "3.26.3" bnd = "7.0.0" -checkstyle = "10.18.1" +checkstyle = "10.18.2" eclipse = "4.32.0" jackson = "2.17.2" jacoco = "0.8.12" From 17b435459f670bc67b725768b79a858e28df47a0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 2 Oct 2024 16:18:11 +0000 Subject: [PATCH 129/611] Update dependency io.github.classgraph:classgraph to v4.8.177 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 87df85f0cf73..3ed5e59e3cf7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -32,7 +32,7 @@ assertj = { module = "org.assertj:assertj-core", version.ref = "assertj" } bartholdy = { module = "de.sormuras:bartholdy", version = "0.2.3" } bndlib = { module = "biz.aQute.bnd:biz.aQute.bndlib", version.ref = "bnd" } checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checkstyle" } -classgraph = { module = "io.github.classgraph:classgraph", version = "4.8.176" } +classgraph = { module = "io.github.classgraph:classgraph", version = "4.8.177" } commons-io = { module = "commons-io:commons-io", version = "2.17.0" } groovy4 = { module = "org.apache.groovy:groovy", version = "4.0.23" } groovy2-bom = { module = "org.codehaus.groovy:groovy-bom", version = "2.5.23" } From d3d345b51cf20a83d6cf962fa5d47abd2e89d1d9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 2 Oct 2024 19:37:37 +0000 Subject: [PATCH 130/611] Update plugin shadow to v8.3.3 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3ed5e59e3cf7..20fad828b0f4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -91,6 +91,6 @@ gitPublish = { id = "org.ajoberstar.git-publish", version = "4.2.2" } jmh = { id = "me.champeau.jmh", version = "0.7.2" } nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" } plantuml = { id = "io.freefair.plantuml", version = "8.10" } -shadow = { id = "com.gradleup.shadow", version = "8.3.2" } +shadow = { id = "com.gradleup.shadow", version = "8.3.3" } spotless = { id = "com.diffplug.spotless", version = "7.0.0.BETA2" } versions = { id = "com.github.ben-manes.versions", version = "0.51.0" } From 97deb638c31b2ba17c455203b7b84611db324160 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 2 Oct 2024 22:00:54 +0000 Subject: [PATCH 131/611] Update dependency com.fasterxml.jackson.dataformat:jackson-dataformat-yaml to v2.18.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 20fad828b0f4..8c16d2e28b38 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,7 @@ assertj = "3.26.3" bnd = "7.0.0" checkstyle = "10.18.2" eclipse = "4.32.0" -jackson = "2.17.2" +jackson = "2.18.0" jacoco = "0.8.12" jmh = "1.37" junit4 = "4.13.2" From 7c2112bb3b8cf77170a0f7168f36f792bd3ebb80 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 3 Oct 2024 00:44:50 +0000 Subject: [PATCH 132/611] Update dependency org.mockito:mockito-junit-jupiter to v5.14.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8c16d2e28b38..f56f8cf8ccc6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -53,7 +53,7 @@ log4j-jul = { module = "org.apache.logging.log4j:log4j-jul", version.ref = "log4 maven = { module = "org.apache.maven:apache-maven", version = "3.9.9" } mavenSurefirePlugin = { module = "org.apache.maven.plugins:maven-surefire-plugin", version.ref = "surefire" } memoryfilesystem = { module = "com.github.marschall:memoryfilesystem", version = "2.8.1" } -mockito = { module = "org.mockito:mockito-junit-jupiter", version = "5.13.0" } +mockito = { module = "org.mockito:mockito-junit-jupiter", version = "5.14.1" } nohttp-checkstyle = { module = "io.spring.nohttp:nohttp-checkstyle", version = "0.0.11" } opentest4j = { module = "org.opentest4j:opentest4j", version.ref = "opentest4j" } openTestReporting-events = { module = "org.opentest4j.reporting:open-test-reporting-events", version.ref = "openTestReporting" } From 871e8003088b3a6b627645af162a3fbec2370a77 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 3 Oct 2024 10:58:07 +0200 Subject: [PATCH 133/611] Fix global read-write lock handling when not declared on top level Prior to this change additional locks were not cleared from siblings when discovering the global read-write lock on a test descriptor which led to incompatible locks and caused test execution to fail. Fixes #4027. --- .../release-notes/release-notes-5.11.2.adoc | 4 +- .../hierarchical/NodeExecutionAdvisor.java | 4 + .../support/hierarchical/NodeTreeWalker.java | 16 +- .../ParallelExecutionIntegrationTests.java | 190 +++++++++++++++--- 4 files changed, 181 insertions(+), 33 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.2.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.2.adoc index 36d267b0e339..fcf7313a6354 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.2.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.2.adoc @@ -16,7 +16,9 @@ on GitHub. [[release-notes-5.11.2-junit-platform-bug-fixes]] ==== Bug Fixes -* ❓ +* Fix regression in parallel execution that was introduced in 5.10.4/5.11.1 regarding + global read-write locks. When such a lock was declared on descendants of top-level nodes + in the test tree, such as Cucumber scenarios, test execution failed. [[release-notes-5.11.2-junit-platform-deprecations-and-breaking-changes]] ==== Deprecations and Breaking Changes diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeExecutionAdvisor.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeExecutionAdvisor.java index c3863a049342..eb95daab0237 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeExecutionAdvisor.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeExecutionAdvisor.java @@ -33,6 +33,10 @@ void useResourceLock(TestDescriptor testDescriptor, ResourceLock resourceLock) { resourceLocksByTestDescriptor.put(testDescriptor, resourceLock); } + void removeResourceLock(TestDescriptor testDescriptor) { + resourceLocksByTestDescriptor.remove(testDescriptor); + } + Optional getForcedExecutionMode(TestDescriptor testDescriptor) { return testDescriptor.getParent().flatMap(this::lookupExecutionModeForcedByAncestor); } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalker.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalker.java index 8e47d006849c..ada030923b76 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalker.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalker.java @@ -50,6 +50,12 @@ NodeExecutionAdvisor walk(TestDescriptor rootDescriptor) { private void walk(TestDescriptor globalLockDescriptor, TestDescriptor testDescriptor, NodeExecutionAdvisor advisor) { + + if (advisor.getResourceLock(globalLockDescriptor) == globalReadWriteLock) { + // Global read-write lock is already being enforced, so no additional locks are needed + return; + } + Set exclusiveResources = getExclusiveResources(testDescriptor); if (exclusiveResources.isEmpty()) { if (globalLockDescriptor.equals(testDescriptor)) { @@ -73,7 +79,12 @@ private void walk(TestDescriptor globalLockDescriptor, TestDescriptor testDescri }); } if (allResources.contains(GLOBAL_READ_WRITE)) { - forceDescendantExecutionModeRecursively(advisor, globalLockDescriptor); + advisor.forceDescendantExecutionMode(globalLockDescriptor, SAME_THREAD); + doForChildrenRecursively(globalLockDescriptor, child -> { + advisor.forceDescendantExecutionMode(child, SAME_THREAD); + // Remove any locks that may have been set for siblings or their descendants + advisor.removeResourceLock(child); + }); advisor.useResourceLock(globalLockDescriptor, globalReadWriteLock); } else { @@ -94,8 +105,7 @@ private void forceDescendantExecutionModeRecursively(NodeExecutionAdvisor adviso } private boolean isReadOnly(Set exclusiveResources) { - return exclusiveResources.stream().allMatch( - exclusiveResource -> exclusiveResource.getLockMode() == ExclusiveResource.LockMode.READ); + return exclusiveResources.stream().allMatch(it -> it.getLockMode() == ExclusiveResource.LockMode.READ); } private Set getExclusiveResources(TestDescriptor testDescriptor) { diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionIntegrationTests.java index b556240bc295..4634c4c94f57 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionIntegrationTests.java @@ -18,6 +18,7 @@ import static org.junit.jupiter.api.DynamicTest.dynamicTest; import static org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT; import static org.junit.jupiter.api.parallel.ExecutionMode.SAME_THREAD; +import static org.junit.jupiter.api.parallel.ResourceAccessMode.READ_WRITE; import static org.junit.jupiter.engine.Constants.DEFAULT_CLASSES_EXECUTION_MODE_PROPERTY_NAME; import static org.junit.jupiter.engine.Constants.DEFAULT_PARALLEL_EXECUTION_MODE; import static org.junit.jupiter.engine.Constants.PARALLEL_CONFIG_FIXED_MAX_POOL_SIZE_PROPERTY_NAME; @@ -25,6 +26,7 @@ import static org.junit.jupiter.engine.Constants.PARALLEL_CONFIG_STRATEGY_PROPERTY_NAME; import static org.junit.jupiter.engine.Constants.PARALLEL_EXECUTION_ENABLED_PROPERTY_NAME; import static org.junit.platform.commons.util.CollectionUtils.getOnlyElement; +import static org.junit.platform.engine.support.hierarchical.ExclusiveResource.GLOBAL_KEY; import static org.junit.platform.testkit.engine.EventConditions.container; import static org.junit.platform.testkit.engine.EventConditions.event; import static org.junit.platform.testkit.engine.EventConditions.finishedSuccessfully; @@ -65,6 +67,8 @@ import org.junit.jupiter.api.parallel.Execution; import org.junit.jupiter.api.parallel.Isolated; import org.junit.jupiter.api.parallel.ResourceLock; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.discovery.ClassSelector; import org.junit.platform.engine.discovery.DiscoverySelectors; @@ -73,6 +77,7 @@ import org.junit.platform.testkit.engine.EngineExecutionResults; import org.junit.platform.testkit.engine.EngineTestKit; import org.junit.platform.testkit.engine.Event; +import org.junit.platform.testkit.engine.Events; /** * @since 1.3 @@ -82,7 +87,7 @@ class ParallelExecutionIntegrationTests { @Test void successfulParallelTest(TestReporter reporter) { - var events = executeConcurrently(3, SuccessfulParallelTestCase.class); + var events = executeConcurrentlySuccessfully(3, SuccessfulParallelTestCase.class).list(); var startedTimestamps = getTimestampsFor(events, event(test(), started())); var finishedTimestamps = getTimestampsFor(events, event(test(), finishedSuccessfully())); @@ -98,13 +103,13 @@ void successfulParallelTest(TestReporter reporter) { @Test void failingTestWithoutLock() { - var events = executeConcurrently(3, FailingWithoutLockTestCase.class); + var events = executeConcurrently(3, FailingWithoutLockTestCase.class).list(); assertThat(events.stream().filter(event(test(), finishedWithFailure())::matches)).hasSize(2); } @Test void successfulTestWithMethodLock() { - var events = executeConcurrently(3, SuccessfulWithMethodLockTestCase.class); + var events = executeConcurrentlySuccessfully(3, SuccessfulWithMethodLockTestCase.class).list(); assertThat(events.stream().filter(event(test(), finishedSuccessfully())::matches)).hasSize(3); assertThat(ThreadReporter.getThreadNames(events)).hasSize(3); @@ -112,7 +117,7 @@ void successfulTestWithMethodLock() { @Test void successfulTestWithClassLock() { - var events = executeConcurrently(3, SuccessfulWithClassLockTestCase.class); + var events = executeConcurrentlySuccessfully(3, SuccessfulWithClassLockTestCase.class).list(); assertThat(events.stream().filter(event(test(), finishedSuccessfully())::matches)).hasSize(3); assertThat(ThreadReporter.getThreadNames(events)).hasSize(1); @@ -120,7 +125,7 @@ void successfulTestWithClassLock() { @Test void testCaseWithFactory() { - var events = executeConcurrently(3, TestCaseWithTestFactory.class); + var events = executeConcurrentlySuccessfully(3, TestCaseWithTestFactory.class).list(); assertThat(events.stream().filter(event(test(), finishedSuccessfully())::matches)).hasSize(3); assertThat(ThreadReporter.getThreadNames(events)).hasSize(1); @@ -133,7 +138,7 @@ void customContextClassLoader() { var smilingLoader = new URLClassLoader("(-:", new URL[0], ClassLoader.getSystemClassLoader()); currentThread.setContextClassLoader(smilingLoader); try { - var events = executeConcurrently(3, SuccessfulWithMethodLockTestCase.class); + var events = executeConcurrentlySuccessfully(3, SuccessfulWithMethodLockTestCase.class).list(); assertThat(events.stream().filter(event(test(), finishedSuccessfully())::matches)).hasSize(3); assertThat(ThreadReporter.getThreadNames(events)).hasSize(3); @@ -146,7 +151,8 @@ void customContextClassLoader() { @RepeatedTest(10) void mixingClassAndMethodLevelLocks() { - var events = executeConcurrently(4, TestCaseWithSortedLocks.class, TestCaseWithUnsortedLocks.class); + var events = executeConcurrentlySuccessfully(4, TestCaseWithSortedLocks.class, + TestCaseWithUnsortedLocks.class).list(); assertThat(events.stream().filter(event(test(), finishedSuccessfully())::matches)).hasSize(6); assertThat(ThreadReporter.getThreadNames(events).count()).isLessThanOrEqualTo(2); @@ -154,7 +160,7 @@ void mixingClassAndMethodLevelLocks() { @RepeatedTest(10) void locksOnNestedTests() { - var events = executeConcurrently(3, TestCaseWithNestedLocks.class); + var events = executeConcurrentlySuccessfully(3, TestCaseWithNestedLocks.class).list(); assertThat(events.stream().filter(event(test(), finishedSuccessfully())::matches)).hasSize(6); assertThat(ThreadReporter.getThreadNames(events)).hasSize(1); @@ -162,7 +168,7 @@ void locksOnNestedTests() { @Test void afterHooksAreCalledAfterConcurrentDynamicTestsAreFinished() { - var events = executeConcurrently(3, ConcurrentDynamicTestCase.class); + var events = executeConcurrentlySuccessfully(3, ConcurrentDynamicTestCase.class).list(); assertThat(events.stream().filter(event(test(), finishedSuccessfully())::matches)).hasSize(1); var timestampedEvents = ConcurrentDynamicTestCase.events; @@ -175,14 +181,14 @@ void afterHooksAreCalledAfterConcurrentDynamicTestsAreFinished() { */ @Test void threadInterruptedByUserCode() { - var events = executeConcurrently(3, InterruptedThreadTestCase.class); + var events = executeConcurrentlySuccessfully(3, InterruptedThreadTestCase.class).list(); assertThat(events.stream().filter(event(test(), finishedSuccessfully())::matches)).hasSize(4); } @Test void executesTestTemplatesWithResourceLocksInSameThread() { - var events = executeConcurrently(2, ConcurrentTemplateTestCase.class); + var events = executeConcurrentlySuccessfully(2, ConcurrentTemplateTestCase.class).list(); assertThat(events.stream().filter(event(test(), finishedSuccessfully())::matches)).hasSize(10); assertThat(ThreadReporter.getThreadNames(events)).hasSize(1); @@ -228,30 +234,22 @@ void executesMethodsInParallelIfEnabledViaConfigurationParameter() { @Test void canRunTestsIsolatedFromEachOther() { - var events = executeConcurrently(2, IsolatedTestCase.class); - - assertThat(events.stream().filter(event(test(), finishedWithFailure())::matches)).isEmpty(); + executeConcurrentlySuccessfully(2, IsolatedTestCase.class); } @Test void canRunTestsIsolatedFromEachOtherWithNestedCases() { - var events = executeConcurrently(4, NestedIsolatedTestCase.class); - - assertThat(events.stream().filter(event(test(), finishedWithFailure())::matches)).isEmpty(); + executeConcurrentlySuccessfully(4, NestedIsolatedTestCase.class); } @Test void canRunTestsIsolatedFromEachOtherAcrossClasses() { - var events = executeConcurrently(4, IndependentClasses.A.class, IndependentClasses.B.class); - - assertThat(events.stream().filter(event(test(), finishedWithFailure())::matches)).isEmpty(); + executeConcurrentlySuccessfully(4, IndependentClasses.A.class, IndependentClasses.B.class); } @RepeatedTest(10) void canRunTestsIsolatedFromEachOtherAcrossClassesWithOtherResourceLocks() { - var events = executeConcurrently(4, IndependentClasses.B.class, IndependentClasses.C.class); - - assertThat(events.stream().filter(event(test(), finishedWithFailure())::matches)).isEmpty(); + executeConcurrentlySuccessfully(4, IndependentClasses.B.class, IndependentClasses.C.class); } @Test @@ -262,9 +260,8 @@ void runsIsolatedTestsLastToMaximizeParallelism() { ); Class[] testClasses = { IsolatedTestCase.class, SuccessfulParallelTestCase.class }; var events = executeWithFixedParallelism(3, configParams, testClasses) // - .allEvents(); - - assertThat(events.stream().filter(event(test(), finishedWithFailure())::matches)).isEmpty(); + .allEvents() // + .assertStatistics(it -> it.failed(0)); List parallelTestMethodEvents = events.reportingEntryPublished() // .filter(e -> e.getTestDescriptor().getSource() // @@ -283,6 +280,15 @@ void runsIsolatedTestsLastToMaximizeParallelism() { assertThat(isolatedClassStart).isAfterOrEqualTo(parallelClassFinish); } + @ParameterizedTest + @ValueSource(classes = { IsolatedMethodFirstTestCase.class, IsolatedMethodLastTestCase.class, + IsolatedNestedMethodFirstTestCase.class, IsolatedNestedMethodLastTestCase.class }) + void canRunTestsIsolatedFromEachOtherWhenDeclaredOnMethodLevel(Class testClass) { + List events = executeConcurrentlySuccessfully(1, testClass).list(); + + assertThat(ThreadReporter.getThreadNames(events)).hasSize(1); + } + @Isolated("testing") static class IsolatedTestCase { static AtomicInteger sharedResource; @@ -355,6 +361,122 @@ void b() throws Exception { } } + @ExtendWith(ThreadReporter.class) + static class IsolatedMethodFirstTestCase { + + static AtomicInteger sharedResource; + static CountDownLatch countDownLatch; + + @BeforeAll + static void initialize() { + sharedResource = new AtomicInteger(); + countDownLatch = new CountDownLatch(2); + } + + @Test + @ResourceLock(value = GLOBAL_KEY, mode = READ_WRITE) // effectively @Isolated + void test1() throws InterruptedException { + incrementBlockAndCheck(sharedResource, countDownLatch); + } + + @Test + @ResourceLock(value = "b", mode = READ_WRITE) + void test2() throws InterruptedException { + incrementBlockAndCheck(sharedResource, countDownLatch); + } + } + + @ExtendWith(ThreadReporter.class) + static class IsolatedMethodLastTestCase { + + static AtomicInteger sharedResource; + static CountDownLatch countDownLatch; + + @BeforeAll + static void initialize() { + sharedResource = new AtomicInteger(); + countDownLatch = new CountDownLatch(2); + } + + @Test + @ResourceLock(value = "b", mode = READ_WRITE) + void test1() throws InterruptedException { + incrementBlockAndCheck(sharedResource, countDownLatch); + } + + @Test + @ResourceLock(value = GLOBAL_KEY, mode = READ_WRITE) // effectively @Isolated + void test2() throws InterruptedException { + incrementBlockAndCheck(sharedResource, countDownLatch); + } + } + + @ExtendWith(ThreadReporter.class) + static class IsolatedNestedMethodFirstTestCase { + + static AtomicInteger sharedResource; + static CountDownLatch countDownLatch; + + @BeforeAll + static void initialize() { + sharedResource = new AtomicInteger(); + countDownLatch = new CountDownLatch(2); + } + + @Nested + class Test1 { + + @Test + @ResourceLock(value = GLOBAL_KEY, mode = READ_WRITE) // effectively @Isolated + void test1() throws InterruptedException { + incrementBlockAndCheck(sharedResource, countDownLatch); + } + } + + @Nested + class Test2 { + + @Test + @ResourceLock(value = "b", mode = READ_WRITE) + void test2() throws InterruptedException { + incrementBlockAndCheck(sharedResource, countDownLatch); + } + } + } + + @ExtendWith(ThreadReporter.class) + static class IsolatedNestedMethodLastTestCase { + + static AtomicInteger sharedResource; + static CountDownLatch countDownLatch; + + @BeforeAll + static void initialize() { + sharedResource = new AtomicInteger(); + countDownLatch = new CountDownLatch(2); + } + + @Nested + class Test1 { + + @Test + @ResourceLock(value = "b", mode = READ_WRITE) + void test1() throws InterruptedException { + incrementBlockAndCheck(sharedResource, countDownLatch); + } + } + + @Nested + class Test2 { + + @Test + @ResourceLock(value = GLOBAL_KEY, mode = READ_WRITE) // effectively @Isolated + void test2() throws InterruptedException { + incrementBlockAndCheck(sharedResource, countDownLatch); + } + } + } + static class IndependentClasses { static AtomicInteger sharedResource = new AtomicInteger(); static CountDownLatch countDownLatch = new CountDownLatch(4); @@ -416,11 +538,21 @@ private List getTimestampsFor(List events, Condition cond // @formatter:on } - private List executeConcurrently(int parallelism, Class... testClasses) { + private Events executeConcurrentlySuccessfully(int parallelism, Class... testClasses) { + var events = executeConcurrently(parallelism, testClasses); + try { + return events.assertStatistics(it -> it.failed(0)); + } + catch (AssertionError error) { + events.debug(); + throw error; + } + } + + private Events executeConcurrently(int parallelism, Class... testClasses) { Map configParams = Map.of(DEFAULT_PARALLEL_EXECUTION_MODE, "concurrent"); return executeWithFixedParallelism(parallelism, configParams, testClasses) // - .allEvents() // - .list(); + .allEvents(); } private EngineExecutionResults executeWithFixedParallelism(int parallelism, Map configParams, From 7ec1350104cdc26b4b8f03ab648323a9c2bb29d7 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 3 Oct 2024 16:24:29 +0200 Subject: [PATCH 134/611] Add Testiny as bronze sponsor --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 059bbb33077b..a15a57275259 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This repository is the home of _JUnit 5_. * **Gold Sponsors:** [JetBrains](https://jb.gg/junit-logo) * **Silver Sponsors:** [Micromata](https://www.micromata.de), [Quo Card](https://quo-digital.jp) -* **Bronze Sponsors:** [Premium Minds](https://www.premium-minds.com), [Testmo](https://www.testmo.com), [codefortynine](https://codefortynine.com), [Info Support](https://www.infosupport.com), [Stiltsoft](https://stiltsoft.com), [Code Intelligence](https://www.code-intelligence.com), [Route4Me](https://route4me.com/) +* **Bronze Sponsors:** [Premium Minds](https://www.premium-minds.com), [Testmo](https://www.testmo.com), [codefortynine](https://codefortynine.com), [Info Support](https://www.infosupport.com), [Stiltsoft](https://stiltsoft.com), [Code Intelligence](https://www.code-intelligence.com), [Route4Me](https://route4me.com/), [Testiny](https://www.testiny.io/) ## Latest Releases From 5edbcbeb95be826ad2438d47fc52e1bde75b2ced Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 3 Oct 2024 21:56:21 +0000 Subject: [PATCH 135/611] Update github/codeql-action digest to 6db8d63 --- .github/workflows/codeql-analysis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d6077d07c295..df3083fbecce 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -32,7 +32,7 @@ jobs: - name: Check out repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - name: Initialize CodeQL - uses: github/codeql-action/init@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3 + uses: github/codeql-action/init@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3 with: languages: ${{ matrix.language }} tools: linked @@ -44,4 +44,4 @@ jobs: -Dscan.tag.CodeQL \ allMainClasses - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3 + uses: github/codeql-action/analyze@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3 From 6bc20af47c9c0a6dd9cb4d33acc17ad7e3f41dad Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 4 Oct 2024 13:46:17 +0200 Subject: [PATCH 136/611] Only add "status: new" label for issues without another status label --- .github/workflows/label-opened-issues.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/label-opened-issues.yml b/.github/workflows/label-opened-issues.yml index 9c98295a1840..855292615813 100644 --- a/.github/workflows/label-opened-issues.yml +++ b/.github/workflows/label-opened-issues.yml @@ -12,9 +12,18 @@ jobs: - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 with: script: | - github.rest.issues.addLabels({ + const issue = await github.rest.issues.get({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - labels: ["status: new"] - }) + }); + const originalLabels = issue.data.labels.map(l => l.name); + const statusLabels = originalLabels.filter(l => l.startsWith("status: ")); + if (statusLabels.length === 0) { + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ["status: new"] + }) + } From faffe7bcbd7d634944953dca6a3ca3c142292c6f Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 4 Oct 2024 14:53:37 +0200 Subject: [PATCH 137/611] Finalize 5.11.2 release notes --- .../release-notes/release-notes-5.11.2.adoc | 44 ++----------------- 1 file changed, 4 insertions(+), 40 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.2.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.2.adoc index fcf7313a6354..aecdaa23aac2 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.2.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.2.adoc @@ -1,9 +1,9 @@ [[release-notes-5.11.2]] == 5.11.2 -*Date of Release:* ❓ +*Date of Release:* October 4, 2024 -*Scope:* ❓ +*Scope:* Bug fixes and enhancements since 5.11.1 For a complete list of all _closed_ issues and pull requests for this release, consult the link:{junit5-repo}+/milestone/82?closed=1+[5.11.2] milestone page in the JUnit repository @@ -20,50 +20,14 @@ on GitHub. global read-write locks. When such a lock was declared on descendants of top-level nodes in the test tree, such as Cucumber scenarios, test execution failed. -[[release-notes-5.11.2-junit-platform-deprecations-and-breaking-changes]] -==== Deprecations and Breaking Changes - -* ❓ - -[[release-notes-5.11.2-junit-platform-new-features-and-improvements]] -==== New Features and Improvements - -* ❓ - [[release-notes-5.11.2-junit-jupiter]] === JUnit Jupiter -[[release-notes-5.11.2-junit-jupiter-bug-fixes]] -==== Bug Fixes - -* ❓ - -[[release-notes-5.11.2-junit-jupiter-deprecations-and-breaking-changes]] -==== Deprecations and Breaking Changes - -* ❓ - -[[release-notes-5.11.2-junit-jupiter-new-features-and-improvements]] -==== New Features and Improvements - -* ❓ +No changes. [[release-notes-5.11.2-junit-vintage]] === JUnit Vintage -[[release-notes-5.11.2-junit-vintage-bug-fixes]] -==== Bug Fixes - -* ❓ - -[[release-notes-5.11.2-junit-vintage-deprecations-and-breaking-changes]] -==== Deprecations and Breaking Changes - -* ❓ - -[[release-notes-5.11.2-junit-vintage-new-features-and-improvements]] -==== New Features and Improvements - -* ❓ +No changes. From d64e69965fc86ac33d31ba197486ebdad204ef8c Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 4 Oct 2024 14:55:15 +0200 Subject: [PATCH 138/611] Release 5.11.2 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a15a57275259..114ce9957fc2 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This repository is the home of _JUnit 5_. ## Latest Releases -- General Availability (GA): [JUnit 5.11.1](https://github.com/junit-team/junit5/releases/tag/r5.11.1) (September 25, 2024) +- General Availability (GA): [JUnit 5.11.2](https://github.com/junit-team/junit5/releases/tag/r5.11.2) (October 4, 2024) - Preview (Milestone/Release Candidate): N/A ## Documentation From 09659cffa884211a86817ffb7bfd92317b19497f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 5 Oct 2024 01:51:01 +0000 Subject: [PATCH 139/611] Update plugin plantuml to v8.10.2 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f56f8cf8ccc6..f5e13686189f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -90,7 +90,7 @@ foojayResolver = { id = "org.gradle.toolchains.foojay-resolver", version = "0.8. gitPublish = { id = "org.ajoberstar.git-publish", version = "4.2.2" } jmh = { id = "me.champeau.jmh", version = "0.7.2" } nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" } -plantuml = { id = "io.freefair.plantuml", version = "8.10" } +plantuml = { id = "io.freefair.plantuml", version = "8.10.2" } shadow = { id = "com.gradleup.shadow", version = "8.3.3" } spotless = { id = "com.diffplug.spotless", version = "7.0.0.BETA2" } versions = { id = "com.github.ben-manes.versions", version = "0.51.0" } From 7c16e6dd8931cede0a04c8a9a25b95ebb64c79f1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 6 Oct 2024 13:38:41 +0000 Subject: [PATCH 140/611] Update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.5.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f5e13686189f..21331cdf8fc0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -16,7 +16,7 @@ ktlint = "1.3.1" log4j = "2.24.1" opentest4j = "1.3.0" openTestReporting = "0.1.0-M2" -surefire = "3.5.0" +surefire = "3.5.1" xmlunit = "2.10.0" [libraries] From 5a492527a97c69c9d4a24aaaa111aee9398e31d3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 6 Oct 2024 16:27:32 +0000 Subject: [PATCH 141/611] Update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.5.1 --- platform-tooling-support-tests/projects/java-versions/pom.xml | 2 +- platform-tooling-support-tests/projects/maven-starter/pom.xml | 2 +- platform-tooling-support-tests/projects/vintage/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/platform-tooling-support-tests/projects/java-versions/pom.xml b/platform-tooling-support-tests/projects/java-versions/pom.xml index 5714dfc34e46..dc735616b169 100644 --- a/platform-tooling-support-tests/projects/java-versions/pom.xml +++ b/platform-tooling-support-tests/projects/java-versions/pom.xml @@ -41,7 +41,7 @@ maven-surefire-plugin - 3.5.0 + 3.5.1 diff --git a/platform-tooling-support-tests/projects/maven-starter/pom.xml b/platform-tooling-support-tests/projects/maven-starter/pom.xml index 166263dd1765..012e56ca896b 100644 --- a/platform-tooling-support-tests/projects/maven-starter/pom.xml +++ b/platform-tooling-support-tests/projects/maven-starter/pom.xml @@ -47,7 +47,7 @@ maven-surefire-plugin - 3.5.0 + 3.5.1 diff --git a/platform-tooling-support-tests/projects/vintage/pom.xml b/platform-tooling-support-tests/projects/vintage/pom.xml index 74d3bc4b67bd..1838bdee03f4 100644 --- a/platform-tooling-support-tests/projects/vintage/pom.xml +++ b/platform-tooling-support-tests/projects/vintage/pom.xml @@ -43,7 +43,7 @@ maven-surefire-plugin - 3.5.0 + 3.5.1 From 8e9094d60fa7964e635c6f4e91b7241266b3f09e Mon Sep 17 00:00:00 2001 From: Vladimir Dmitrienko Date: Mon, 7 Oct 2024 13:03:59 +0200 Subject: [PATCH 142/611] Allow determining exclusive resources programmatically (#3889) The new `@ResourceLock(providers = ...)` attribute accepts an array of one or more classes implementing the `ResourceLocksProvider` interface. It allows to dynamically add resources at runtime (immediately before starting execution on the engine level). Resources can be distributed based on any test class or method attribute (e.g. package name, class / method name etc.) or any other custom logic. This approach serves as a more flexible and less verbose alternative for cases in which: - adding lots of @ResourceLock(value, mode) annotations manually may be inconvenient; - shared resources are not known until runtime. Resolves #2677. --------- Co-authored-by: Marc Philipp --- .../src/docs/asciidoc/link-attributes.adoc | 1 + .../release-notes-5.12.0-M1.adoc | 2 + .../asciidoc/user-guide/writing-tests.adoc | 15 +- .../DynamicSharedResourcesDemo.java | 78 ++++ .../StaticSharedResourcesDemo.java} | 4 +- .../api/parallel/ResourceAccessMode.java | 1 + .../jupiter/api/parallel/ResourceLock.java | 28 +- .../api/parallel/ResourceLocksProvider.java | 209 ++++++++++ .../junit/jupiter/api/parallel/Resources.java | 1 + .../descriptor/ClassBasedTestDescriptor.java | 9 +- .../descriptor/ClassTestDescriptor.java | 7 - .../descriptor/JupiterTestDescriptor.java | 63 ++- .../descriptor/MethodBasedTestDescriptor.java | 7 +- .../descriptor/NestedClassTestDescriptor.java | 26 +- .../TestTemplateInvocationTestDescriptor.java | 2 +- .../engine/support/descriptor/LockTests.java | 48 +++ .../ResourceLockAnnotationTests.java | 391 ++++++++++++++++++ .../ResourceLocksProviderTests.java | 298 +++++++++++++ 18 files changed, 1155 insertions(+), 35 deletions(-) create mode 100644 documentation/src/test/java/example/sharedresources/DynamicSharedResourcesDemo.java rename documentation/src/test/java/example/{SharedResourcesDemo.java => sharedresources/StaticSharedResourcesDemo.java} (96%) create mode 100644 junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocksProvider.java create mode 100644 platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/LockTests.java create mode 100644 platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLockAnnotationTests.java create mode 100644 platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLocksProviderTests.java diff --git a/documentation/src/docs/asciidoc/link-attributes.adoc b/documentation/src/docs/asciidoc/link-attributes.adoc index dfbe7932d479..5c55bec09cf7 100644 --- a/documentation/src/docs/asciidoc/link-attributes.adoc +++ b/documentation/src/docs/asciidoc/link-attributes.adoc @@ -128,6 +128,7 @@ endif::[] :Execution: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/parallel/Execution.html[@Execution] :Isolated: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/parallel/Isolated.html[@Isolated] :ResourceLock: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/parallel/ResourceLock.html[@ResourceLock] +:ResourceLocksProvider: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/parallel/ResourceLocksProvider.html[ResourceLocksProvider] :Resources: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/parallel/Resources.html[Resources] // Jupiter Extension APIs :extension-api-package: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/package-summary.html[org.junit.jupiter.api.extension] diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index e23dcb707c34..504d94de8d48 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -54,6 +54,8 @@ JUnit repository on GitHub. `@ConvertWith`), and `ArgumentsAggregator` (declared via `@AggregateWith`) implementations can now use constructor injection from registered `ParameterResolver` extensions. +* Allow determining "shared resources" at runtime via the new `@ResourceLock#providers` + attribute that accepts implementations of `ResourceLocksProvider`. [[release-notes-5.12.0-M1-junit-vintage]] diff --git a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc index 2dc985d9a872..d8e7c351c401 100644 --- a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc +++ b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc @@ -2943,6 +2943,12 @@ execution. The shared resource is identified by a unique name which is a `String name can be user-defined or one of the predefined constants in `{Resources}`: `SYSTEM_PROPERTIES`, `SYSTEM_OUT`, `SYSTEM_ERR`, `LOCALE`, or `TIME_ZONE`. +In addition to declaring these shared resources statically, the `{ResourceLock}` +annotation has a `providers` attribute that allows registering implementations of the +`{ResourceLocksProvider}` interface that can add shared resources dynamically at runtime. +Note that resources declared statically with `{ResourceLock}` annotation are combined with +resources added dynamically by `{ResourceLocksProvider}` implementations. + If the tests in the following example were run in parallel _without_ the use of {ResourceLock}, they would be _flaky_. Sometimes they would pass, and at other times they would fail due to the inherent race condition of writing and then reading the same JVM @@ -2970,8 +2976,15 @@ parallel with each other but not while any other test that requires `READ_WRITE` to the same shared resource is running. [source,java] +.Declaring shared resources "statically" with `{ResourceLock}` annotation +---- +include::{testDir}/example/sharedresources/StaticSharedResourcesDemo.java[tags=user_guide] +---- + +[source,java] +.Adding shared resources "dynamically" with `{ResourceLocksProvider}` implementation ---- -include::{testDir}/example/SharedResourcesDemo.java[tags=user_guide] +include::{testDir}/example/sharedresources/DynamicSharedResourcesDemo.java[tags=user_guide] ---- diff --git a/documentation/src/test/java/example/sharedresources/DynamicSharedResourcesDemo.java b/documentation/src/test/java/example/sharedresources/DynamicSharedResourcesDemo.java new file mode 100644 index 000000000000..8c80d511a353 --- /dev/null +++ b/documentation/src/test/java/example/sharedresources/DynamicSharedResourcesDemo.java @@ -0,0 +1,78 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package example.sharedresources; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT; +import static org.junit.jupiter.api.parallel.ResourceAccessMode.READ; +import static org.junit.jupiter.api.parallel.ResourceAccessMode.READ_WRITE; +import static org.junit.jupiter.api.parallel.Resources.SYSTEM_PROPERTIES; + +import java.lang.reflect.Method; +import java.util.Collections; +import java.util.Properties; +import java.util.Set; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.parallel.Execution; +import org.junit.jupiter.api.parallel.ResourceAccessMode; +import org.junit.jupiter.api.parallel.ResourceLock; +import org.junit.jupiter.api.parallel.ResourceLocksProvider; + +// tag::user_guide[] +@Execution(CONCURRENT) +@ResourceLock(providers = DynamicSharedResourcesDemo.Provider.class) +class DynamicSharedResourcesDemo { + + private Properties backup; + + @BeforeEach + void backup() { + backup = new Properties(); + backup.putAll(System.getProperties()); + } + + @AfterEach + void restore() { + System.setProperties(backup); + } + + @Test + void customPropertyIsNotSetByDefault() { + assertNull(System.getProperty("my.prop")); + } + + @Test + void canSetCustomPropertyToApple() { + System.setProperty("my.prop", "apple"); + assertEquals("apple", System.getProperty("my.prop")); + } + + @Test + void canSetCustomPropertyToBanana() { + System.setProperty("my.prop", "banana"); + assertEquals("banana", System.getProperty("my.prop")); + } + + static class Provider implements ResourceLocksProvider { + + @Override + public Set provideForMethod(Class testClass, Method testMethod) { + ResourceAccessMode mode = testMethod.getName().startsWith("canSet") ? READ_WRITE : READ; + return Collections.singleton(new Lock(SYSTEM_PROPERTIES, mode)); + } + } + +} +// end::user_guide[] diff --git a/documentation/src/test/java/example/SharedResourcesDemo.java b/documentation/src/test/java/example/sharedresources/StaticSharedResourcesDemo.java similarity index 96% rename from documentation/src/test/java/example/SharedResourcesDemo.java rename to documentation/src/test/java/example/sharedresources/StaticSharedResourcesDemo.java index d52248892356..869f9eb7925d 100644 --- a/documentation/src/test/java/example/SharedResourcesDemo.java +++ b/documentation/src/test/java/example/sharedresources/StaticSharedResourcesDemo.java @@ -8,7 +8,7 @@ * https://www.eclipse.org/legal/epl-v20.html */ -package example; +package example.sharedresources; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; @@ -27,7 +27,7 @@ // tag::user_guide[] @Execution(CONCURRENT) -class SharedResourcesDemo { +class StaticSharedResourcesDemo { private Properties backup; diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceAccessMode.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceAccessMode.java index 24cdc2240e21..cc973b0dd0dd 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceAccessMode.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceAccessMode.java @@ -19,6 +19,7 @@ * * @since 5.3 * @see ResourceLock + * @see ResourceLocksProvider.Lock */ @API(status = STABLE, since = "5.10") public enum ResourceAccessMode { diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLock.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLock.java index f9839322b37a..f32012e6871e 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLock.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLock.java @@ -10,6 +10,7 @@ package org.junit.jupiter.api.parallel; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.STABLE; import java.lang.annotation.ElementType; @@ -48,10 +49,20 @@ *

Since JUnit Jupiter 5.4, this annotation is {@linkplain Inherited inherited} * within class hierarchies. * + *

Since JUnit Jupiter 5.12, this annotation supports adding shared resources + * dynamically at runtime via {@link ResourceLock#providers}. + * + *

Resources declared "statically" using {@link #value()} and {@link #mode()} + * are combined with "dynamic" resources added via {@link #providers()}. + * For example, declaring resource "A" via {@code @ResourceLock("A")} + * and resource "B" via a provider returning {@code new Lock("B")} will result + * in two shared resources "A" and "B". + * * @see Isolated * @see Resources * @see ResourceAccessMode * @see ResourceLocks + * @see ResourceLocksProvider * @since 5.3 */ @API(status = STABLE, since = "5.10") @@ -64,9 +75,12 @@ /** * The resource key. * + *

Defaults to an empty string. + * * @see Resources + * @see ResourceLocksProvider.Lock#getKey() */ - String value(); + String value() default ""; /** * The resource access mode. @@ -74,7 +88,19 @@ *

Defaults to {@link ResourceAccessMode#READ_WRITE READ_WRITE}. * * @see ResourceAccessMode + * @see ResourceLocksProvider.Lock#getAccessMode() */ ResourceAccessMode mode() default ResourceAccessMode.READ_WRITE; + /** + * An array of one or more classes implementing {@link ResourceLocksProvider}. + * + *

Defaults to an empty array. + * + * @see ResourceLocksProvider.Lock + * @since 5.12 + */ + @API(status = EXPERIMENTAL, since = "5.12") + Class[] providers() default {}; + } diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocksProvider.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocksProvider.java new file mode 100644 index 000000000000..720224ed033d --- /dev/null +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocksProvider.java @@ -0,0 +1,209 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.api.parallel; + +import static java.util.Collections.emptySet; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; + +import java.lang.reflect.Method; +import java.util.Objects; +import java.util.Set; + +import org.apiguardian.api.API; +import org.junit.jupiter.api.Nested; +import org.junit.platform.commons.util.Preconditions; +import org.junit.platform.commons.util.ToStringBuilder; + +/** + * {@code @ResourceLocksProvider} is used to add shared resources + * to a test class and / or its test methods dynamically at runtime. + * + *

Each shared resource is represented by an instance of {@link Lock}. + * + *

Adding shared resources using this interface has the same semantics + * as declaring them via {@code @ResourceLock(value, mode)} annotation + * but for some cases may be a more flexible and less verbose alternative + * since it allows to add resources programmatically. + * + *

Implementations must provide a no-args constructor. + * + * @since 5.12 + * @see ResourceLock#providers() + * @see Resources + * @see ResourceAccessMode + * @see Lock + */ +@API(status = EXPERIMENTAL, since = "5.12") +public interface ResourceLocksProvider { + + /** + * Add shared resources to a test class. + * + *

Invoked in case a test class or its parent class + * is annotated with {@code @ResourceLock(providers)}. + * + * @apiNote Adding {@linkplain Lock a shared resource} with this method + * has the same semantics as annotating a test class + * with analogous {@code @ResourceLock(value, mode)}. + * + * @param testClass a test class to add shared resources + * @return a set of {@link Lock}; may be empty + */ + default Set provideForClass(Class testClass) { + return emptySet(); + } + + /** + * Add shared resources to a {@linkplain Nested nested} test class. + * + *

Invoked in case: + *

    + *
  • an enclosing test class of any level or its parent class + * is annotated with {@code @ResourceLock(providers)}.
  • + *
  • a nested test class or its parent class + * is annotated with {@code @ResourceLock(providers)}.
  • + *
+ * + *

Invoked for a nested test class + * annotated with {@code @ResourceLock(providers)} + * and for its child classes. + * + * @apiNote Adding {@linkplain Lock a shared resource} with this method + * has the same semantics as annotating a nested test class + * with analogous {@code @ResourceLock(value, mode)}. + * + * @param testClass a nested test class to add shared resources + * @return a set of {@link Lock}; may be empty + * @see Nested + */ + default Set provideForNestedClass(Class testClass) { + return emptySet(); + } + + /** + * Add shared resources to a test method. + * + *

Invoked in case: + *

    + *
  • an enclosing test class of any level or its parent class + * is annotated with {@code @ResourceLock(providers)}.
  • + *
  • a test method + * is annotated with {@code @ResourceLock(providers)}.
  • + *
+ * + * @apiNote Adding {@linkplain Lock a shared resource} with this method + * has the same semantics as annotating a test method + * with analogous {@code @ResourceLock(value, mode)}. + * + * @param testClass a test class + * or {@linkplain Nested nested} test class containing the {@code testMethod} + * @param testMethod a test method to add shared resources + * @return a set of {@link Lock}; may be empty + */ + default Set provideForMethod(Class testClass, Method testMethod) { + return emptySet(); + } + + /** + * + *

{@link Lock} represents a shared resource. + * + *

Each resource is identified by a {@link #key}. + * In addition, the {@link #accessMode} allows to specify + * whether a test class or test + * method requires {@link ResourceAccessMode#READ_WRITE READ_WRITE} + * or only {@link ResourceAccessMode#READ READ} access to the resource. + * + * @apiNote {@link Lock#key} and {@link Lock#accessMode} have the same + * semantics as {@link ResourceLock#value()} and {@link ResourceLock#mode()} + * respectively. + * + * @since 5.12 + * @see Isolated + * @see Resources + * @see ResourceAccessMode + * @see ResourceLock + * @see ResourceLocksProvider + */ + final class Lock { + + private final String key; + + private final ResourceAccessMode accessMode; + + /** + * Create a new {@code Lock} with {@code accessMode = READ_WRITE}. + * + * @param key the identifier of the resource; never {@code null} or blank + * @see ResourceLock#value() + */ + public Lock(String key) { + this(key, ResourceAccessMode.READ_WRITE); + } + + /** + * Create a new {@code Lock}. + * + * @param key the identifier of the resource; never {@code null} or blank + * @param accessMode the lock mode to use to synchronize access to the resource; never {@code null} + * @see ResourceLock#value() + * @see ResourceLock#mode() + */ + public Lock(String key, ResourceAccessMode accessMode) { + this.key = Preconditions.notBlank(key, "key must not be null or blank"); + this.accessMode = Preconditions.notNull(accessMode, "accessMode must not be null"); + } + + /** + * Get the key of this lock. + * + * @see ResourceLock#value() + */ + public String getKey() { + return key; + } + + /** + * Get the access mode of this lock. + * + * @see ResourceLock#mode() + */ + public ResourceAccessMode getAccessMode() { + return accessMode; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Lock lock = (Lock) o; + return Objects.equals(key, lock.key) && accessMode == lock.accessMode; + } + + @Override + public int hashCode() { + return Objects.hash(key, accessMode); + } + + @Override + public String toString() { + return new ToStringBuilder(this) // + .append("key", key) // + .append("accessMode", accessMode) // + .toString(); + } + } + +} diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/Resources.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/Resources.java index c9fa33ff23f0..d6c4be3056a7 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/Resources.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/Resources.java @@ -19,6 +19,7 @@ * * @since 5.3 * @see ResourceLock + * @see ResourceLocksProvider.Lock */ @API(status = STABLE, since = "5.10") public class Resources { diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java index baa884c18e7e..ddfbe7ef3a38 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java @@ -112,8 +112,6 @@ public final Class getTestClass() { return this.testClass; } - public abstract List> getEnclosingTestClasses(); - @Override public Type getType() { return Type.CONTAINER; @@ -142,7 +140,12 @@ public void setDefaultChildExecutionMode(ExecutionMode defaultChildExecutionMode @Override public Set getExclusiveResources() { - return getExclusiveResourcesFromAnnotation(getTestClass()); + // @formatter:off + return getExclusiveResourcesFromAnnotations( + getTestClass(), + provider -> provider.provideForClass(getTestClass()) + ); + // @formatter:on } @Override diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassTestDescriptor.java index 4b840a0d6057..a7c3034a8f60 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassTestDescriptor.java @@ -10,12 +10,10 @@ package org.junit.jupiter.engine.descriptor; -import static java.util.Collections.emptyList; import static org.apiguardian.api.API.Status.INTERNAL; import static org.junit.jupiter.engine.descriptor.DisplayNameUtils.createDisplayNameSupplierForClass; import java.util.LinkedHashSet; -import java.util.List; import java.util.Optional; import java.util.Set; @@ -59,11 +57,6 @@ public Set getTags() { return new LinkedHashSet<>(this.tags); } - @Override - public List> getEnclosingTestClasses() { - return emptyList(); - } - // --- Node ---------------------------------------------------------------- @Override diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.java index e96c36333fcb..54673dcb91d5 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.java @@ -10,8 +10,10 @@ package org.junit.jupiter.engine.descriptor; +import static java.util.Collections.emptyList; import static java.util.stream.Collectors.collectingAndThen; import static java.util.stream.Collectors.toCollection; +import static java.util.stream.Collectors.toList; import static java.util.stream.Collectors.toSet; import static org.apiguardian.api.API.Status.INTERNAL; import static org.junit.jupiter.engine.descriptor.DisplayNameUtils.determineDisplayName; @@ -19,12 +21,16 @@ import static org.junit.platform.commons.support.AnnotationSupport.findRepeatableAnnotations; import java.lang.reflect.AnnotatedElement; +import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.LinkedHashSet; import java.util.List; import java.util.Optional; import java.util.Set; +import java.util.function.Function; import java.util.function.Supplier; +import java.util.stream.Stream; import org.apiguardian.api.API; import org.junit.jupiter.api.Tag; @@ -33,6 +39,7 @@ import org.junit.jupiter.api.parallel.Execution; import org.junit.jupiter.api.parallel.ResourceAccessMode; import org.junit.jupiter.api.parallel.ResourceLock; +import org.junit.jupiter.api.parallel.ResourceLocksProvider; import org.junit.jupiter.engine.config.JupiterConfiguration; import org.junit.jupiter.engine.execution.ConditionEvaluator; import org.junit.jupiter.engine.execution.JupiterEngineExecutionContext; @@ -41,6 +48,8 @@ import org.junit.platform.commons.logging.Logger; import org.junit.platform.commons.logging.LoggerFactory; import org.junit.platform.commons.util.ExceptionUtils; +import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.util.StringUtils; import org.junit.platform.commons.util.UnrecoverableExceptions; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.TestSource; @@ -100,6 +109,17 @@ static Set getTags(AnnotatedElement element) { // @formatter:on } + public List> getEnclosingTestClasses() { + TestDescriptor parent = getParent().orElse(null); + if (parent instanceof ClassBasedTestDescriptor) { + ClassBasedTestDescriptor parentClassDescriptor = (ClassBasedTestDescriptor) parent; + List> result = new ArrayList<>(parentClassDescriptor.getEnclosingTestClasses()); + result.add(parentClassDescriptor.getTestClass()); + return result; + } + return emptyList(); + } + /** * Invoke exception handlers for the supplied {@code Throwable} one-by-one * until none are left or the throwable to handle has been swallowed. @@ -180,11 +200,46 @@ public static ExecutionMode toExecutionMode(org.junit.jupiter.api.parallel.Execu throw new JUnitException("Unknown ExecutionMode: " + mode); } - Set getExclusiveResourcesFromAnnotation(AnnotatedElement element) { + Set getExclusiveResourcesFromAnnotations(AnnotatedElement element, + Function> providerToLocks) { + // @formatter:off + List ownAnnotations = findRepeatableAnnotations(element, ResourceLock.class); + List enclosingClassesAnnotations = getEnclosingTestClasses().stream() + .map(clazz -> findRepeatableAnnotations(clazz, ResourceLock.class)) + .flatMap(Collection::stream) + .collect(toList()); + + return Stream.of( + getExclusiveResourcesFromValues(ownAnnotations), + getExclusiveResourcesFromProviders(ownAnnotations, providerToLocks), + getExclusiveResourcesFromProviders(enclosingClassesAnnotations, providerToLocks) + ).flatMap(s -> s) + .collect(toSet()); + // @formatter:on + } + + private Stream getExclusiveResourcesFromValues(List annotations) { + // @formatter:off + return annotations.stream() + .flatMap(annotation -> { + if (StringUtils.isBlank(annotation.value())) { + return Stream.empty(); + } + return Stream.of(new ExclusiveResource(annotation.value(), toLockMode(annotation.mode()))); + }); + // @formatter:on + } + + private Stream getExclusiveResourcesFromProviders(List annotations, + Function> providerToLocks) { // @formatter:off - return findRepeatableAnnotations(element, ResourceLock.class).stream() - .map(resource -> new ExclusiveResource(resource.value(), toLockMode(resource.mode()))) - .collect(toSet()); + return annotations.stream() + .flatMap(annotation -> Stream.of(annotation.providers()) + .map(ReflectionUtils::newInstance) + .map(providerToLocks) + .flatMap(Collection::stream) + .map(lock -> new ExclusiveResource(lock.getKey(), toLockMode(lock.getAccessMode()))) + ); // @formatter:on } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodBasedTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodBasedTestDescriptor.java index 8c851955c5b2..6a21a3ae6660 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodBasedTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodBasedTestDescriptor.java @@ -81,7 +81,12 @@ public final Set getTags() { @Override public Set getExclusiveResources() { - return getExclusiveResourcesFromAnnotation(getTestMethod()); + // @formatter:off + return getExclusiveResourcesFromAnnotations( + getTestMethod(), + provider -> provider.provideForMethod(getTestClass(), getTestMethod()) + ); + // @formatter:on } @Override diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/NestedClassTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/NestedClassTestDescriptor.java index 84ce0645b7d3..7732a85854f8 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/NestedClassTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/NestedClassTestDescriptor.java @@ -10,13 +10,10 @@ package org.junit.jupiter.engine.descriptor; -import static java.util.Collections.emptyList; import static org.apiguardian.api.API.Status.INTERNAL; import static org.junit.jupiter.engine.descriptor.DisplayNameUtils.createDisplayNameSupplierForNestedClass; -import java.util.ArrayList; import java.util.LinkedHashSet; -import java.util.List; import java.util.Optional; import java.util.Set; @@ -30,6 +27,7 @@ import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.TestTag; import org.junit.platform.engine.UniqueId; +import org.junit.platform.engine.support.hierarchical.ExclusiveResource; import org.junit.platform.engine.support.hierarchical.ThrowableCollector; /** @@ -61,18 +59,6 @@ public final Set getTags() { return allTags; } - @Override - public List> getEnclosingTestClasses() { - TestDescriptor parent = getParent().orElse(null); - if (parent instanceof ClassBasedTestDescriptor) { - ClassBasedTestDescriptor parentClassDescriptor = (ClassBasedTestDescriptor) parent; - List> result = new ArrayList<>(parentClassDescriptor.getEnclosingTestClasses()); - result.add(parentClassDescriptor.getTestClass()); - return result; - } - return emptyList(); - } - // --- Node ---------------------------------------------------------------- @Override @@ -87,4 +73,14 @@ protected TestInstances instantiateTestClass(JupiterEngineExecutionContext paren return instantiateTestClass(Optional.of(outerInstances), registry, extensionContext); } + @Override + public Set getExclusiveResources() { + // @formatter:off + return getExclusiveResourcesFromAnnotations( + getTestClass(), + provider -> provider.provideForNestedClass(getTestClass()) + ); + // @formatter:on + } + } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateInvocationTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateInvocationTestDescriptor.java index 32d627dff049..acc31605ebcb 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateInvocationTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateInvocationTestDescriptor.java @@ -53,7 +53,7 @@ public class TestTemplateInvocationTestDescriptor extends TestMethodTestDescript @Override public Set getExclusiveResources() { - // @ResourceLock annotations are already collected and returned by the enclosing container + // Resources are already collected and returned by the enclosing container return emptySet(); } diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/LockTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/LockTests.java new file mode 100644 index 000000000000..c0cc1d0c3a7c --- /dev/null +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/LockTests.java @@ -0,0 +1,48 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.engine.support.descriptor; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.parallel.ResourceAccessMode.READ; +import static org.junit.jupiter.api.parallel.ResourceAccessMode.READ_WRITE; +import static org.junit.jupiter.api.parallel.ResourceLocksProvider.Lock; + +import org.junit.jupiter.api.Test; +import org.junit.platform.AbstractEqualsAndHashCodeTests; + +/** + * Unit tests for {@link Lock}. + * + * @since 5.12 + */ +class LockTests extends AbstractEqualsAndHashCodeTests { + + @Test + void readWriteModeSetByDefault() { + assertEquals(READ_WRITE, new Lock("a").getAccessMode()); + } + + @Test + void equalsAndHashCode() { + // @formatter:off + assertEqualsAndHashCode( + new Lock("a", READ_WRITE), + new Lock("a", READ_WRITE), + new Lock("b", READ_WRITE) + ); + assertEqualsAndHashCode( + new Lock("a", READ_WRITE), + new Lock("a", READ_WRITE), + new Lock("a", READ) + ); + // @formatter:on + } +} diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLockAnnotationTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLockAnnotationTests.java new file mode 100644 index 000000000000..414e31c96993 --- /dev/null +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLockAnnotationTests.java @@ -0,0 +1,391 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.engine.support.descriptor; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.platform.engine.support.hierarchical.ExclusiveResource.LockMode; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.lang.reflect.Method; +import java.util.Set; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayNameGenerator; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.parallel.ExecutionMode; +import org.junit.jupiter.api.parallel.ResourceAccessMode; +import org.junit.jupiter.api.parallel.ResourceLock; +import org.junit.jupiter.api.parallel.ResourceLocksProvider; +import org.junit.jupiter.engine.config.JupiterConfiguration; +import org.junit.jupiter.engine.descriptor.ClassTestDescriptor; +import org.junit.jupiter.engine.descriptor.NestedClassTestDescriptor; +import org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor; +import org.junit.platform.engine.UniqueId; +import org.junit.platform.engine.support.hierarchical.ExclusiveResource; + +/** + * Integration tests for {@link ResourceLock} and {@link ResourceLocksProvider}. + * + * @since 5.12 + */ +class ResourceLockAnnotationTests { + + private static final UniqueId uniqueId = UniqueId.root("enigma", "foo"); + + private final JupiterConfiguration configuration = mock(); + + @BeforeEach + void setUp() { + when(configuration.getDefaultDisplayNameGenerator()).thenReturn(new DisplayNameGenerator.Standard()); + when(configuration.getDefaultExecutionMode()).thenReturn(ExecutionMode.SAME_THREAD); + } + + @Test + void noSharedResources() { + // @formatter:off + var classResources = getClassResources( + NoSharedResourcesTestCase.class + ); + assertThat(classResources).isEmpty(); + + var methodResources = getMethodResources( + NoSharedResourcesTestCase.class + ); + assertThat(methodResources).isEmpty(); + + var nestedClassResources = getNestedClassResources( + NoSharedResourcesTestCase.class, + NoSharedResourcesTestCase.NestedClass.class + ); + assertThat(nestedClassResources).isEmpty(); + // @formatter:on + } + + @Test + void addSharedResourcesViaAnnotationValue() { + // @formatter:off + var classResources = getClassResources( + SharedResourcesViaAnnotationValueTestCase.class + ); + assertThat(classResources).containsExactlyInAnyOrder( + new ExclusiveResource("a1", LockMode.READ_WRITE), + new ExclusiveResource("a2", LockMode.READ_WRITE) + ); + + var methodResources = getMethodResources( + SharedResourcesViaAnnotationValueTestCase.class + ); + assertThat(methodResources).containsExactlyInAnyOrder( + new ExclusiveResource("b1", LockMode.READ), + new ExclusiveResource("b2", LockMode.READ_WRITE) + ); + + var nestedClassResources = getNestedClassResources( + SharedResourcesViaAnnotationValueTestCase.class, + SharedResourcesViaAnnotationValueTestCase.NestedClass.class + ); + assertThat(nestedClassResources).containsExactlyInAnyOrder( + new ExclusiveResource("c1", LockMode.READ), + new ExclusiveResource("c2", LockMode.READ) + ); + // @formatter:on + } + + @Test + void addSharedResourcesViaAnnotationProviders() { + // @formatter:off + var classResources = getClassResources( + SharedResourcesViaAnnotationProvidersTestCase.class + ); + assertThat(classResources).containsExactlyInAnyOrder( + new ExclusiveResource("a1", LockMode.READ), + new ExclusiveResource("a2", LockMode.READ) + ); + + var methodResources = getMethodResources( + SharedResourcesViaAnnotationProvidersTestCase.class + ); + assertThat(methodResources).containsExactlyInAnyOrder( + new ExclusiveResource("b1", LockMode.READ_WRITE), + new ExclusiveResource("b2", LockMode.READ_WRITE) + ); + + var nestedClassResources = getNestedClassResources( + SharedResourcesViaAnnotationProvidersTestCase.class, + SharedResourcesViaAnnotationProvidersTestCase.NestedClass.class + ); + assertThat(nestedClassResources).containsExactlyInAnyOrder( + new ExclusiveResource("c1", LockMode.READ_WRITE), + new ExclusiveResource("c2", LockMode.READ) + ); + // @formatter:on + } + + @Test + void addSharedResourcesViaAnnotationValueAndProviders() { + // @formatter:off + var classResources = getClassResources( + SharedResourcesViaAnnotationValueAndProvidersTestCase.class + ); + assertThat(classResources).containsExactlyInAnyOrder( + new ExclusiveResource("a1", LockMode.READ_WRITE), + new ExclusiveResource("a2", LockMode.READ) + ); + + var methodResources = getMethodResources( + SharedResourcesViaAnnotationValueAndProvidersTestCase.class + ); + assertThat(methodResources).containsExactlyInAnyOrder( + new ExclusiveResource("b1", LockMode.READ), + new ExclusiveResource("b2", LockMode.READ) + ); + + var nestedClassResources = getNestedClassResources( + SharedResourcesViaAnnotationValueAndProvidersTestCase.class, + SharedResourcesViaAnnotationValueAndProvidersTestCase.NestedClass.class + ); + assertThat(nestedClassResources).containsExactlyInAnyOrder( + new ExclusiveResource("c1", LockMode.READ_WRITE), + new ExclusiveResource("c2", LockMode.READ_WRITE), + new ExclusiveResource("c3", LockMode.READ_WRITE) + ); + // @formatter:on + } + + @Test + void emptyAnnotation() { + // @formatter:off + var classResources = getClassResources( + EmptyAnnotationTestCase.class + ); + assertThat(classResources).isEmpty(); + + var methodResources = getMethodResources( + EmptyAnnotationTestCase.class + ); + assertThat(methodResources).isEmpty(); + + var nestedClassResources = getNestedClassResources( + EmptyAnnotationTestCase.class, + EmptyAnnotationTestCase.NestedClass.class + ); + assertThat(nestedClassResources).isEmpty(); + // @formatter:on + } + + private Set getClassResources(Class testClass) { + return getClassTestDescriptor(testClass).getExclusiveResources(); + } + + private ClassTestDescriptor getClassTestDescriptor(Class testClass) { + return new ClassTestDescriptor(uniqueId, testClass, configuration); + } + + private Set getMethodResources(Class testClass) { + try { + // @formatter:off + var descriptor = new TestMethodTestDescriptor( + uniqueId, testClass, testClass.getDeclaredMethod("test"), configuration + ); + // @formatter:on + descriptor.setParent(getClassTestDescriptor(testClass)); + return descriptor.getExclusiveResources(); + } + catch (NoSuchMethodException e) { + throw new RuntimeException(e); + } + } + + private Set getNestedClassResources(Class testClass, Class nestedClass) { + var descriptor = new NestedClassTestDescriptor(uniqueId, nestedClass, configuration); + descriptor.setParent(getClassTestDescriptor(testClass)); + return descriptor.getExclusiveResources(); + } + + // ------------------------------------------------------------------------- + + static class NoSharedResourcesTestCase { + + @Test + void test() { + } + + @Nested + class NestedClass { + } + } + + @ResourceLock("a1") + @ResourceLock(value = "a2", mode = ResourceAccessMode.READ_WRITE) + static class SharedResourcesViaAnnotationValueTestCase { + + @Test + @ResourceLock(value = "b1", mode = ResourceAccessMode.READ) + @ResourceLock("b2") + void test() { + } + + @Nested + @ResourceLock(value = "c1", mode = ResourceAccessMode.READ) + @ResourceLock(value = "c2", mode = ResourceAccessMode.READ) + class NestedClass { + } + } + + @ResourceLock(providers = { // + SharedResourcesViaAnnotationProvidersTestCase.FirstClassLevelProvider.class, // + SharedResourcesViaAnnotationProvidersTestCase.SecondClassLevelProvider.class // + }) + static class SharedResourcesViaAnnotationProvidersTestCase { + + @Test + @ResourceLock(providers = MethodLevelProvider.class) + void test() { + } + + @Nested + @ResourceLock(providers = NestedClassLevelProvider.class) + class NestedClass { + } + + static class FirstClassLevelProvider implements ResourceLocksProvider { + + @Override + public Set provideForClass(Class testClass) { + return Set.of(new Lock("a1", ResourceAccessMode.READ)); + } + } + + static class SecondClassLevelProvider implements ResourceLocksProvider { + + @Override + public Set provideForClass(Class testClass) { + return Set.of(new Lock("a2", ResourceAccessMode.READ)); + } + + @Override + public Set provideForMethod(Class testClass, Method testMethod) { + return Set.of(new Lock("b1")); + } + } + + static class MethodLevelProvider implements ResourceLocksProvider { + + @Override + public Set provideForMethod(Class testClass, Method testMethod) { + return Set.of(new Lock("b2")); + } + } + + static class NestedClassLevelProvider implements ResourceLocksProvider { + + @Override + public Set provideForNestedClass(Class testClass) { + return Set.of(new Lock("c1"), new Lock("c2", ResourceAccessMode.READ)); + } + } + } + + @ResourceLock( // + value = "a1", // + mode = ResourceAccessMode.READ_WRITE, // + providers = SharedResourcesViaAnnotationValueAndProvidersTestCase.ClassLevelProvider.class // + ) + static class SharedResourcesViaAnnotationValueAndProvidersTestCase { + + @Test + @ResourceLock(value = "b1", mode = ResourceAccessMode.READ) + void test() { + } + + @Nested + @ResourceLock("c1") + @ResourceLock(providers = NestedClassLevelProvider.class) + class NestedClass { + } + + static class ClassLevelProvider implements ResourceLocksProvider { + + @Override + public Set provideForClass(Class testClass) { + return Set.of(new Lock("a2", ResourceAccessMode.READ)); + } + + @Override + public Set provideForMethod(Class testClass, Method testMethod) { + return Set.of(new Lock("b2", ResourceAccessMode.READ)); + } + + @Override + public Set provideForNestedClass(Class testClass) { + return Set.of(new Lock("c2")); + } + } + + static class NestedClassLevelProvider implements ResourceLocksProvider { + + @Override + public Set provideForNestedClass(Class testClass) { + return Set.of(new Lock("c3")); + } + } + } + + @ResourceLock + static class EmptyAnnotationTestCase { + + @Test + @ResourceLock + void test() { + } + + @Nested + @ResourceLock + class NestedClass { + } + } + + static class NestedNestedTestCase { + + @Nested + @ResourceLock(providers = NestedNestedTestCase.Provider.class) + static class NestedClass { + + @Nested + class NestedClassTwo { + + @Test + void test() { + } + } + } + + static class Provider implements ResourceLocksProvider { + @Override + public Set provideForClass(Class testClass) { + return ResourceLocksProvider.super.provideForClass(testClass); + } + + @Override + public Set provideForNestedClass(Class testClass) { + return ResourceLocksProvider.super.provideForNestedClass(testClass); + } + + @Override + public Set provideForMethod(Class testClass, Method testMethod) { + return ResourceLocksProvider.super.provideForMethod(testClass, testMethod); + } + } + } + +} diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLocksProviderTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLocksProviderTests.java new file mode 100644 index 000000000000..f9b350ccbc6b --- /dev/null +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLocksProviderTests.java @@ -0,0 +1,298 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.engine.support.descriptor; + +import static java.util.Collections.emptySet; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; +import static org.junit.platform.testkit.engine.EventConditions.event; +import static org.junit.platform.testkit.engine.EventConditions.finishedSuccessfully; +import static org.junit.platform.testkit.engine.EventConditions.test; + +import java.lang.reflect.Method; +import java.util.Set; +import java.util.stream.Stream; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.parallel.ResourceLock; +import org.junit.jupiter.api.parallel.ResourceLocksProvider; +import org.junit.platform.engine.discovery.DiscoverySelectors; +import org.junit.platform.testkit.engine.EngineTestKit; +import org.junit.platform.testkit.engine.Event; + +/** + * Integration tests for {@link ResourceLocksProvider}. + * + * @since 5.12 + */ +class ResourceLocksProviderTests { + + @Test + void classLevelProvider() { + var events = execute(ClassLevelProviderTestCase.class); + assertThat(events.filter(event(test(), finishedSuccessfully())::matches)).hasSize(2); + } + + @Test + void nestedClassLevelProvider() { + var events = execute(NestedClassLevelProviderTestCase.class); + assertThat(events.filter(event(test(), finishedSuccessfully())::matches)).hasSize(2); + } + + @Test + void methodLevelProvider() { + var events = execute(MethodLevelProviderTestCase.class); + assertThat(events.filter(event(test(), finishedSuccessfully())::matches)).hasSize(2); + } + + @Test + void methodLevelProviderInNestedClass() { + var events = execute(MethodLevelProviderInNestedClassTestCase.class); + assertThat(events.filter(event(test(), finishedSuccessfully())::matches)).hasSize(2); + } + + private Stream execute(Class testCase) { + // @formatter:off + var discoveryRequest = request() + .selectors(Stream.of(testCase).map(DiscoverySelectors::selectClass).toList()) + .build(); + return EngineTestKit.execute("junit-jupiter", discoveryRequest) + .allEvents() + .stream(); + // @formatter:on + } + + // ------------------------------------------------------------------------- + + @ResourceLock(providers = ClassLevelProviderTestCase.Provider.class) + static class ClassLevelProviderTestCase { + + @Test + void test() { + assertTrue(Provider.isProvideForClassCalled, "'provideForClass' was not called"); + assertTrue(Provider.isProvideForTestMethodCalled, "'provideForMethod(test)' was not called"); + } + + @Nested + class NestedClass { + + @Test + void nestedTest() { + assertTrue(Provider.isProvideForNestedClassCalled, "'provideForNestedClass' was not called"); + // @formatter:off + assertTrue( + Provider.isProvideForNestedTestMethodCalled, + "'provideForMethod(nestedTest)' was not called" + ); + // @formatter:on + } + } + + @AfterAll + static void afterAll() { + Provider.isProvideForClassCalled = false; + Provider.isProvideForTestMethodCalled = false; + + Provider.isProvideForNestedClassCalled = false; + Provider.isProvideForNestedTestMethodCalled = false; + } + + static class Provider implements ResourceLocksProvider { + + private static boolean isProvideForClassCalled = false; + private static boolean isProvideForTestMethodCalled = false; + + private static boolean isProvideForNestedClassCalled = false; + private static boolean isProvideForNestedTestMethodCalled = false; + + @Override + public Set provideForClass(Class testClass) { + isProvideForClassCalled = true; + assertEquals(ClassLevelProviderTestCase.class, testClass); + return emptySet(); + } + + @Override + public Set provideForNestedClass(Class testClass) { + isProvideForNestedClassCalled = true; + assertEquals(ClassLevelProviderTestCase.NestedClass.class, testClass); + return emptySet(); + } + + @Override + public Set provideForMethod(Class testClass, Method testMethod) { + if (testClass == ClassLevelProviderTestCase.class) { + assertEquals("test", testMethod.getName()); + isProvideForTestMethodCalled = true; + return emptySet(); + } + if (testClass == ClassLevelProviderTestCase.NestedClass.class) { + assertEquals("nestedTest", testMethod.getName()); + isProvideForNestedTestMethodCalled = true; + return emptySet(); + } + fail("Unexpected test class: " + testClass); + return emptySet(); + } + } + } + + static class NestedClassLevelProviderTestCase { + + @Test + void test() { + } + + @Nested + @ResourceLock(providers = NestedClassLevelProviderTestCase.Provider.class) + class NestedClass { + + @Test + void nestedTest() { + assertTrue(Provider.isProvideForNestedClassCalled, "'provideForNestedClass' was not called"); + assertTrue(Provider.isProvideForMethodCalled, "'provideForMethod' was not called"); + } + } + + @AfterAll + static void afterAll() { + Provider.isProvideForNestedClassCalled = false; + Provider.isProvideForMethodCalled = false; + } + + static class Provider implements ResourceLocksProvider { + + private static boolean isProvideForNestedClassCalled = false; + + private static boolean isProvideForMethodCalled = false; + + @Override + public Set provideForClass(Class testClass) { + fail("'provideForClass' should not be called"); + return emptySet(); + } + + @Override + public Set provideForNestedClass(Class testClass) { + isProvideForNestedClassCalled = true; + assertEquals(NestedClass.class, testClass); + return emptySet(); + } + + @Override + public Set provideForMethod(Class testClass, Method testMethod) { + isProvideForMethodCalled = true; + assertEquals(NestedClassLevelProviderTestCase.NestedClass.class, testClass); + assertEquals("nestedTest", testMethod.getName()); + return emptySet(); + } + } + } + + static class MethodLevelProviderTestCase { + + @Test + @ResourceLock(providers = MethodLevelProviderTestCase.Provider.class) + void test() { + assertTrue(Provider.isProvideForMethodCalled, "'provideForMethod' was not called"); + } + + @Nested + class NestedClass { + + @Test + void nestedTest() { + } + } + + @AfterAll + static void afterAll() { + Provider.isProvideForMethodCalled = false; + } + + static class Provider implements ResourceLocksProvider { + + private static boolean isProvideForMethodCalled = false; + + @Override + public Set provideForClass(Class testClass) { + fail("'provideForClass' should not be called"); + return emptySet(); + } + + @Override + public Set provideForNestedClass(Class testClass) { + fail("'provideForNestedClass' should not be called"); + return emptySet(); + } + + @Override + public Set provideForMethod(Class testClass, Method testMethod) { + isProvideForMethodCalled = true; + assertEquals(MethodLevelProviderTestCase.class, testClass); + assertEquals("test", testMethod.getName()); + return emptySet(); + } + } + } + + static class MethodLevelProviderInNestedClassTestCase { + + @Test + void test() { + } + + @Nested + class NestedClass { + + @Test + @ResourceLock(providers = MethodLevelProviderInNestedClassTestCase.Provider.class) + void nestedTest() { + assertTrue(Provider.isProvideForMethodCalled, "'provideForMethod' was not called"); + } + } + + @AfterAll + static void afterAll() { + Provider.isProvideForMethodCalled = false; + } + + static class Provider implements ResourceLocksProvider { + + private static boolean isProvideForMethodCalled = false; + + @Override + public Set provideForClass(Class testClass) { + fail("'provideForClass' should not be called"); + return emptySet(); + } + + @Override + public Set provideForNestedClass(Class testClass) { + fail("'provideForNestedClass' should not be called"); + return emptySet(); + } + + @Override + public Set provideForMethod(Class testClass, Method testMethod) { + isProvideForMethodCalled = true; + assertEquals(MethodLevelProviderInNestedClassTestCase.NestedClass.class, testClass); + assertEquals("nestedTest", testMethod.getName()); + return emptySet(); + } + } + } +} From dceac6e2e09d7478b911637a4fd9849f9515a9ed Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 8 Oct 2024 09:40:31 +0200 Subject: [PATCH 143/611] Avoid multiple class-level annotation lookups (#4053) Instead of looking up annotations on the declaring and all enclosing classes for each test method, each `ResourceLockAware` test descriptor now delegates to the `ExclusiveResourceCollector` of its ancestors which cache the class-level annotations and `ResourceLocksProvider` instances. Resolves #2677. --- .../descriptor/ClassBasedTestDescriptor.java | 16 ++- .../descriptor/ClassTestDescriptor.java | 13 ++ .../ExclusiveResourceCollector.java | 119 ++++++++++++++++++ .../descriptor/JupiterTestDescriptor.java | 79 +----------- .../descriptor/MethodBasedTestDescriptor.java | 19 +-- .../descriptor/NestedClassTestDescriptor.java | 26 ++-- .../engine/descriptor/ResourceLockAware.java | 55 ++++++++ .../ResourceLocksProviderTests.java | 4 + 8 files changed, 232 insertions(+), 99 deletions(-) create mode 100644 junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExclusiveResourceCollector.java create mode 100644 junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ResourceLockAware.java diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java index ddfbe7ef3a38..6b3b524e6f55 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java @@ -74,7 +74,6 @@ import org.junit.platform.engine.TestTag; import org.junit.platform.engine.UniqueId; import org.junit.platform.engine.support.descriptor.ClassSource; -import org.junit.platform.engine.support.hierarchical.ExclusiveResource; import org.junit.platform.engine.support.hierarchical.ThrowableCollector; /** @@ -83,13 +82,14 @@ * @since 5.5 */ @API(status = INTERNAL, since = "5.5") -public abstract class ClassBasedTestDescriptor extends JupiterTestDescriptor { +public abstract class ClassBasedTestDescriptor extends JupiterTestDescriptor implements ResourceLockAware { private static final InterceptingExecutableInvoker executableInvoker = new InterceptingExecutableInvoker(); private final Class testClass; protected final Set tags; protected final Lifecycle lifecycle; + private final ExclusiveResourceCollector exclusiveResourceCollector; private ExecutionMode defaultChildExecutionMode; private TestInstanceFactory testInstanceFactory; @@ -104,6 +104,7 @@ public abstract class ClassBasedTestDescriptor extends JupiterTestDescriptor { this.tags = getTags(testClass); this.lifecycle = getTestInstanceLifecycle(testClass, configuration); this.defaultChildExecutionMode = (this.lifecycle == Lifecycle.PER_CLASS ? ExecutionMode.SAME_THREAD : null); + this.exclusiveResourceCollector = ExclusiveResourceCollector.from(testClass); } // --- TestDescriptor ------------------------------------------------------ @@ -112,6 +113,8 @@ public final Class getTestClass() { return this.testClass; } + public abstract List> getEnclosingTestClasses(); + @Override public Type getType() { return Type.CONTAINER; @@ -139,13 +142,8 @@ public void setDefaultChildExecutionMode(ExecutionMode defaultChildExecutionMode } @Override - public Set getExclusiveResources() { - // @formatter:off - return getExclusiveResourcesFromAnnotations( - getTestClass(), - provider -> provider.provideForClass(getTestClass()) - ); - // @formatter:on + public final ExclusiveResourceCollector getExclusiveResourceCollector() { + return exclusiveResourceCollector; } @Override diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassTestDescriptor.java index a7c3034a8f60..e644518fb57b 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassTestDescriptor.java @@ -10,16 +10,19 @@ package org.junit.jupiter.engine.descriptor; +import static java.util.Collections.emptyList; import static org.apiguardian.api.API.Status.INTERNAL; import static org.junit.jupiter.engine.descriptor.DisplayNameUtils.createDisplayNameSupplierForClass; import java.util.LinkedHashSet; +import java.util.List; import java.util.Optional; import java.util.Set; import org.apiguardian.api.API; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.TestInstances; +import org.junit.jupiter.api.parallel.ResourceLocksProvider; import org.junit.jupiter.engine.config.JupiterConfiguration; import org.junit.jupiter.engine.execution.JupiterEngineExecutionContext; import org.junit.jupiter.engine.extension.ExtensionRegistrar; @@ -57,6 +60,11 @@ public Set getTags() { return new LinkedHashSet<>(this.tags); } + @Override + public List> getEnclosingTestClasses() { + return emptyList(); + } + // --- Node ---------------------------------------------------------------- @Override @@ -72,4 +80,9 @@ protected TestInstances instantiateTestClass(JupiterEngineExecutionContext paren return instantiateTestClass(Optional.empty(), registry, extensionContext); } + @Override + public Set evaluateResourceLocksProvider(ResourceLocksProvider provider) { + return provider.provideForClass(getTestClass()); + } + } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExclusiveResourceCollector.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExclusiveResourceCollector.java new file mode 100644 index 000000000000..42b1295b2221 --- /dev/null +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExclusiveResourceCollector.java @@ -0,0 +1,119 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.engine.descriptor; + +import static org.junit.platform.commons.support.AnnotationSupport.findRepeatableAnnotations; +import static org.junit.platform.commons.util.CollectionUtils.toUnmodifiableList; + +import java.lang.reflect.AnnotatedElement; +import java.util.Collection; +import java.util.List; +import java.util.Set; +import java.util.function.Function; +import java.util.stream.Stream; + +import org.junit.jupiter.api.parallel.ResourceAccessMode; +import org.junit.jupiter.api.parallel.ResourceLock; +import org.junit.jupiter.api.parallel.ResourceLocksProvider; +import org.junit.platform.commons.JUnitException; +import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.commons.util.StringUtils; +import org.junit.platform.engine.support.hierarchical.ExclusiveResource; + +/** + * @since 5.12 + */ +abstract class ExclusiveResourceCollector { + + private static final ExclusiveResourceCollector NO_EXCLUSIVE_RESOURCES = new ExclusiveResourceCollector() { + + @Override + Stream getAllExclusiveResources( + Function> providerToLocks) { + return Stream.empty(); + } + + @Override + public Stream getStaticResources() { + return Stream.empty(); + } + + @Override + Stream getDynamicResources( + Function> providerToLocks) { + return Stream.empty(); + } + }; + + Stream getAllExclusiveResources( + Function> providerToLocks) { + return Stream.concat(getStaticResources(), getDynamicResources(providerToLocks)); + } + + abstract Stream getStaticResources(); + + abstract Stream getDynamicResources( + Function> providerToLocks); + + static ExclusiveResourceCollector from(AnnotatedElement element) { + List annotations = findRepeatableAnnotations(element, ResourceLock.class); + return annotations.isEmpty() ? NO_EXCLUSIVE_RESOURCES : new DefaultExclusiveResourceCollector(annotations); + } + + private static class DefaultExclusiveResourceCollector extends ExclusiveResourceCollector { + + private final List annotations; + private List providers; + + DefaultExclusiveResourceCollector(List annotations) { + this.annotations = annotations; + } + + @Override + public Stream getStaticResources() { + return annotations.stream() // + .filter(annotation -> StringUtils.isNotBlank(annotation.value())) // + .map(annotation -> new ExclusiveResource(annotation.value(), toLockMode(annotation.mode()))); + } + + @Override + Stream getDynamicResources( + Function> providerToLocks) { + List providers = getProviders(); + if (providers.isEmpty()) { + return Stream.empty(); + } + return providers.stream() // + .map(providerToLocks) // + .flatMap(Collection::stream) // + .map(lock -> new ExclusiveResource(lock.getKey(), toLockMode(lock.getAccessMode()))); + } + + private List getProviders() { + if (this.providers == null) { + this.providers = annotations.stream() // + .flatMap(annotation -> Stream.of(annotation.providers()).map(ReflectionUtils::newInstance)) // + .collect(toUnmodifiableList()); + } + return providers; + } + + private static ExclusiveResource.LockMode toLockMode(ResourceAccessMode mode) { + switch (mode) { + case READ: + return ExclusiveResource.LockMode.READ; + case READ_WRITE: + return ExclusiveResource.LockMode.READ_WRITE; + } + throw new JUnitException("Unknown ResourceAccessMode: " + mode); + } + } +} diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.java index 54673dcb91d5..86fecaf73ddd 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.java @@ -10,10 +10,9 @@ package org.junit.jupiter.engine.descriptor; -import static java.util.Collections.emptyList; +import static java.util.Collections.emptySet; import static java.util.stream.Collectors.collectingAndThen; import static java.util.stream.Collectors.toCollection; -import static java.util.stream.Collectors.toList; import static java.util.stream.Collectors.toSet; import static org.apiguardian.api.API.Status.INTERNAL; import static org.junit.jupiter.engine.descriptor.DisplayNameUtils.determineDisplayName; @@ -21,25 +20,18 @@ import static org.junit.platform.commons.support.AnnotationSupport.findRepeatableAnnotations; import java.lang.reflect.AnnotatedElement; -import java.util.ArrayList; -import java.util.Collection; import java.util.Collections; import java.util.LinkedHashSet; import java.util.List; import java.util.Optional; import java.util.Set; -import java.util.function.Function; import java.util.function.Supplier; -import java.util.stream.Stream; import org.apiguardian.api.API; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.extension.ConditionEvaluationResult; import org.junit.jupiter.api.extension.Extension; import org.junit.jupiter.api.parallel.Execution; -import org.junit.jupiter.api.parallel.ResourceAccessMode; -import org.junit.jupiter.api.parallel.ResourceLock; -import org.junit.jupiter.api.parallel.ResourceLocksProvider; import org.junit.jupiter.engine.config.JupiterConfiguration; import org.junit.jupiter.engine.execution.ConditionEvaluator; import org.junit.jupiter.engine.execution.JupiterEngineExecutionContext; @@ -48,8 +40,6 @@ import org.junit.platform.commons.logging.Logger; import org.junit.platform.commons.logging.LoggerFactory; import org.junit.platform.commons.util.ExceptionUtils; -import org.junit.platform.commons.util.ReflectionUtils; -import org.junit.platform.commons.util.StringUtils; import org.junit.platform.commons.util.UnrecoverableExceptions; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.TestSource; @@ -57,7 +47,6 @@ import org.junit.platform.engine.UniqueId; import org.junit.platform.engine.support.descriptor.AbstractTestDescriptor; import org.junit.platform.engine.support.hierarchical.ExclusiveResource; -import org.junit.platform.engine.support.hierarchical.ExclusiveResource.LockMode; import org.junit.platform.engine.support.hierarchical.Node; /** @@ -109,17 +98,6 @@ static Set getTags(AnnotatedElement element) { // @formatter:on } - public List> getEnclosingTestClasses() { - TestDescriptor parent = getParent().orElse(null); - if (parent instanceof ClassBasedTestDescriptor) { - ClassBasedTestDescriptor parentClassDescriptor = (ClassBasedTestDescriptor) parent; - List> result = new ArrayList<>(parentClassDescriptor.getEnclosingTestClasses()); - result.add(parentClassDescriptor.getTestClass()); - return result; - } - return emptyList(); - } - /** * Invoke exception handlers for the supplied {@code Throwable} one-by-one * until none are left or the throwable to handle has been swallowed. @@ -200,57 +178,12 @@ public static ExecutionMode toExecutionMode(org.junit.jupiter.api.parallel.Execu throw new JUnitException("Unknown ExecutionMode: " + mode); } - Set getExclusiveResourcesFromAnnotations(AnnotatedElement element, - Function> providerToLocks) { - // @formatter:off - List ownAnnotations = findRepeatableAnnotations(element, ResourceLock.class); - List enclosingClassesAnnotations = getEnclosingTestClasses().stream() - .map(clazz -> findRepeatableAnnotations(clazz, ResourceLock.class)) - .flatMap(Collection::stream) - .collect(toList()); - - return Stream.of( - getExclusiveResourcesFromValues(ownAnnotations), - getExclusiveResourcesFromProviders(ownAnnotations, providerToLocks), - getExclusiveResourcesFromProviders(enclosingClassesAnnotations, providerToLocks) - ).flatMap(s -> s) - .collect(toSet()); - // @formatter:on - } - - private Stream getExclusiveResourcesFromValues(List annotations) { - // @formatter:off - return annotations.stream() - .flatMap(annotation -> { - if (StringUtils.isBlank(annotation.value())) { - return Stream.empty(); - } - return Stream.of(new ExclusiveResource(annotation.value(), toLockMode(annotation.mode()))); - }); - // @formatter:on - } - - private Stream getExclusiveResourcesFromProviders(List annotations, - Function> providerToLocks) { - // @formatter:off - return annotations.stream() - .flatMap(annotation -> Stream.of(annotation.providers()) - .map(ReflectionUtils::newInstance) - .map(providerToLocks) - .flatMap(Collection::stream) - .map(lock -> new ExclusiveResource(lock.getKey(), toLockMode(lock.getAccessMode()))) - ); - // @formatter:on - } - - private static LockMode toLockMode(ResourceAccessMode mode) { - switch (mode) { - case READ: - return LockMode.READ; - case READ_WRITE: - return LockMode.READ_WRITE; + @Override + public Set getExclusiveResources() { + if (this instanceof ResourceLockAware) { + return ((ResourceLockAware) this).determineExclusiveResources().collect(toSet()); } - throw new JUnitException("Unknown ResourceAccessMode: " + mode); + return emptySet(); } @Override diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodBasedTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodBasedTestDescriptor.java index 6a21a3ae6660..9c8e4bcb1ce3 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodBasedTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodBasedTestDescriptor.java @@ -24,6 +24,7 @@ import org.apiguardian.api.API; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.TestWatcher; +import org.junit.jupiter.api.parallel.ResourceLocksProvider; import org.junit.jupiter.engine.config.JupiterConfiguration; import org.junit.jupiter.engine.execution.JupiterEngineExecutionContext; import org.junit.platform.commons.logging.Logger; @@ -36,7 +37,6 @@ import org.junit.platform.engine.TestTag; import org.junit.platform.engine.UniqueId; import org.junit.platform.engine.support.descriptor.MethodSource; -import org.junit.platform.engine.support.hierarchical.ExclusiveResource; /** * Base class for {@link TestDescriptor TestDescriptors} based on Java methods. @@ -44,7 +44,7 @@ * @since 5.0 */ @API(status = INTERNAL, since = "5.0") -public abstract class MethodBasedTestDescriptor extends JupiterTestDescriptor { +public abstract class MethodBasedTestDescriptor extends JupiterTestDescriptor implements ResourceLockAware { private static final Logger logger = LoggerFactory.getLogger(MethodBasedTestDescriptor.class); @@ -80,13 +80,14 @@ public final Set getTags() { } @Override - public Set getExclusiveResources() { - // @formatter:off - return getExclusiveResourcesFromAnnotations( - getTestMethod(), - provider -> provider.provideForMethod(getTestClass(), getTestMethod()) - ); - // @formatter:on + public ExclusiveResourceCollector getExclusiveResourceCollector() { + // There's no need to cache this as this method should only be called once + return ExclusiveResourceCollector.from(getTestMethod()); + } + + @Override + public Set evaluateResourceLocksProvider(ResourceLocksProvider provider) { + return provider.provideForMethod(getTestClass(), getTestMethod()); } @Override diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/NestedClassTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/NestedClassTestDescriptor.java index 7732a85854f8..0c1f697b2686 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/NestedClassTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/NestedClassTestDescriptor.java @@ -10,16 +10,20 @@ package org.junit.jupiter.engine.descriptor; +import static java.util.Collections.emptyList; import static org.apiguardian.api.API.Status.INTERNAL; import static org.junit.jupiter.engine.descriptor.DisplayNameUtils.createDisplayNameSupplierForNestedClass; +import java.util.ArrayList; import java.util.LinkedHashSet; +import java.util.List; import java.util.Optional; import java.util.Set; import org.apiguardian.api.API; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.TestInstances; +import org.junit.jupiter.api.parallel.ResourceLocksProvider; import org.junit.jupiter.engine.config.JupiterConfiguration; import org.junit.jupiter.engine.execution.JupiterEngineExecutionContext; import org.junit.jupiter.engine.extension.ExtensionRegistrar; @@ -27,7 +31,6 @@ import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.TestTag; import org.junit.platform.engine.UniqueId; -import org.junit.platform.engine.support.hierarchical.ExclusiveResource; import org.junit.platform.engine.support.hierarchical.ThrowableCollector; /** @@ -59,6 +62,18 @@ public final Set getTags() { return allTags; } + @Override + public List> getEnclosingTestClasses() { + TestDescriptor parent = getParent().orElse(null); + if (parent instanceof ClassBasedTestDescriptor) { + ClassBasedTestDescriptor parentClassDescriptor = (ClassBasedTestDescriptor) parent; + List> result = new ArrayList<>(parentClassDescriptor.getEnclosingTestClasses()); + result.add(parentClassDescriptor.getTestClass()); + return result; + } + return emptyList(); + } + // --- Node ---------------------------------------------------------------- @Override @@ -74,13 +89,8 @@ protected TestInstances instantiateTestClass(JupiterEngineExecutionContext paren } @Override - public Set getExclusiveResources() { - // @formatter:off - return getExclusiveResourcesFromAnnotations( - getTestClass(), - provider -> provider.provideForNestedClass(getTestClass()) - ); - // @formatter:on + public Set evaluateResourceLocksProvider(ResourceLocksProvider provider) { + return provider.provideForNestedClass(getTestClass()); } } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ResourceLockAware.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ResourceLockAware.java new file mode 100644 index 000000000000..858644d48520 --- /dev/null +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ResourceLockAware.java @@ -0,0 +1,55 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.engine.descriptor; + +import java.util.ArrayDeque; +import java.util.Deque; +import java.util.Set; +import java.util.stream.Stream; + +import org.junit.jupiter.api.parallel.ResourceLocksProvider; +import org.junit.platform.engine.TestDescriptor; +import org.junit.platform.engine.support.hierarchical.ExclusiveResource; + +/** + * @since 5.12 + */ +interface ResourceLockAware extends TestDescriptor { + + default Stream determineExclusiveResources() { + + Deque ancestors = new ArrayDeque<>(); + TestDescriptor parent = this.getParent().orElse(null); + while (parent instanceof ResourceLockAware) { + ancestors.addFirst((ResourceLockAware) parent); + parent = parent.getParent().orElse(null); + } + + if (ancestors.isEmpty()) { + return determineOwnExclusiveResources(); + } + + Stream ancestorDynamicResources = ancestors.stream() // + .map(ResourceLockAware::getExclusiveResourceCollector) // + .flatMap(collector -> collector.getDynamicResources(this::evaluateResourceLocksProvider)); + + return Stream.concat(ancestorDynamicResources, determineOwnExclusiveResources()); + } + + default Stream determineOwnExclusiveResources() { + return this.getExclusiveResourceCollector().getAllExclusiveResources(this::evaluateResourceLocksProvider); + } + + ExclusiveResourceCollector getExclusiveResourceCollector(); + + Set evaluateResourceLocksProvider(ResourceLocksProvider provider); + +} diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLocksProviderTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLocksProviderTests.java index f9b350ccbc6b..3b60bc75569a 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLocksProviderTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLocksProviderTests.java @@ -77,6 +77,7 @@ private Stream execute(Class testCase) { // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @ResourceLock(providers = ClassLevelProviderTestCase.Provider.class) static class ClassLevelProviderTestCase { @@ -150,6 +151,7 @@ public Set provideForMethod(Class testClass, Method testMethod) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class NestedClassLevelProviderTestCase { @Test @@ -202,6 +204,7 @@ public Set provideForMethod(Class testClass, Method testMethod) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class MethodLevelProviderTestCase { @Test @@ -249,6 +252,7 @@ public Set provideForMethod(Class testClass, Method testMethod) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class MethodLevelProviderInNestedClassTestCase { @Test From 0f27653da83668e1504a047e127dc2c3c20ef7c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Michael?= Date: Tue, 8 Oct 2024 10:42:54 +0200 Subject: [PATCH 144/611] Support `void` and `Void` class lookups in `ReflectionUtils` (#4049) Both the primitive type `void` and the wrapper type `Void` are now supported in the internal `ReflectionUtils` to allow `String` to `Class` conversion in parameterized tests. Fixes #4048. --------- Co-authored-by: Marc Philipp --- .../docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc | 2 ++ .../org/junit/platform/commons/util/ReflectionUtils.java | 5 ++++- .../params/converter/DefaultArgumentConverterTests.java | 4 +++- .../junit/platform/commons/util/ReflectionUtilsTests.java | 3 +++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 504d94de8d48..fe7125ac15c3 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -29,6 +29,8 @@ JUnit repository on GitHub. * Introduce `ReflectionSupport.makeAccessible(Field)` for third-party use rather than calling the internal `ReflectionUtils.makeAccessible(Field)` method directly. +* Support both the primitive type `void` and the wrapper type `Void` in the internal + `ReflectionUtils` to support `String` to `Class` conversion in parameterized tests. [[release-notes-5.12.0-M1-junit-jupiter]] diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java index dd18b8d13cd6..26bd8e1698cf 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java @@ -186,6 +186,7 @@ public enum HierarchyTraversalMode { long.class, float.class, double.class, + void.class, boolean[].class, byte[].class, @@ -213,6 +214,7 @@ public enum HierarchyTraversalMode { Long.class, Float.class, Double.class, + Void.class, String.class, Boolean[].class, @@ -246,7 +248,7 @@ public enum HierarchyTraversalMode { classNameToTypeMap = Collections.unmodifiableMap(classNamesToTypes); - Map, Class> primitivesToWrappers = new IdentityHashMap<>(8); + Map, Class> primitivesToWrappers = new IdentityHashMap<>(9); primitivesToWrappers.put(boolean.class, Boolean.class); primitivesToWrappers.put(byte.class, Byte.class); @@ -256,6 +258,7 @@ public enum HierarchyTraversalMode { primitivesToWrappers.put(long.class, Long.class); primitivesToWrappers.put(float.class, Float.class); primitivesToWrappers.put(double.class, Double.class); + primitivesToWrappers.put(void.class, Void.class); primitiveToWrapperMap = Collections.unmodifiableMap(primitivesToWrappers); } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/DefaultArgumentConverterTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/DefaultArgumentConverterTests.java index 1c03dc3bed90..3dfe8c44dd89 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/DefaultArgumentConverterTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/DefaultArgumentConverterTests.java @@ -132,7 +132,7 @@ void convertsStringsToPrimitiveWrapperTypes() { @ParameterizedTest(name = "[{index}] {0}") @ValueSource(classes = { char.class, boolean.class, short.class, byte.class, int.class, long.class, float.class, - double.class }) + double.class, void.class }) void throwsExceptionForNullToPrimitiveTypeConversion(Class type) { assertThatExceptionOfType(ArgumentConversionException.class) // .isThrownBy(() -> convert(null, type)) // @@ -261,8 +261,10 @@ void convertsStringToPath() { @Test void convertsStringToClass() { assertConverts("java.lang.Integer", Class.class, Integer.class); + assertConverts("java.lang.Void", Class.class, Void.class); assertConverts("java.lang.Thread$State", Class.class, State.class); assertConverts("byte", Class.class, byte.class); + assertConverts("void", Class.class, void.class); assertConverts("char[]", Class.class, char[].class); assertConverts("java.lang.Long[][]", Class.class, Long[][].class); assertConverts("[[[I", Class.class, int[][][].class); diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java index 394c7f73aaa9..843b07a85ab1 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java @@ -559,6 +559,7 @@ void isAssignableTo() { // Wrappers to Primitives assertTrue(ReflectionUtils.isAssignableTo(Integer.class, int.class)); assertTrue(ReflectionUtils.isAssignableTo(Boolean.class, boolean.class)); + assertTrue(ReflectionUtils.isAssignableTo(Void.class, void.class)); // Widening Conversions from Wrappers to Primitives assertTrue(ReflectionUtils.isAssignableTo(Integer.class, long.class)); @@ -759,6 +760,7 @@ void loadClass() { @Test void tryToLoadClass() { assertThat(ReflectionUtils.tryToLoadClass(Integer.class.getName())).isEqualTo(success(Integer.class)); + assertThat(ReflectionUtils.tryToLoadClass(Void.class.getName())).isEqualTo(success(Void.class)); } @Test @@ -770,6 +772,7 @@ void tryToLoadClassTrimsClassName() { @Test void tryToLoadClassForPrimitive() { assertThat(ReflectionUtils.tryToLoadClass(int.class.getName())).isEqualTo(success(int.class)); + assertThat(ReflectionUtils.tryToLoadClass(void.class.getName())).isEqualTo(success(void.class)); } @Test From adc203f2037f94ef5fdbb4d36a32648d56a609df Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 8 Oct 2024 10:44:39 +0200 Subject: [PATCH 145/611] Replace twice-used 'support' with 'allow' --- .../docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index fe7125ac15c3..252a95e7b4ee 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -30,7 +30,7 @@ JUnit repository on GitHub. * Introduce `ReflectionSupport.makeAccessible(Field)` for third-party use rather than calling the internal `ReflectionUtils.makeAccessible(Field)` method directly. * Support both the primitive type `void` and the wrapper type `Void` in the internal - `ReflectionUtils` to support `String` to `Class` conversion in parameterized tests. + `ReflectionUtils` to allow `String` to `Class` conversion in parameterized tests. [[release-notes-5.12.0-M1-junit-jupiter]] From d2b608a7dd297b64b5ad2b9a3e9427fbd375f8dd Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 08:58:52 +0000 Subject: [PATCH 146/611] Update actions/checkout digest to eef6144 --- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/cross-version.yml | 4 ++-- .github/workflows/gradle-dependency-submission.yml | 2 +- .github/workflows/main.yml | 10 +++++----- .github/workflows/reproducible-build.yml | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index df3083fbecce..00d54cc3d2a5 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -30,7 +30,7 @@ jobs: - javascript steps: - name: Check out repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 - name: Initialize CodeQL uses: github/codeql-action/init@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3 with: diff --git a/.github/workflows/cross-version.yml b/.github/workflows/cross-version.yml index edc49ffb3429..42c53a7c5a58 100644 --- a/.github/workflows/cross-version.yml +++ b/.github/workflows/cross-version.yml @@ -33,7 +33,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: fetch-depth: 1 - name: Set up Test JDK @@ -72,7 +72,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: fetch-depth: 1 - name: Set up Test JDK diff --git a/.github/workflows/gradle-dependency-submission.yml b/.github/workflows/gradle-dependency-submission.yml index defbcfc5c0fe..7c4bffef974f 100644 --- a/.github/workflows/gradle-dependency-submission.yml +++ b/.github/workflows/gradle-dependency-submission.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: fetch-depth: 1 - name: Setup Java diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1b750c51d936..3dee8c1cf8e2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: fetch-depth: 1 - name: Install GraalVM @@ -45,7 +45,7 @@ jobs: runs-on: windows-latest steps: - name: Check out repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: fetch-depth: 1 - name: Build @@ -55,7 +55,7 @@ jobs: runs-on: macos-latest steps: - name: Check out repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: fetch-depth: 1 - name: Build @@ -71,7 +71,7 @@ jobs: if: github.event_name == 'push' && github.repository == 'junit-team/junit5' && (startsWith(github.ref, 'refs/heads/releases/') || github.ref == 'refs/heads/main') steps: - name: Check out repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: fetch-depth: 1 - name: Publish @@ -97,7 +97,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: fetch-depth: 1 - name: Install Graphviz diff --git a/.github/workflows/reproducible-build.yml b/.github/workflows/reproducible-build.yml index 39eb9160dbdc..0d432f693b6d 100644 --- a/.github/workflows/reproducible-build.yml +++ b/.github/workflows/reproducible-build.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 with: fetch-depth: 1 - name: Restore Gradle cache and display toolchains From daa4713c7629b6a0bd68695ae4602c76abca28f5 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Tue, 8 Oct 2024 11:56:26 +0200 Subject: [PATCH 147/611] Introduce release notes for 5.11.3 --- .../docs/asciidoc/release-notes/index.adoc | 2 + .../release-notes/release-notes-5.11.3.adoc | 67 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc diff --git a/documentation/src/docs/asciidoc/release-notes/index.adoc b/documentation/src/docs/asciidoc/release-notes/index.adoc index 1b4ff5513511..93e2ed4bedd5 100644 --- a/documentation/src/docs/asciidoc/release-notes/index.adoc +++ b/documentation/src/docs/asciidoc/release-notes/index.adoc @@ -19,6 +19,8 @@ include::{includedir}/link-attributes.adoc[] include::{basedir}/release-notes-5.12.0-M1.adoc[] +include::{basedir}/release-notes-5.11.3.adoc[] + include::{basedir}/release-notes-5.11.2.adoc[] include::{basedir}/release-notes-5.11.1.adoc[] diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc new file mode 100644 index 000000000000..49d53befa49f --- /dev/null +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc @@ -0,0 +1,67 @@ +[[release-notes-5.11.3]] +== 5.11.3 + +*Date of Release:* ❓ + +*Scope:* Bug fixes and enhancements since 5.11.2 + +For a complete list of all _closed_ issues and pull requests for this release, consult the +link:{junit5-repo}+/milestone/84?closed=1+[5.11.3] milestone page in the JUnit repository +on GitHub. + + +[[release-notes-5.11.3-junit-platform]] +=== JUnit Platform + +[[release-notes-5.11.3-junit-platform-bug-fixes]] +==== Bug Fixes + +* ❓ + +[[release-notes-5.11.3-junit-platform-deprecations-and-breaking-changes]] +==== Deprecations and Breaking Changes + +* ❓ + +[[release-notes-5.11.3-junit-platform-new-features-and-improvements]] +==== New Features and Improvements + +* ❓ + + +[[release-notes-5.11.3-junit-jupiter]] +=== JUnit Jupiter + +[[release-notes-5.11.3-junit-jupiter-bug-fixes]] +==== Bug Fixes + +* ❓ + +[[release-notes-5.11.3-junit-jupiter-deprecations-and-breaking-changes]] +==== Deprecations and Breaking Changes + +* ❓ + +[[release-notes-5.11.3-junit-jupiter-new-features-and-improvements]] +==== New Features and Improvements + +* ❓ + + +[[release-notes-5.11.3-junit-vintage]] +=== JUnit Vintage + +[[release-notes-5.11.3-junit-vintage-bug-fixes]] +==== Bug Fixes + +* ❓ + +[[release-notes-5.11.3-junit-vintage-deprecations-and-breaking-changes]] +==== Deprecations and Breaking Changes + +* ❓ + +[[release-notes-5.11.3-junit-vintage-new-features-and-improvements]] +==== New Features and Improvements + +* ❓ From d274794f7c14db5f5c8aa2d7a971015cc7e395de Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Tue, 8 Oct 2024 11:56:52 +0200 Subject: [PATCH 148/611] =?UTF-8?q?Find=20repeatable=20@=E2=81=A0ExtendWit?= =?UTF-8?q?h=20meta-annotations=20on=20fields=20again?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit JUnit Jupiter 5.11 introduced a regression regarding extension registration via fields. Specifically, repeated @⁠ExtendWith annotations on composed annotations were no longer found. This commit fixes that regression by reintroducing support for finding @⁠ExtendWith on custom composed annotations when @⁠ExtendWith is used as a repeatable annotation. Fixes #4054 --- .../release-notes/release-notes-5.11.3.adoc | 5 +- .../engine/descriptor/ExtensionUtils.java | 14 ++- .../descriptor/ExtensionsUtilsTests.java | 88 +++++++++++++++++++ 3 files changed, 103 insertions(+), 4 deletions(-) create mode 100644 jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionsUtilsTests.java diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc index 49d53befa49f..98c2238e5025 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc @@ -35,7 +35,10 @@ on GitHub. [[release-notes-5.11.3-junit-jupiter-bug-fixes]] ==== Bug Fixes -* ❓ +* Extensions can once again be registered via multiple `@ExtendWith` + meta-annotations on the same composed annotation on a field within a + test class. + [[release-notes-5.11.3-junit-jupiter-deprecations-and-breaking-changes]] ==== Deprecations and Breaking Changes diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExtensionUtils.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExtensionUtils.java index 951ea9b82d05..f9677ecfc9eb 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExtensionUtils.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExtensionUtils.java @@ -202,9 +202,7 @@ static void registerExtensionsFromExecutableParameters(ExtensionRegistrar regist * @since 5.11 */ private static Stream streamExtensionRegisteringFields(Class clazz, Predicate predicate) { - Predicate composedPredicate = predicate.and( - field -> isAnnotated(field, ExtendWith.class) || isAnnotated(field, RegisterExtension.class)); - return streamFields(clazz, composedPredicate, TOP_DOWN)// + return streamFields(clazz, predicate.and(registersExtension), TOP_DOWN)// .sorted(orderComparator); } @@ -237,4 +235,14 @@ private static int getOrder(Field field) { return findAnnotation(field, Order.class).map(Order::value).orElse(Order.DEFAULT); } + /** + * {@link Predicate} which determines if a {@link Field} registers an extension via + * {@link RegisterExtension @RegisterExtension} or {@link ExtendWith @ExtendWith}. + * + * @since 5.11.3 + */ + private static final Predicate registersExtension = // + field -> isAnnotated(field, RegisterExtension.class) + || !findRepeatableAnnotations(field, ExtendWith.class).isEmpty(); + } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionsUtilsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionsUtilsTests.java new file mode 100644 index 000000000000..b7afbb0c44b4 --- /dev/null +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionsUtilsTests.java @@ -0,0 +1,88 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.engine.descriptor; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.reflect.Field; +import java.util.function.Function; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.extension.Extension; +import org.junit.jupiter.api.extension.RegisterExtension; +import org.junit.jupiter.engine.extension.ExtensionRegistrar; + +/** + * Tests for {@link ExtensionUtils}. + * + * @since 5.11.3 + */ +class ExtensionsUtilsTests { + + @Test + void registerExtensionsViaStaticFields() throws Exception { + Field field = TestCase.class.getDeclaredField("staticField"); + ExtensionRegistrar registrar = mock(); + ExtensionUtils.registerExtensionsFromStaticFields(registrar, TestCase.class); + verify(registrar).registerExtension(Extension1.class); + verify(registrar).registerExtension(Extension2.class); + verify(registrar).registerExtension(TestCase.staticField, field); + } + + @Test + @SuppressWarnings("unchecked") + void registerExtensionsViaInstanceFields() throws Exception { + Class testClass = TestCase.class; + Field field = testClass.getDeclaredField("instanceField"); + ExtensionRegistrar registrar = mock(); + ExtensionUtils.registerExtensionsFromInstanceFields(registrar, testClass); + verify(registrar).registerExtension(Extension1.class); + verify(registrar).registerExtension(Extension2.class); + verify(registrar).registerUninitializedExtension(eq(testClass), eq(field), any(Function.class)); + } + + static class Extension1 implements Extension { + } + + static class Extension2 implements Extension { + } + + static class Extension3 implements Extension { + } + + static class Extension4 implements Extension { + } + + @Retention(RetentionPolicy.RUNTIME) + @ExtendWith(Extension1.class) + @ExtendWith(Extension2.class) + @interface UseCustomExtensions { + } + + static class TestCase { + + @UseCustomExtensions + @RegisterExtension + static Extension3 staticField = new Extension3(); + + @UseCustomExtensions + @RegisterExtension + Extension4 instanceField = new Extension4(); + + } + +} From c2fb8bd7a57911470d458c6854e721d759cdd647 Mon Sep 17 00:00:00 2001 From: Johannes Spangenberg Date: Tue, 8 Oct 2024 12:29:47 +0200 Subject: [PATCH 149/611] Introduce `EnableTestScopedConstructorContext` annotation for extensions The new annotation allows extensions to opt in to receive a test-scoped `ExtensionContext` for extension methods participating in the creation or destruction of test class instances: - `TestInstancePreConstructCallback` - `TestInstanceFactory` - `ParameterResolver` (when called for a test class constructor) - `InvocationInterceptor.interceptTestClassConstructor` - `TestInstancePostProcessor` Resolves #3445. --------- Co-authored-by: Marc Philipp --- .../src/docs/asciidoc/link-attributes.adoc | 1 + .../release-notes-5.12.0-M1.adoc | 4 + .../docs/asciidoc/user-guide/extensions.adoc | 33 ++++ .../EnableTestScopedConstructorContext.java | 80 +++++++++ .../api/extension/InvocationInterceptor.java | 4 + .../api/extension/ParameterResolver.java | 7 + .../api/extension/TestInstanceFactory.java | 6 + .../extension/TestInstancePostProcessor.java | 6 + .../TestInstancePreConstructCallback.java | 6 + .../descriptor/ClassBasedTestDescriptor.java | 53 +++--- .../descriptor/ClassTestDescriptor.java | 8 +- .../descriptor/NestedClassTestDescriptor.java | 10 +- .../descriptor/TestMethodTestDescriptor.java | 13 +- .../execution/ExtensionContextSupplier.java | 47 +++++ .../InterceptingExecutableInvoker.java | 13 +- .../execution/ParameterResolutionUtils.java | 13 +- .../execution/TestInstancesProvider.java | 11 +- .../engine/TestInstanceLifecycleTests.java | 3 +- .../InterceptingExecutableInvokerTests.java | 3 +- .../extension/TestInstanceFactoryTests.java | 80 ++++++++- .../TestInstancePostProcessorTests.java | 120 +++++++++---- ...TestInstancePreConstructCallbackTests.java | 160 +++++++++++++++++- 22 files changed, 580 insertions(+), 101 deletions(-) create mode 100644 junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/EnableTestScopedConstructorContext.java create mode 100644 junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java diff --git a/documentation/src/docs/asciidoc/link-attributes.adoc b/documentation/src/docs/asciidoc/link-attributes.adoc index 5c55bec09cf7..90a80a566f55 100644 --- a/documentation/src/docs/asciidoc/link-attributes.adoc +++ b/documentation/src/docs/asciidoc/link-attributes.adoc @@ -139,6 +139,7 @@ endif::[] :BeforeAllCallback: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/BeforeAllCallback.html[BeforeAllCallback] :BeforeEachCallback: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/BeforeEachCallback.html[BeforeEachCallback] :BeforeTestExecutionCallback: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/BeforeTestExecutionCallback.html[BeforeTestExecutionCallback] +:EnableTestScopedConstructorContext: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/EnableTestScopedConstructorContext.html[@EnableTestScopedConstructorContext] :ExecutableInvoker: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/ExecutableInvoker.html[ExecutableInvoker] :ExecutionCondition: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/ExecutionCondition.html[ExecutionCondition] :ExtendWith: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/ExtendWith.html[@ExtendWith] diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 252a95e7b4ee..67393a8cd47b 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -58,6 +58,10 @@ JUnit repository on GitHub. extensions. * Allow determining "shared resources" at runtime via the new `@ResourceLock#providers` attribute that accepts implementations of `ResourceLocksProvider`. +* `@EnableTestScopedConstructorContext` has been added to enable the use of a test-scoped + `ExtensionContext` while instantiating the test instance. + The behavior enabled by the annotation is expected to eventually become the default in + future versions of JUnit Jupiter. [[release-notes-5.12.0-M1-junit-vintage]] diff --git a/documentation/src/docs/asciidoc/user-guide/extensions.adoc b/documentation/src/docs/asciidoc/user-guide/extensions.adoc index bffbd523d5ab..12f8b6ad54ad 100644 --- a/documentation/src/docs/asciidoc/user-guide/extensions.adoc +++ b/documentation/src/docs/asciidoc/user-guide/extensions.adoc @@ -381,6 +381,12 @@ This extension provides a symmetric call to `{TestInstancePreDestroyCallback}` a in combination with other extensions to prepare constructor parameters or keeping track of test instances and their lifecycle. +[NOTE] +==== +You may annotate your extension with `{EnableTestScopedConstructorContext}` for revised +handling of `CloseableResource` and to make test-specific data available to your implementation. +==== + [[extensions-test-instance-factories]] === Test Instance Factories @@ -407,6 +413,12 @@ the user's responsibility to ensure that only a single `TestInstanceFactory` is registered for any specific test class. ==== +[NOTE] +==== +You may annotate your extension with `{EnableTestScopedConstructorContext}` for revised +handling of `CloseableResource` and to make test-specific data available to your implementation. +==== + [[extensions-test-instance-post-processing]] === Test Instance Post-processing @@ -419,6 +431,12 @@ initialization methods on the test instance, etc. For a concrete example, consult the source code for the `{MockitoExtension}` and the `{SpringExtension}`. +[NOTE] +==== +You may annotate your extension with `{EnableTestScopedConstructorContext}` for revised +handling of `CloseableResource` and to make test-specific data available to your implementation. +==== + [[extensions-test-instance-pre-destroy-callback]] === Test Instance Pre-destroy Callback @@ -465,6 +483,14 @@ those provided in `java.lang.reflect.Parameter` in order to avoid this bug in th * `List findRepeatableAnnotations(Class annotationType)` ==== +[NOTE] +==== +You may annotate your extension with `{EnableTestScopedConstructorContext}` to support +injecting test specific data into constructor parameters of the test instance. +The annotation makes JUnit use a test-specific `ExtensionContext` while resolving +constructor parameters, unless the lifecycle is set to `TestInstance.Lifecycle.PER_CLASS`. +==== + [NOTE] ==== Other extensions can also leverage registered `ParameterResolvers` for method and @@ -695,6 +721,13 @@ Dispatch Thread. include::{testDir}/example/interceptor/SwingEdtInterceptor.java[tags=user_guide] ---- +[NOTE] +==== +You may annotate your extension with `{EnableTestScopedConstructorContext}` to make +test-specific data available to your implementation of `interceptTestClassConstructor` and +for a revised scope of the provided `Store` instance. +==== + [[extensions-test-templates]] === Providing Invocation Contexts for Test Templates diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/EnableTestScopedConstructorContext.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/EnableTestScopedConstructorContext.java new file mode 100644 index 000000000000..58a3cc65ce5a --- /dev/null +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/EnableTestScopedConstructorContext.java @@ -0,0 +1,80 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.api.extension; + +import static org.apiguardian.api.API.Status.MAINTAINED; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.apiguardian.api.API; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.extension.ExtensionContext.Store; +import org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource; + +/** + * {@code @EnableTestScopedConstructorContext} allows + * {@link Extension Extensions} to use a test-scoped {@link ExtensionContext} + * during creation of test instances. + * + *

The annotation should be used on extension classes. + * JUnit will call the following extension callbacks of annotated extensions + * with a test-scoped {@link ExtensionContext}, unless the test class is + * annotated with {@link TestInstance @TestInstance(Lifecycle.PER_CLASS)}. + * + *

+ * + *

Implementations of these extension callbacks can observe the following + * differences if they are using {@code @EnableTestScopedConstructorContext}. + * + *

    + *
  • {@link ExtensionContext#getElement() getElement()} may refer to the test + * method and {@link ExtensionContext#getTestClass() getTestClass()} may refer + * to a nested test class. Use {@link TestInstanceFactoryContext#getTestClass()} + * to get the class under construction.
  • + *
  • {@link ExtensionContext#getTestMethod() getTestMethod()} is no-longer + * empty, unless the test class is annotated with + * {@link TestInstance @TestInstance(Lifecycle.PER_CLASS)}.
  • + *
  • If the callback adds a new {@link CloseableResource CloseableResource} to + * the {@link Store Store}, the resource is closed just after the instance is + * destroyed.
  • + *
  • The callbacks can now access data previously stored by + * {@link TestTemplateInvocationContext}, unless the test class is annotated + * with {@link TestInstance @TestInstance(Lifecycle.PER_CLASS)}.
  • + *
+ * + *

Note: The behavior which is enabled by this annotation is + * expected to become the default in future versions of JUnit Jupiter. To ensure + * future compatibility, extension vendors are therefore advised to annotate + * their extensions, even if they don't need the new functionality. + * + * @since 5.12 + * @see InvocationInterceptor + * @see ParameterResolver + * @see TestInstancePreConstructCallback + * @see TestInstancePostProcessor + * @see TestInstanceFactory + */ +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +@Inherited +@API(status = MAINTAINED, since = "5.12") +public @interface EnableTestScopedConstructorContext { +} diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java index 81bf9dc1fd32..c13e6ed841d1 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java @@ -58,6 +58,10 @@ public interface InvocationInterceptor extends Extension { *

Note that the test class may not have been initialized * (static initialization) when this method is invoked. * + *

You may annotate your extension with {@link EnableTestScopedConstructorContext} + * to make test-specific data available to your implementation of this method and + * for a revised scope of the provided `Store` instance. + * * @param invocation the invocation that is being intercepted; never * {@code null} * @param invocationContext the context of the invocation that is being diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java index 6678d72b898a..74ad7feaae61 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java @@ -15,6 +15,7 @@ import java.lang.reflect.Parameter; import org.apiguardian.api.API; +import org.junit.jupiter.api.TestInstance; /** * {@code ParameterResolver} defines the API for {@link Extension Extensions} @@ -30,6 +31,12 @@ * an argument for the parameter must be resolved at runtime by a * {@code ParameterResolver}. * + *

You may annotate your extension with {@link EnableTestScopedConstructorContext} + * to support injecting test specific data into constructor parameters of the test instance. + * The annotation makes JUnit use a test-specific `ExtensionContext` while resolving + * constructor parameters, unless the test class is annotated with + * {@link TestInstance @TestInstance(Lifecycle.PER_CLASS)}. + * *

Constructor Requirements

* *

Consult the documentation in {@link Extension} for details on diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java index a5e7e514c540..f341e88e3e2d 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java @@ -13,6 +13,7 @@ import static org.apiguardian.api.API.Status.STABLE; import org.apiguardian.api.API; +import org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource; /** * {@code TestInstanceFactory} defines the API for {@link Extension @@ -56,6 +57,11 @@ public interface TestInstanceFactory extends Extension { /** * Callback for creating a test instance for the supplied context. * + *

You may annotate your extension with + * {@link EnableTestScopedConstructorContext @EnableTestScopedConstructorContext} + * for revised handling of {@link CloseableResource CloseableResource} and + * to make test-specific data available to your implementation. + * *

Note: the {@code ExtensionContext} supplied to a * {@code TestInstanceFactory} will always return an empty * {@link java.util.Optional} value from diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java index 6b0cd8e59b17..a1aa465c5737 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java @@ -13,6 +13,7 @@ import static org.apiguardian.api.API.Status.STABLE; import org.apiguardian.api.API; +import org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource; /** * {@code TestInstancePostProcessor} defines the API for {@link Extension @@ -45,6 +46,11 @@ public interface TestInstancePostProcessor extends Extension { /** * Callback for post-processing the supplied test instance. * + *

You may annotate your extension with + * {@link EnableTestScopedConstructorContext @EnableTestScopedConstructorContext} + * for revised handling of {@link CloseableResource CloseableResource} and + * to make test-specific data available to your implementation. + * *

Note: the {@code ExtensionContext} supplied to a * {@code TestInstancePostProcessor} will always return an empty * {@link java.util.Optional} value from {@link ExtensionContext#getTestInstance() diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java index 933d7bc9d27b..b627c52f9132 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java @@ -14,6 +14,7 @@ import org.apiguardian.api.API; import org.junit.jupiter.api.TestInstance.Lifecycle; +import org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource; /** * {@code TestInstancePreConstructCallback} defines the API for {@link Extension @@ -49,6 +50,11 @@ public interface TestInstancePreConstructCallback extends Extension { /** * Callback invoked prior to test instances being constructed. * + *

You may annotate your extension with + * {@link EnableTestScopedConstructorContext @EnableTestScopedConstructorContext} + * for revised handling of {@link CloseableResource CloseableResource} and + * to make test-specific data available to your implementation. + * * @param factoryContext the context for the test instance about to be instantiated; * never {@code null} * @param context the current extension context; never {@code null} diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java index 6b3b524e6f55..c604cab089cf 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java @@ -57,6 +57,7 @@ import org.junit.jupiter.engine.execution.BeforeEachMethodAdapter; import org.junit.jupiter.engine.execution.DefaultExecutableInvoker; import org.junit.jupiter.engine.execution.DefaultTestInstances; +import org.junit.jupiter.engine.execution.ExtensionContextSupplier; import org.junit.jupiter.engine.execution.InterceptingExecutableInvoker; import org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.ReflectiveInterceptorCall; import org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.ReflectiveInterceptorCall.VoidMethodInterceptorCall; @@ -202,8 +203,7 @@ public JupiterEngineExecutionContext before(JupiterEngineExecutionContext contex // and store the instance in the ExtensionContext. ClassExtensionContext extensionContext = (ClassExtensionContext) context.getExtensionContext(); throwableCollector.execute(() -> { - TestInstances testInstances = context.getTestInstancesProvider().getTestInstances( - context.getExtensionRegistry(), throwableCollector); + TestInstances testInstances = context.getTestInstancesProvider().getTestInstances(context); extensionContext.setTestInstances(testInstances); }); } @@ -274,35 +274,38 @@ private TestInstanceFactory resolveTestInstanceFactory(ExtensionRegistry registr } private TestInstancesProvider testInstancesProvider(JupiterEngineExecutionContext parentExecutionContext, - ClassExtensionContext extensionContext) { + ClassExtensionContext ourExtensionContext) { - return (registry, registrar, throwableCollector) -> extensionContext.getTestInstances().orElseGet( - () -> instantiateAndPostProcessTestInstance(parentExecutionContext, extensionContext, registry, registrar, - throwableCollector)); + // For Lifecycle.PER_CLASS, ourExtensionContext.getTestInstances() is used to store the instance. + // Otherwise, extensionContext.getTestInstances() is always empty and we always create a new instance. + return (registry, context) -> ourExtensionContext.getTestInstances().orElseGet( + () -> instantiateAndPostProcessTestInstance(parentExecutionContext, ourExtensionContext, registry, + context)); } private TestInstances instantiateAndPostProcessTestInstance(JupiterEngineExecutionContext parentExecutionContext, - ExtensionContext extensionContext, ExtensionRegistry registry, ExtensionRegistrar registrar, - ThrowableCollector throwableCollector) { + ClassExtensionContext ourExtensionContext, ExtensionRegistry registry, + JupiterEngineExecutionContext context) { - TestInstances instances = instantiateTestClass(parentExecutionContext, registry, registrar, extensionContext, - throwableCollector); - throwableCollector.execute(() -> { + ExtensionContextSupplier extensionContext = new ExtensionContextSupplier(context.getExtensionContext(), + ourExtensionContext); + TestInstances instances = instantiateTestClass(parentExecutionContext, extensionContext, registry, context); + context.getThrowableCollector().execute(() -> { invokeTestInstancePostProcessors(instances.getInnermostInstance(), registry, extensionContext); // In addition, we initialize extension registered programmatically from instance fields here // since the best time to do that is immediately following test class instantiation // and post-processing. - registrar.initializeExtensions(this.testClass, instances.getInnermostInstance()); + context.getExtensionRegistry().initializeExtensions(this.testClass, instances.getInnermostInstance()); }); return instances; } protected abstract TestInstances instantiateTestClass(JupiterEngineExecutionContext parentExecutionContext, - ExtensionRegistry registry, ExtensionRegistrar registrar, ExtensionContext extensionContext, - ThrowableCollector throwableCollector); + ExtensionContextSupplier extensionContext, ExtensionRegistry registry, + JupiterEngineExecutionContext context); protected TestInstances instantiateTestClass(Optional outerInstances, ExtensionRegistry registry, - ExtensionContext extensionContext) { + ExtensionContextSupplier extensionContext) { Optional outerInstance = outerInstances.map(TestInstances::getInnermostInstance); invokeTestInstancePreConstructCallbacks(new DefaultTestInstanceFactoryContext(this.testClass, outerInstance), @@ -314,12 +317,14 @@ protected TestInstances instantiateTestClass(Optional outerInstan DefaultTestInstances.of(instance)); } - private Object invokeTestInstanceFactory(Optional outerInstance, ExtensionContext extensionContext) { + private Object invokeTestInstanceFactory(Optional outerInstance, + ExtensionContextSupplier extensionContext) { Object instance; try { + ExtensionContext actualExtensionContext = extensionContext.get(this.testInstanceFactory); instance = this.testInstanceFactory.createTestInstance( - new DefaultTestInstanceFactoryContext(this.testClass, outerInstance), extensionContext); + new DefaultTestInstanceFactoryContext(this.testClass, outerInstance), actualExtensionContext); } catch (Throwable throwable) { UnrecoverableExceptions.rethrowIfUnrecoverable(throwable); @@ -359,7 +364,7 @@ private Object invokeTestInstanceFactory(Optional outerInstance, Extensi } private Object invokeTestClassConstructor(Optional outerInstance, ExtensionRegistry registry, - ExtensionContext extensionContext) { + ExtensionContextSupplier extensionContext) { Constructor constructor = ReflectionUtils.getDeclaredConstructor(this.testClass); return executableInvoker.invoke(constructor, outerInstance, extensionContext, registry, @@ -367,16 +372,16 @@ private Object invokeTestClassConstructor(Optional outerInstance, Extens } private void invokeTestInstancePreConstructCallbacks(TestInstanceFactoryContext factoryContext, - ExtensionRegistry registry, ExtensionContext context) { - registry.stream(TestInstancePreConstructCallback.class).forEach( - extension -> executeAndMaskThrowable(() -> extension.preConstructTestInstance(factoryContext, context))); + ExtensionRegistry registry, ExtensionContextSupplier context) { + registry.stream(TestInstancePreConstructCallback.class).forEach(extension -> executeAndMaskThrowable( + () -> extension.preConstructTestInstance(factoryContext, context.get(extension)))); } private void invokeTestInstancePostProcessors(Object instance, ExtensionRegistry registry, - ExtensionContext context) { + ExtensionContextSupplier context) { - registry.stream(TestInstancePostProcessor.class).forEach( - extension -> executeAndMaskThrowable(() -> extension.postProcessTestInstance(instance, context))); + registry.stream(TestInstancePostProcessor.class).forEach(extension -> executeAndMaskThrowable( + () -> extension.postProcessTestInstance(instance, context.get(extension)))); } private void executeAndMaskThrowable(Executable executable) { diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassTestDescriptor.java index e644518fb57b..3b4b1db2a1de 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassTestDescriptor.java @@ -20,17 +20,15 @@ import java.util.Set; import org.apiguardian.api.API; -import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.TestInstances; import org.junit.jupiter.api.parallel.ResourceLocksProvider; import org.junit.jupiter.engine.config.JupiterConfiguration; +import org.junit.jupiter.engine.execution.ExtensionContextSupplier; import org.junit.jupiter.engine.execution.JupiterEngineExecutionContext; -import org.junit.jupiter.engine.extension.ExtensionRegistrar; import org.junit.jupiter.engine.extension.ExtensionRegistry; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.TestTag; import org.junit.platform.engine.UniqueId; -import org.junit.platform.engine.support.hierarchical.ThrowableCollector; /** * {@link TestDescriptor} for tests based on Java classes. @@ -75,8 +73,8 @@ public ExecutionMode getExecutionMode() { @Override protected TestInstances instantiateTestClass(JupiterEngineExecutionContext parentExecutionContext, - ExtensionRegistry registry, ExtensionRegistrar registrar, ExtensionContext extensionContext, - ThrowableCollector throwableCollector) { + ExtensionContextSupplier extensionContext, ExtensionRegistry registry, + JupiterEngineExecutionContext context) { return instantiateTestClass(Optional.empty(), registry, extensionContext); } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/NestedClassTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/NestedClassTestDescriptor.java index 0c1f697b2686..f8ddd867239a 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/NestedClassTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/NestedClassTestDescriptor.java @@ -21,17 +21,15 @@ import java.util.Set; import org.apiguardian.api.API; -import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.TestInstances; import org.junit.jupiter.api.parallel.ResourceLocksProvider; import org.junit.jupiter.engine.config.JupiterConfiguration; +import org.junit.jupiter.engine.execution.ExtensionContextSupplier; import org.junit.jupiter.engine.execution.JupiterEngineExecutionContext; -import org.junit.jupiter.engine.extension.ExtensionRegistrar; import org.junit.jupiter.engine.extension.ExtensionRegistry; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.TestTag; import org.junit.platform.engine.UniqueId; -import org.junit.platform.engine.support.hierarchical.ThrowableCollector; /** * {@link TestDescriptor} for tests based on nested (but not static) Java classes. @@ -78,13 +76,13 @@ public List> getEnclosingTestClasses() { @Override protected TestInstances instantiateTestClass(JupiterEngineExecutionContext parentExecutionContext, - ExtensionRegistry registry, ExtensionRegistrar registrar, ExtensionContext extensionContext, - ThrowableCollector throwableCollector) { + ExtensionContextSupplier extensionContext, ExtensionRegistry registry, + JupiterEngineExecutionContext context) { // Extensions registered for nested classes and below are not to be used for instantiating and initializing outer classes ExtensionRegistry extensionRegistryForOuterInstanceCreation = parentExecutionContext.getExtensionRegistry(); TestInstances outerInstances = parentExecutionContext.getTestInstancesProvider().getTestInstances( - extensionRegistryForOuterInstanceCreation, registrar, throwableCollector); + extensionRegistryForOuterInstanceCreation, context); return instantiateTestClass(Optional.of(outerInstances), registry, extensionContext); } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestMethodTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestMethodTestDescriptor.java index b4f874966522..d9da3cb4da7a 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestMethodTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestMethodTestDescriptor.java @@ -101,19 +101,18 @@ public JupiterEngineExecutionContext prepare(JupiterEngineExecutionContext conte MethodExtensionContext extensionContext = new MethodExtensionContext(context.getExtensionContext(), context.getExecutionListener(), this, context.getConfiguration(), throwableCollector, it -> new DefaultExecutableInvoker(it, registry)); - throwableCollector.execute(() -> { - TestInstances testInstances = context.getTestInstancesProvider().getTestInstances(registry, - throwableCollector); - extensionContext.setTestInstances(testInstances); - }); - // @formatter:off - return context.extend() + JupiterEngineExecutionContext newContext = context.extend() .withExtensionRegistry(registry) .withExtensionContext(extensionContext) .withThrowableCollector(throwableCollector) .build(); // @formatter:on + throwableCollector.execute(() -> { + TestInstances testInstances = newContext.getTestInstancesProvider().getTestInstances(newContext); + extensionContext.setTestInstances(testInstances); + }); + return newContext; } protected MutableExtensionRegistry populateNewExtensionRegistry(JupiterEngineExecutionContext context) { diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java new file mode 100644 index 000000000000..1a81c0df6536 --- /dev/null +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java @@ -0,0 +1,47 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.engine.execution; + +import static org.apiguardian.api.API.Status.INTERNAL; + +import org.apiguardian.api.API; +import org.junit.jupiter.api.extension.EnableTestScopedConstructorContext; +import org.junit.jupiter.api.extension.Extension; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.platform.commons.util.AnnotationUtils; + +/** + * Container of two instances of {@link ExtensionContext} to simplify the legacy for + * #3445 (Introduction of Test-scoped ExtensionContext). + * + * @since 5.12 + */ +@API(status = INTERNAL, since = "5.12") +public final class ExtensionContextSupplier { + + private final ExtensionContext currentExtensionContext; + private final ExtensionContext legacyExtensionContext; + + public ExtensionContextSupplier(ExtensionContext currentExtensionContext, ExtensionContext legacyExtensionContext) { + this.currentExtensionContext = currentExtensionContext; + this.legacyExtensionContext = legacyExtensionContext; + } + + public ExtensionContext get(Extension extension) { + if (currentExtensionContext == legacyExtensionContext + || AnnotationUtils.isAnnotated(extension.getClass(), EnableTestScopedConstructorContext.class)) { + return currentExtensionContext; + } + else { + return legacyExtensionContext; + } + } +} diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvoker.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvoker.java index e81c46c0715b..a070f2808c05 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvoker.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvoker.java @@ -53,8 +53,9 @@ public class InterceptingExecutableInvoker { * invocation via all registered {@linkplain InvocationInterceptor * interceptors} */ - public T invoke(Constructor constructor, Optional outerInstance, ExtensionContext extensionContext, - ExtensionRegistry extensionRegistry, ReflectiveInterceptorCall, T> interceptorCall) { + public T invoke(Constructor constructor, Optional outerInstance, + ExtensionContextSupplier extensionContext, ExtensionRegistry extensionRegistry, + ReflectiveInterceptorCall, T> interceptorCall) { Object[] arguments = resolveParameters(constructor, Optional.empty(), outerInstance, extensionContext, extensionRegistry); @@ -93,6 +94,14 @@ private T invoke(Invocation originalInvocation, wrappedInvocation) -> call.apply(interceptor, wrappedInvocation, invocationContext, extensionContext)); } + private T invoke(Invocation originalInvocation, + ReflectiveInvocationContext invocationContext, ExtensionContextSupplier extensionContext, + ExtensionRegistry extensionRegistry, ReflectiveInterceptorCall call) { + return interceptorChain.invoke(originalInvocation, extensionRegistry, + (interceptor, wrappedInvocation) -> call.apply(interceptor, wrappedInvocation, invocationContext, + extensionContext.get(interceptor))); + } + public interface ReflectiveInterceptorCall { T apply(InvocationInterceptor interceptor, Invocation invocation, diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ParameterResolutionUtils.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ParameterResolutionUtils.java index 5d6e1b1802cc..93ee83d0e94b 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ParameterResolutionUtils.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ParameterResolutionUtils.java @@ -83,6 +83,13 @@ public static Object[] resolveParameters(Method method, Optional target, */ public static Object[] resolveParameters(Executable executable, Optional target, Optional outerInstance, ExtensionContext extensionContext, ExtensionRegistry extensionRegistry) { + ExtensionContextSupplier context = new ExtensionContextSupplier(extensionContext, extensionContext); + return resolveParameters(executable, target, outerInstance, context, extensionRegistry); + } + + public static Object[] resolveParameters(Executable executable, Optional target, + Optional outerInstance, ExtensionContextSupplier extensionContext, + ExtensionRegistry extensionRegistry) { Preconditions.notNull(target, "target must not be null"); @@ -106,12 +113,12 @@ public static Object[] resolveParameters(Executable executable, Optional } private static Object resolveParameter(ParameterContext parameterContext, Executable executable, - ExtensionContext extensionContext, ExtensionRegistry extensionRegistry) { + ExtensionContextSupplier extensionContext, ExtensionRegistry extensionRegistry) { try { // @formatter:off List matchingResolvers = extensionRegistry.stream(ParameterResolver.class) - .filter(resolver -> resolver.supportsParameter(parameterContext, extensionContext)) + .filter(resolver -> resolver.supportsParameter(parameterContext, extensionContext.get(resolver))) .collect(toList()); // @formatter:on @@ -133,7 +140,7 @@ private static Object resolveParameter(ParameterContext parameterContext, Execut } ParameterResolver resolver = matchingResolvers.get(0); - Object value = resolver.resolveParameter(parameterContext, extensionContext); + Object value = resolver.resolveParameter(parameterContext, extensionContext.get(resolver)); validateResolvedType(parameterContext.getParameter(), value, executable, resolver); logger.trace(() -> String.format( diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/TestInstancesProvider.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/TestInstancesProvider.java index bceef6248a67..e8a87b3d88e2 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/TestInstancesProvider.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/TestInstancesProvider.java @@ -14,10 +14,7 @@ import org.apiguardian.api.API; import org.junit.jupiter.api.extension.TestInstances; -import org.junit.jupiter.engine.extension.ExtensionRegistrar; import org.junit.jupiter.engine.extension.ExtensionRegistry; -import org.junit.jupiter.engine.extension.MutableExtensionRegistry; -import org.junit.platform.engine.support.hierarchical.ThrowableCollector; /** * @since 5.0 @@ -26,12 +23,10 @@ @API(status = INTERNAL, since = "5.0") public interface TestInstancesProvider { - default TestInstances getTestInstances(MutableExtensionRegistry extensionRegistry, - ThrowableCollector throwableCollector) { - return getTestInstances(extensionRegistry, extensionRegistry, throwableCollector); + default TestInstances getTestInstances(JupiterEngineExecutionContext context) { + return getTestInstances(context.getExtensionRegistry(), context); } - TestInstances getTestInstances(ExtensionRegistry extensionRegistry, ExtensionRegistrar extensionRegistrar, - ThrowableCollector throwableCollector); + TestInstances getTestInstances(ExtensionRegistry extensionRegistry, JupiterEngineExecutionContext executionContext); } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleTests.java index b03583f10fab..6358c0ad9ba3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleTests.java @@ -992,8 +992,7 @@ public void postProcessTestInstance(Object testInstance, ExtensionContext contex trackLifecycle(context); assertThat(context.getTestInstance()).isNotPresent(); assertNotNull(testInstance); - instanceMap.put(postProcessTestInstanceKey(context.getRequiredTestClass()), - DefaultTestInstances.of(testInstance)); + instanceMap.put(postProcessTestInstanceKey(testInstance.getClass()), DefaultTestInstances.of(testInstance)); } @Override diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvokerTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvokerTests.java index 4ce912a74e73..c2dca032546a 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvokerTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvokerTests.java @@ -31,7 +31,8 @@ void invokeMethod() { @Override T invokeConstructor(Constructor constructor, Object outerInstance) { - return newInvoker().invoke(constructor, Optional.ofNullable(outerInstance), extensionContext, extensionRegistry, + ExtensionContextSupplier context = new ExtensionContextSupplier(extensionContext, extensionContext); + return newInvoker().invoke(constructor, Optional.ofNullable(outerInstance), context, extensionRegistry, passthroughInterceptor()); } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java index 734f6e441664..48d4218faccd 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java @@ -35,6 +35,7 @@ import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.extension.EnableTestScopedConstructorContext; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtensionConfigurationException; import org.junit.jupiter.api.extension.ExtensionContext; @@ -276,7 +277,8 @@ void instanceFactoryOnTopLevelTestClass() { // @formatter:off assertThat(callSequence).containsExactly( "FooInstanceFactory instantiated: ParentTestCase", - "parentTest" + "parentTest", + "close ParentTestCase" ); // @formatter:on } @@ -305,8 +307,10 @@ void inheritedFactoryInTestClassHierarchy() { assertThat(callSequence).containsExactly( "FooInstanceFactory instantiated: InheritedFactoryTestCase", "parentTest", + "close InheritedFactoryTestCase", "FooInstanceFactory instantiated: InheritedFactoryTestCase", - "childTest" + "childTest", + "close InheritedFactoryTestCase" ); // @formatter:on } @@ -324,17 +328,23 @@ void instanceFactoriesInNestedClassStructureAreInherited() { // OuterTestCase "FooInstanceFactory instantiated: OuterTestCase", "outerTest", + "close OuterTestCase", // InnerTestCase "FooInstanceFactory instantiated: OuterTestCase", "FooInstanceFactory instantiated: InnerTestCase", "innerTest1", + "close InnerTestCase", + "close OuterTestCase", // InnerInnerTestCase "FooInstanceFactory instantiated: OuterTestCase", "FooInstanceFactory instantiated: InnerTestCase", "FooInstanceFactory instantiated: InnerInnerTestCase", - "innerTest2" + "innerTest2", + "close InnerInnerTestCase", + "close InnerTestCase", + "close OuterTestCase" ); // @formatter:on } @@ -349,7 +359,8 @@ void instanceFactoryRegisteredViaTestInterface() { // @formatter:off assertThat(callSequence).containsExactly( "FooInstanceFactory instantiated: FactoryFromInterfaceTestCase", - "test" + "test", + "close FactoryFromInterfaceTestCase" ); // @formatter:on } @@ -386,7 +397,34 @@ void instanceFactoryWithPerClassLifecycle() { "test1", "@BeforeEach", "test2", - "@AfterAll" + "@AfterAll", + "close PerClassLifecycleTestCase" + ); + // @formatter:on + } + + @Test + void instanceFactoryWithLegacyContext() { + EngineExecutionResults executionResults = executeTestsForClass(LegacyContextTestCase.class); + + assertEquals(3, executionResults.testEvents().started().count(), "# tests started"); + assertEquals(3, executionResults.testEvents().succeeded().count(), "# tests succeeded"); + + // @formatter:off + assertThat(callSequence).containsExactly( + "LegacyInstanceFactory instantiated: LegacyContextTestCase", + "outerTest", + "LegacyInstanceFactory instantiated: LegacyContextTestCase", + "LegacyInstanceFactory instantiated: InnerTestCase", + "innerTest1", + "LegacyInstanceFactory instantiated: LegacyContextTestCase", + "LegacyInstanceFactory instantiated: InnerTestCase", + "innerTest2", + "close InnerTestCase", + "close InnerTestCase", + "close LegacyContextTestCase", + "close LegacyContextTestCase", + "close LegacyContextTestCase" ); // @formatter:on } @@ -609,6 +647,29 @@ void afterAll() { } } + @ExtendWith(LegacyInstanceFactory.class) + static class LegacyContextTestCase { + + @Test + void outerTest() { + callSequence.add("outerTest"); + } + + @Nested + class InnerTestCase { + + @Test + void innerTest1() { + callSequence.add("innerTest1"); + } + + @Test + void innerTest2() { + callSequence.add("innerTest2"); + } + } + } + @ExtendWith(ProxyTestInstanceFactory.class) @TestInstance(PER_CLASS) static class ProxiedTestCase { @@ -633,6 +694,10 @@ public Object createTestInstance(TestInstanceFactoryContext factoryContext, Exte Class testClass = factoryContext.getTestClass(); instantiated(getClass(), testClass); + extensionContext.getStore(ExtensionContext.Namespace.create(this)).put(new Object(), + (ExtensionContext.Store.CloseableResource) () -> callSequence.add( + "close " + testClass.getSimpleName())); + if (factoryContext.getOuterInstance().isPresent()) { return ReflectionSupport.newInstance(testClass, factoryContext.getOuterInstance().get()); } @@ -641,12 +706,17 @@ public Object createTestInstance(TestInstanceFactoryContext factoryContext, Exte } } + @EnableTestScopedConstructorContext private static class FooInstanceFactory extends AbstractTestInstanceFactory { } + @EnableTestScopedConstructorContext private static class BarInstanceFactory extends AbstractTestInstanceFactory { } + private static class LegacyInstanceFactory extends AbstractTestInstanceFactory { + } + /** * {@link TestInstanceFactory} that returns null. */ diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java index a9b4fe75cf03..416e90e8e532 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java @@ -14,11 +14,14 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.EnableTestScopedConstructorContext; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.TestInstancePostProcessor; @@ -46,18 +49,28 @@ void instancePostProcessorsInNestedClasses() { assertThat(callSequence).containsExactly( // OuterTestCase - "fooPostProcessTestInstance:OuterTestCase", + "foo:OuterTestCase", + "legacy:OuterTestCase", "beforeOuterMethod", "testOuter", + "close:foo:OuterTestCase", // InnerTestCase - "fooPostProcessTestInstance:OuterTestCase", - "fooPostProcessTestInstance:InnerTestCase", - "barPostProcessTestInstance:InnerTestCase", + "foo:OuterTestCase", + "legacy:OuterTestCase", + "foo:InnerTestCase", + "legacy:InnerTestCase", + "bar:InnerTestCase", "beforeOuterMethod", "beforeInnerMethod", - "testInner" + "testInner", + "close:bar:InnerTestCase", + "close:foo:InnerTestCase", + "close:foo:OuterTestCase", + "close:legacy:InnerTestCase", + "close:legacy:OuterTestCase", + "close:legacy:OuterTestCase" ); // @formatter:on } @@ -65,22 +78,33 @@ void instancePostProcessorsInNestedClasses() { @Test void testSpecificTestInstancePostProcessorIsCalled() { executeTestsForClass(TestCaseWithTestSpecificTestInstancePostProcessor.class).testEvents()// - .assertStatistics(stats -> stats.started(1).succeeded(1)); + .assertStatistics(stats -> stats.started(2).succeeded(2)); + // @formatter:off assertThat(callSequence).containsExactly( - "fooPostProcessTestInstance:TestCaseWithTestSpecificTestInstancePostProcessor", "beforeEachMethod", "test"); + "foo:TestCaseWithTestSpecificTestInstancePostProcessor", + "legacy:TestCaseWithTestSpecificTestInstancePostProcessor", + "beforeEachMethod", + "test1", + "close:foo:TestCaseWithTestSpecificTestInstancePostProcessor", + "beforeEachMethod", + "test2", + "close:legacy:TestCaseWithTestSpecificTestInstancePostProcessor" + ); + // @formatter:on } // ------------------------------------------------------------------- @ExtendWith(FooInstancePostProcessor.class) + @ExtendWith(LegacyInstancePostProcessor.class) static class OuterTestCase implements Named { - private String outerName; + private final Map outerNames = new HashMap<>(); @Override - public void setName(String name) { - this.outerName = name; + public void setName(String source, String name) { + outerNames.put(source, name); } @BeforeEach @@ -90,7 +114,9 @@ void beforeOuterMethod() { @Test void testOuter() { - assertEquals("foo:" + OuterTestCase.class.getSimpleName(), outerName); + assertEquals( + Map.of("foo", OuterTestCase.class.getSimpleName(), "legacy", OuterTestCase.class.getSimpleName()), + outerNames); callSequence.add("testOuter"); } @@ -98,11 +124,11 @@ void testOuter() { @ExtendWith(BarInstancePostProcessor.class) class InnerTestCase implements Named { - private String innerName; + private final Map innerNames = new HashMap<>(); @Override - public void setName(String name) { - this.innerName = name; + public void setName(String source, String name) { + innerNames.put(source, name); } @BeforeEach @@ -112,8 +138,11 @@ void beforeInnerMethod() { @Test void testInner() { - assertEquals("foo:" + OuterTestCase.class.getSimpleName(), outerName); - assertEquals("bar:" + InnerTestCase.class.getSimpleName(), innerName); + assertEquals( + Map.of("foo", InnerTestCase.class.getSimpleName(), "legacy", OuterTestCase.class.getSimpleName()), + outerNames); + assertEquals(Map.of("foo", InnerTestCase.class.getSimpleName(), "bar", + InnerTestCase.class.getSimpleName(), "legacy", InnerTestCase.class.getSimpleName()), innerNames); callSequence.add("testInner"); } } @@ -122,11 +151,11 @@ void testInner() { static class TestCaseWithTestSpecificTestInstancePostProcessor implements Named { - private String name; + private final Map names = new HashMap<>(); @Override - public void setName(String name) { - this.name = name; + public void setName(String source, String name) { + names.put(source, name); } @BeforeEach @@ -135,38 +164,63 @@ void beforeEachMethod() { } @ExtendWith(FooInstancePostProcessor.class) + @ExtendWith(LegacyInstancePostProcessor.class) + @Test + void test1() { + callSequence.add("test1"); + assertEquals(Map.of("foo", getClass().getSimpleName(), "legacy", getClass().getSimpleName()), names); + } + @Test - void test() { - callSequence.add("test"); - assertEquals("foo:" + getClass().getSimpleName(), name); + void test2() { + callSequence.add("test2"); + assertEquals(Map.of(), names); } } - static class FooInstancePostProcessor implements TestInstancePostProcessor { + static abstract class AbstractInstancePostProcessor implements TestInstancePostProcessor { + private final String name; + + AbstractInstancePostProcessor(String name) { + this.name = name; + } @Override public void postProcessTestInstance(Object testInstance, ExtensionContext context) { if (testInstance instanceof Named) { - ((Named) testInstance).setName("foo:" + context.getRequiredTestClass().getSimpleName()); + ((Named) testInstance).setName(name, context.getRequiredTestClass().getSimpleName()); } - callSequence.add("fooPostProcessTestInstance:" + testInstance.getClass().getSimpleName()); + String instanceType = testInstance.getClass().getSimpleName(); + callSequence.add(name + ":" + instanceType); + context.getStore(ExtensionContext.Namespace.create(this)).put(new Object(), + (ExtensionContext.Store.CloseableResource) () -> callSequence.add( + "close:" + name + ":" + instanceType)); } } - static class BarInstancePostProcessor implements TestInstancePostProcessor { + @EnableTestScopedConstructorContext + static class FooInstancePostProcessor extends AbstractInstancePostProcessor { + FooInstancePostProcessor() { + super("foo"); + } + } - @Override - public void postProcessTestInstance(Object testInstance, ExtensionContext context) { - if (testInstance instanceof Named) { - ((Named) testInstance).setName("bar:" + context.getRequiredTestClass().getSimpleName()); - } - callSequence.add("barPostProcessTestInstance:" + testInstance.getClass().getSimpleName()); + @EnableTestScopedConstructorContext + static class BarInstancePostProcessor extends AbstractInstancePostProcessor { + BarInstancePostProcessor() { + super("bar"); + } + } + + static class LegacyInstancePostProcessor extends AbstractInstancePostProcessor { + LegacyInstancePostProcessor() { + super("legacy"); } } private interface Named { - void setName(String name); + void setName(String source, String name); } } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java index fdf323d21291..4da0833bd0d7 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java @@ -23,6 +23,7 @@ import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.extension.EnableTestScopedConstructorContext; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.RegisterExtension; @@ -59,12 +60,14 @@ void instancePreConstruct() { "beforeEach", "test1", "afterEach", + "close: name=foo, testClass=InstancePreConstructTestCase", "PreConstructCallback: name=foo, testClass=InstancePreConstructTestCase, outerInstance: null", "constructor", "beforeEach", "test2", "afterEach", + "close: name=foo, testClass=InstancePreConstructTestCase", "afterAll" ); @@ -86,6 +89,7 @@ void factoryPreConstruct() { "beforeEach", "test1", "afterEach", + "close: name=foo, testClass=FactoryPreConstructTestCase", "PreConstructCallback: name=foo, testClass=FactoryPreConstructTestCase, outerInstance: null", "testInstanceFactory", @@ -93,6 +97,7 @@ void factoryPreConstruct() { "beforeEach", "test2", "afterEach", + "close: name=foo, testClass=FactoryPreConstructTestCase", "afterAll" ); @@ -113,12 +118,14 @@ void preConstructInNested() { "beforeEach", "outerTest1", "afterEach", + "close: name=foo, testClass=PreConstructInNestedTestCase", "PreConstructCallback: name=foo, testClass=PreConstructInNestedTestCase, outerInstance: null", "constructor", "beforeEach", "outerTest2", "afterEach", + "close: name=foo, testClass=PreConstructInNestedTestCase", "PreConstructCallback: name=foo, testClass=PreConstructInNestedTestCase, outerInstance: null", "constructor", @@ -133,6 +140,11 @@ void preConstructInNested() { "afterEachInner", "afterEach", + "close: name=baz, testClass=InnerTestCase", + "close: name=bar, testClass=InnerTestCase", + "close: name=foo, testClass=InnerTestCase", + "close: name=foo, testClass=PreConstructInNestedTestCase", + "afterAll" ); // @formatter:on @@ -150,6 +162,7 @@ void preConstructOnMethod() { "beforeEach", "test1", "afterEach", + "close: name=foo, testClass=PreConstructOnMethod", "constructor", "beforeEach", @@ -172,7 +185,57 @@ void preConstructWithClassLifecycle() { "beforeEach", "test1", "beforeEach", - "test2" + "test2", + "close: name=bar, testClass=PreConstructWithClassLifecycle", + "close: name=foo, testClass=PreConstructWithClassLifecycle" + ); + // @formatter:on + } + + @Test + void legacyPreConstruct() { + executeTestsForClass(LegacyPreConstructTestCase.class).testEvents()// + .assertStatistics(stats -> stats.started(3).succeeded(3)); + + // @formatter:off + assertThat(callSequence).containsExactly( + "beforeAll", + + "PreConstructCallback: name=foo, testClass=LegacyPreConstructTestCase, outerInstance: null", + "PreConstructCallback: name=legacy, testClass=LegacyPreConstructTestCase, outerInstance: null", + "constructor", + "beforeEach", + "outerTest1", + "afterEach", + "close: name=foo, testClass=LegacyPreConstructTestCase", + + "PreConstructCallback: name=foo, testClass=LegacyPreConstructTestCase, outerInstance: null", + "PreConstructCallback: name=legacy, testClass=LegacyPreConstructTestCase, outerInstance: null", + "constructor", + "beforeEach", + "outerTest2", + "afterEach", + "close: name=foo, testClass=LegacyPreConstructTestCase", + + "PreConstructCallback: name=foo, testClass=LegacyPreConstructTestCase, outerInstance: null", + "PreConstructCallback: name=legacy, testClass=LegacyPreConstructTestCase, outerInstance: null", + "constructor", + "PreConstructCallback: name=foo, testClass=InnerTestCase, outerInstance: LegacyPreConstructTestCase", + "PreConstructCallback: name=legacy, testClass=InnerTestCase, outerInstance: LegacyPreConstructTestCase", + "constructorInner", + "beforeEach", + "beforeEachInner", + "innerTest1", + "afterEachInner", + "afterEach", + "close: name=foo, testClass=InnerTestCase", + "close: name=foo, testClass=LegacyPreConstructTestCase", + + "close: name=legacy, testClass=InnerTestCase", + "afterAll", + "close: name=legacy, testClass=LegacyPreConstructTestCase", + "close: name=legacy, testClass=LegacyPreConstructTestCase", + "close: name=legacy, testClass=LegacyPreConstructTestCase" ); // @formatter:on } @@ -393,6 +456,73 @@ void test2() { } } + @ExtendWith(InstancePreConstructCallbackRecordingFoo.class) + @ExtendWith(InstancePreConstructCallbackRecordingLegacy.class) + static class LegacyPreConstructTestCase extends CallSequenceRecordingTestCase { + + LegacyPreConstructTestCase() { + record("constructor"); + } + + @BeforeAll + static void beforeAll() { + record("beforeAll"); + } + + @BeforeEach + void beforeEach() { + record("beforeEach"); + } + + @Test + void outerTest1() { + record("outerTest1"); + } + + @Test + void outerTest2() { + record("outerTest2"); + } + + @AfterEach + void afterEach() { + record("afterEach"); + } + + @AfterAll + static void afterAll() { + record("afterAll"); + } + + @Override + public String toString() { + return "LegacyPreConstructTestCase"; + } + + @Nested + class InnerTestCase extends CallSequenceRecordingTestCase { + + InnerTestCase() { + record("constructorInner"); + } + + @BeforeEach + void beforeEachInner() { + record("beforeEachInner"); + } + + @Test + void innerTest1() { + record("innerTest1"); + } + + @AfterEach + void afterEachInner() { + record("afterEachInner"); + } + } + } + static abstract class AbstractTestInstancePreConstructCallback implements TestInstancePreConstructCallback { private final String name; @@ -404,29 +534,49 @@ static abstract class AbstractTestInstancePreConstructCallback implements TestIn public void preConstructTestInstance(TestInstanceFactoryContext factoryContext, ExtensionContext context) { assertThat(context.getTestInstance()).isNotPresent(); assertThat(context.getTestClass()).isPresent(); - assertThat(factoryContext.getTestClass()).isSameAs(context.getTestClass().get()); - callSequence.add( - "PreConstructCallback: name=" + name + ", testClass=" + factoryContext.getTestClass().getSimpleName() - + ", outerInstance: " + factoryContext.getOuterInstance().orElse(null)); + if (name.equals("legacy")) { + assertThat(factoryContext.getTestClass()).isSameAs(context.getTestClass().get()); + } + else if (context.getTestInstanceLifecycle().orElse(null) != TestInstance.Lifecycle.PER_CLASS) { + assertThat(context.getTestMethod()).isPresent(); + } + else { + assertThat(context.getTestMethod()).isEmpty(); + } + String testClass = factoryContext.getTestClass().getSimpleName(); + callSequence.add("PreConstructCallback: name=" + name + ", testClass=" + testClass + ", outerInstance: " + + factoryContext.getOuterInstance().orElse(null)); + context.getStore(ExtensionContext.Namespace.create(this)).put(new Object(), + (ExtensionContext.Store.CloseableResource) () -> callSequence.add( + "close: name=" + name + ", testClass=" + testClass)); } } + @EnableTestScopedConstructorContext static class InstancePreConstructCallbackRecordingFoo extends AbstractTestInstancePreConstructCallback { InstancePreConstructCallbackRecordingFoo() { super("foo"); } } + @EnableTestScopedConstructorContext static class InstancePreConstructCallbackRecordingBar extends AbstractTestInstancePreConstructCallback { InstancePreConstructCallbackRecordingBar() { super("bar"); } } + @EnableTestScopedConstructorContext static class InstancePreConstructCallbackRecordingBaz extends AbstractTestInstancePreConstructCallback { InstancePreConstructCallbackRecordingBaz() { super("baz"); } } + static class InstancePreConstructCallbackRecordingLegacy extends AbstractTestInstancePreConstructCallback { + InstancePreConstructCallbackRecordingLegacy() { + super("legacy"); + } + } + } From 1a35c56d99937dda58df0e91233c3901ef0fae18 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 8 Oct 2024 12:35:32 +0200 Subject: [PATCH 150/611] Hard-wrap at 90 characters --- .../docs/asciidoc/release-notes/release-notes-5.11.3.adoc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc index 98c2238e5025..63fb2973d97b 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc @@ -35,9 +35,8 @@ on GitHub. [[release-notes-5.11.3-junit-jupiter-bug-fixes]] ==== Bug Fixes -* Extensions can once again be registered via multiple `@ExtendWith` - meta-annotations on the same composed annotation on a field within a - test class. +* Extensions can once again be registered via multiple `@ExtendWith` meta-annotations on + the same composed annotation on a field within a test class. [[release-notes-5.11.3-junit-jupiter-deprecations-and-breaking-changes]] From aaac2b52f24bd7edd910aab68ba0cb3ac21486eb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 10:49:31 +0000 Subject: [PATCH 151/611] Update github/codeql-action digest to c36620d --- .github/workflows/codeql-analysis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 00d54cc3d2a5..f54d0da6f735 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -32,7 +32,7 @@ jobs: - name: Check out repository uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 - name: Initialize CodeQL - uses: github/codeql-action/init@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3 + uses: github/codeql-action/init@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3 with: languages: ${{ matrix.language }} tools: linked @@ -44,4 +44,4 @@ jobs: -Dscan.tag.CodeQL \ allMainClasses - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3 + uses: github/codeql-action/analyze@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3 From c906b662e3439fe32dcce6195542585de4a37c2e Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 8 Oct 2024 15:54:56 +0200 Subject: [PATCH 152/611] Add constructor injection support for `TempDir` (#4060) This was made possible by lifting the `ParameterResolver` limitation for accessing the test-scoped `ExtensionContext` for test class constructors in #3445. --- .../release-notes-5.12.0-M1.adoc | 1 + .../asciidoc/user-guide/writing-tests.adoc | 11 +- .../engine/extension/TempDirectory.java | 11 +- .../TempDirectoryPerContextTests.java | 108 +++++++++++++----- .../TempDirectoryPerDeclarationTests.java | 91 +++++++-------- 5 files changed, 127 insertions(+), 95 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 67393a8cd47b..08a328c14cd3 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -62,6 +62,7 @@ JUnit repository on GitHub. `ExtensionContext` while instantiating the test instance. The behavior enabled by the annotation is expected to eventually become the default in future versions of JUnit Jupiter. +* `@TempDir` is now supported on test class constructors. [[release-notes-5.12.0-M1-junit-vintage]] diff --git a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc index d8e7c351c401..ccb0f5344588 100644 --- a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc +++ b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc @@ -3003,7 +3003,8 @@ The built-in `{TempDirectory}` extension is used to create and clean up a tempor directory for an individual test or all tests in a test class. It is registered by default. To use it, annotate a non-final, unassigned field of type `java.nio.file.Path` or `java.io.File` with `{TempDir}` or add a parameter of type `java.nio.file.Path` or -`java.io.File` annotated with `@TempDir` to a lifecycle method or test method. +`java.io.File` annotated with `@TempDir` to a test class constructor, lifecycle method, or +test method. For example, the following test declares a parameter annotated with `@TempDir` for a single test method, creates and writes to a file in the temporary directory, and checks @@ -3028,14 +3029,10 @@ entire test class or method (depending on which level the annotation is used), y the `junit.jupiter.tempdir.scope` configuration parameter to `per_context`. However, please note that this option is deprecated and will be removed in a future release. -`@TempDir` is not supported on constructor parameters. If you wish to retain a single -reference to a temp directory across lifecycle methods and the current test method, please -use field injection by annotating an instance field with `@TempDir`. - The following example stores a _shared_ temporary directory in a `static` field. This allows the same `sharedTempDir` to be used in all lifecycle methods and test methods of -the test class. For better isolation, you should use an instance field so that each test -method uses a separate directory. +the test class. For better isolation, you should use an instance field or constructor +injection so that each test method uses a separate directory. [source,java,indent=0] .A test class that shares a temporary directory across test methods diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java index cf066e21a3ca..ff6484b960bb 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java @@ -22,7 +22,6 @@ import java.io.File; import java.io.IOException; import java.lang.reflect.AnnotatedElement; -import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Parameter; import java.nio.file.DirectoryNotEmptyException; @@ -45,12 +44,12 @@ import org.junit.jupiter.api.extension.AnnotatedElementContext; import org.junit.jupiter.api.extension.BeforeAllCallback; import org.junit.jupiter.api.extension.BeforeEachCallback; +import org.junit.jupiter.api.extension.EnableTestScopedConstructorContext; import org.junit.jupiter.api.extension.ExtensionConfigurationException; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ExtensionContext.Namespace; import org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource; import org.junit.jupiter.api.extension.ParameterContext; -import org.junit.jupiter.api.extension.ParameterResolutionException; import org.junit.jupiter.api.extension.ParameterResolver; import org.junit.jupiter.api.io.CleanupMode; import org.junit.jupiter.api.io.TempDir; @@ -78,6 +77,7 @@ * @see TempDir * @see Files#createTempDirectory */ +@EnableTestScopedConstructorContext class TempDirectory implements BeforeAllCallback, BeforeEachCallback, ParameterResolver { static final Namespace NAMESPACE = Namespace.create(TempDirectory.class); @@ -161,12 +161,7 @@ private void injectFields(ExtensionContext context, Object testInstance, Class stats.started(2).failed(0).succeeded(2)); + assertThat(BaseConstructorInjectionTestCase.tempDirs.getFirst()).doesNotExist(); + assertThat(BaseConstructorInjectionTestCase.tempDirs.getLast()).doesNotExist(); + } + private void assertSharedTempDirForFieldInjection( Class testClass) { @@ -296,6 +308,17 @@ void resolvesSeparateTempDirWhenAnnotationIsUsedOnAfterAllMethodParameterOnly() assertThat(AnnotationOnAfterAllMethodParameterTestCase.secondTempDir).isNotNull().doesNotExist(); } + @Test + @DisplayName("when @TempDir is used on constructor parameter") + @Order(32) + void resolvesSeparateTempDirsWhenAnnotationIsUsedOnConstructorWithTestInstancePerMethod() { + var results = executeTestsForClass(SeparateTempDirsConstructorInjectionPerMethodTestCase.class); + + results.testEvents().assertStatistics(stats -> stats.started(2).failed(0).succeeded(2)); + assertThat(BaseConstructorInjectionTestCase.tempDirs.getFirst()).doesNotExist(); + assertThat(BaseConstructorInjectionTestCase.tempDirs.getLast()).doesNotExist(); + } + } @Nested @@ -370,26 +393,6 @@ void onlySupportsParametersOfTypePathAndFile() { // @formatter:on } - @Test - @DisplayName("when @TempDir is used on constructor parameter") - @Order(30) - void doesNotSupportTempDirAnnotationOnConstructorParameter() { - var results = executeTestsForClass(AnnotationOnConstructorParameterTestCase.class); - - assertSingleFailedTest(results, ParameterResolutionException.class, - "@TempDir is not supported on constructor parameters. Please use field injection instead."); - } - - @Test - @DisplayName("when @TempDir is used on constructor parameter with @TestInstance(PER_CLASS)") - @Order(31) - void doesNotSupportTempDirAnnotationOnConstructorParameterWithTestInstancePerClass() { - var results = executeTestsForClass(AnnotationOnConstructorParameterWithTestInstancePerClassTestCase.class); - - assertSingleFailedContainer(results, ParameterResolutionException.class, - "@TempDir is not supported on constructor parameters. Please use field injection instead."); - } - @Test @DisplayName("when non-default @TempDir factory is set") @Order(32) @@ -693,26 +696,75 @@ static void check(Path tempDir) { } - static class AnnotationOnConstructorParameterTestCase { + static class BaseConstructorInjectionTestCase { - AnnotationOnConstructorParameterTestCase(@SuppressWarnings("unused") @TempDir Path tempDir) { - // never called + static final Deque tempDirs = new LinkedList<>(); + + private final Path tempDir; + + BaseConstructorInjectionTestCase(Path tempDir) { + this.tempDir = tempDir; } @Test - void test() { - // never called + void test1(@TempDir Path tempDir, TestInfo testInfo) throws Exception { + check(tempDir); + writeFile(tempDir, testInfo); + } + + @Test + void test2(TestInfo testInfo, @TempDir Path tempDir) throws Exception { + check(tempDir); + writeFile(tempDir, testInfo); + } + + @AfterEach + void afterEach(@TempDir Path tempDir) { + check(tempDir); + } + + void check(Path tempDir) { + assertThat(tempDirs.getLast())// + .isNotNull()// + .isSameAs(tempDir)// + .isSameAs(this.tempDir); + assertTrue(Files.exists(tempDir)); } } + static class SeparateTempDirsConstructorInjectionPerMethodTestCase extends BaseConstructorInjectionTestCase { + + SeparateTempDirsConstructorInjectionPerMethodTestCase(@TempDir Path tempDir) { + super(tempDir); + } + + @BeforeEach + void beforeEach(@TempDir Path tempDir) { + for (Path dir : tempDirs) { + assertThat(dir).doesNotExist(); + } + assertThat(tempDirs).doesNotContain(tempDir); + tempDirs.add(tempDir); + check(tempDir); + } + } + @TestInstance(PER_CLASS) - static class AnnotationOnConstructorParameterWithTestInstancePerClassTestCase - extends AnnotationOnConstructorParameterTestCase { + static class SharedTempDirsConstructorInjectionPerClassTestCase extends BaseConstructorInjectionTestCase { - AnnotationOnConstructorParameterWithTestInstancePerClassTestCase(@TempDir Path tempDir) { + SharedTempDirsConstructorInjectionPerClassTestCase(@TempDir Path tempDir) { super(tempDir); } + + @BeforeEach + void beforeEach(@TempDir Path tempDir) { + for (Path dir : tempDirs) { + assertThat(dir).isSameAs(tempDir).exists(); + } + tempDirs.add(tempDir); + check(tempDir); + } } static class NonDefaultFactoryTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerDeclarationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerDeclarationTests.java index cfd8fbc452af..33ba07a362d4 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerDeclarationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerDeclarationTests.java @@ -15,6 +15,7 @@ import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.RetentionPolicy.RUNTIME; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNotSame; @@ -22,7 +23,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assumptions.assumeTrue; -import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; import static org.junit.platform.testkit.engine.EventConditions.finishedWithFailure; @@ -123,25 +123,37 @@ void resolvesSeparateTempDirsForEachAnnotationDeclaration(TestInstance.Lifecycle assertThat(AllPossibleDeclarationLocationsTestCase.tempDirs).hasSize(3); var classTempDirs = AllPossibleDeclarationLocationsTestCase.tempDirs.get("class"); - assertThat(classTempDirs).containsOnlyKeys("staticField1", "staticField2", "beforeAll1", "beforeAll2", - "afterAll1", "afterAll2"); - assertThat(classTempDirs.values()).hasSize(6).doesNotHaveDuplicates(); + assertThat(classTempDirs) // + .containsOnlyKeys("staticField1", "staticField2", "beforeAll1", "beforeAll2", "afterAll1", "afterAll2") // + .values().hasSize(6).doesNotHaveDuplicates().allMatch(Files::notExists); var testATempDirs = AllPossibleDeclarationLocationsTestCase.tempDirs.get("testA"); - assertThat(testATempDirs).containsOnlyKeys("staticField1", "staticField2", "instanceField1", "instanceField2", - "beforeEach1", "beforeEach2", "test1", "test2", "afterEach1", "afterEach2"); - assertThat(testATempDirs.values()).hasSize(10).doesNotHaveDuplicates(); + assertThat(testATempDirs) // + .containsOnlyKeys("staticField1", "staticField2", "instanceFieldSetViaConstructorInjection", + "instanceField1", "instanceField2", "beforeEach1", "beforeEach2", "test1", "test2", "afterEach1", + "afterEach2") // + .values().hasSize(11).doesNotHaveDuplicates().allMatch(Files::notExists); var testBTempDirs = AllPossibleDeclarationLocationsTestCase.tempDirs.get("testB"); - assertThat(testBTempDirs).containsOnlyKeys("staticField1", "staticField2", "instanceField1", "instanceField2", - "beforeEach1", "beforeEach2", "test1", "test2", "afterEach1", "afterEach2"); - assertThat(testBTempDirs.values()).hasSize(10).doesNotHaveDuplicates(); + assertThat(testBTempDirs) // + .containsOnlyKeys("staticField1", "staticField2", "instanceFieldSetViaConstructorInjection", + "instanceField1", "instanceField2", "beforeEach1", "beforeEach2", "test1", "test2", "afterEach1", + "afterEach2") // + .values().hasSize(11).doesNotHaveDuplicates().allMatch(Files::notExists); assertThat(testATempDirs).containsEntry("staticField1", classTempDirs.get("staticField1")); assertThat(testBTempDirs).containsEntry("staticField1", classTempDirs.get("staticField1")); assertThat(testATempDirs).containsEntry("staticField2", classTempDirs.get("staticField2")); assertThat(testBTempDirs).containsEntry("staticField2", classTempDirs.get("staticField2")); + switch (lifecycle) { + case PER_CLASS -> assertThat(testATempDirs) // + .containsEntry("instanceFieldSetViaConstructorInjection", + testBTempDirs.get("instanceFieldSetViaConstructorInjection")); + case PER_METHOD -> assertThat(testATempDirs) // + .doesNotContainEntry("instanceFieldSetViaConstructorInjection", + testBTempDirs.get("instanceFieldSetViaConstructorInjection")); + } assertThat(testATempDirs).doesNotContainEntry("instanceField1", testBTempDirs.get("instanceField1")); assertThat(testATempDirs).doesNotContainEntry("instanceField2", testBTempDirs.get("instanceField2")); assertThat(testATempDirs).doesNotContainEntry("beforeEach1", testBTempDirs.get("beforeEach1")); @@ -278,26 +290,6 @@ void onlySupportsParametersOfTypePathAndFile() { // @formatter:on } - @Test - @DisplayName("when @TempDir is used on constructor parameter") - @Order(30) - void doesNotSupportTempDirAnnotationOnConstructorParameter() { - var results = executeTestsForClass(AnnotationOnConstructorParameterTestCase.class); - - assertSingleFailedTest(results, ParameterResolutionException.class, - "@TempDir is not supported on constructor parameters. Please use field injection instead."); - } - - @Test - @DisplayName("when @TempDir is used on constructor parameter with @TestInstance(PER_CLASS)") - @Order(31) - void doesNotSupportTempDirAnnotationOnConstructorParameterWithTestInstancePerClass() { - var results = executeTestsForClass(AnnotationOnConstructorParameterWithTestInstancePerClassTestCase.class); - - assertSingleFailedContainer(results, ParameterResolutionException.class, - "@TempDir is not supported on constructor parameters. Please use field injection instead."); - } - @Test @DisplayName("when @TempDir factory does not return directory") @Order(32) @@ -574,28 +566,6 @@ void test1() { } - static class AnnotationOnConstructorParameterTestCase { - - AnnotationOnConstructorParameterTestCase(@SuppressWarnings("unused") @TempDir Path tempDir) { - // never called - } - - @Test - void test() { - // never called - } - - } - - @TestInstance(PER_CLASS) - static class AnnotationOnConstructorParameterWithTestInstancePerClassTestCase - extends AnnotationOnConstructorParameterTestCase { - - AnnotationOnConstructorParameterWithTestInstancePerClassTestCase(@TempDir Path tempDir) { - super(tempDir); - } - } - static class InvalidTestCase { @Test @@ -1148,6 +1118,8 @@ static class AllPossibleDeclarationLocationsTestCase { @TempDir static Path staticField2; + final Path instanceFieldSetViaConstructorInjection; + @TempDir Path instanceField1; @@ -1162,6 +1134,11 @@ static void beforeAll(@TempDir Path param1, @TempDir Path param2, TestInfo testI "beforeAll1", param1, // "beforeAll2", param2 // )); + assertAllTempDirsExist(testInfo); + } + + AllPossibleDeclarationLocationsTestCase(@TempDir Path tempDir) { + this.instanceFieldSetViaConstructorInjection = tempDir; } @BeforeEach @@ -1169,11 +1146,13 @@ void beforeEach(@TempDir Path param1, @TempDir Path param2, TestInfo testInfo) { getTempDirs(testInfo).putAll(Map.of( // "staticField1", staticField1, // "staticField2", staticField2, // + "instanceFieldSetViaConstructorInjection", instanceFieldSetViaConstructorInjection, // "instanceField1", instanceField1, // "instanceField2", instanceField2, // "beforeEach1", param1, // "beforeEach2", param2 // )); + assertAllTempDirsExist(testInfo); } @Test @@ -1183,6 +1162,7 @@ void testA(@TempDir Path param1, @TempDir Path param2, TestInfo testInfo) { "test1", param1, // "test2", param2 // )); + assertAllTempDirsExist(testInfo); } @Test @@ -1192,6 +1172,7 @@ void testB(@TempDir Path param1, @TempDir Path param2, TestInfo testInfo) { "test1", param1, // "test2", param2 // )); + assertAllTempDirsExist(testInfo); } @AfterEach @@ -1200,6 +1181,7 @@ void afterEach(@TempDir Path param1, @TempDir Path param2, TestInfo testInfo) { "afterEach1", param1, // "afterEach2", param2 // )); + assertAllTempDirsExist(testInfo); } @AfterAll @@ -1208,11 +1190,16 @@ static void afterAll(@TempDir Path param1, @TempDir Path param2, TestInfo testIn "afterAll1", param1, // "afterAll2", param2 // )); + assertAllTempDirsExist(testInfo); } private static Map getTempDirs(TestInfo testInfo) { return tempDirs.computeIfAbsent(testInfo.getDisplayName(), __ -> new LinkedHashMap<>()); } + + private static void assertAllTempDirsExist(TestInfo testInfo) { + assertAll(getTempDirs(testInfo).values().stream().map(tempDir -> () -> assertTrue(Files.exists(tempDir)))); + } } static class UndeletableTestCase { From 60e567e30ee404cb2d60ffffad5e1f9498f38954 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 22:45:19 +0000 Subject: [PATCH 153/611] Update dependency gg.jte:jte to v3.1.13 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 21331cdf8fc0..4ddf318717fb 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -45,7 +45,7 @@ jimfs = { module = "com.google.jimfs:jimfs", version = "1.3.0" } jmh-core = { module = "org.openjdk.jmh:jmh-core", version.ref = "jmh" } jmh-generator-annprocess = { module = "org.openjdk.jmh:jmh-generator-annprocess", version.ref = "jmh" } joox = { module = "org.jooq:joox", version = "2.0.1" } -jte = { module = "gg.jte:jte", version = "3.1.12" } +jte = { module = "gg.jte:jte", version = "3.1.13" } junit4 = { module = "junit:junit", version = { require = "[4.12,)", prefer = "4.13.2" } } kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.9.0" } log4j-core = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j" } From 3301075b8aa4eb47fdefb517ce86d4203ebfdbfc Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 9 Oct 2024 11:06:27 +0200 Subject: [PATCH 154/611] Fix typos --- .../src/main/java/org/junit/jupiter/api/Timeout.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Timeout.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Timeout.java index 831fb2963686..313e7f2ef87d 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Timeout.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Timeout.java @@ -358,8 +358,8 @@ ThreadMode threadMode() default ThreadMode.INFERRED; /** - * {@code ThreadMode} is use to define whether the test code should be executed in the thread - * of the calling code or in a separated thread. + * {@code ThreadMode} is used to define whether test code should be executed + * in the thread of the calling code or in a separate thread. * * @since 5.9 */ From 8a96d2b2ea02a83e9751b009bd0801d94f7a0f2b Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 9 Oct 2024 11:10:45 +0200 Subject: [PATCH 155/611] Use `Stream.toList()` instead of `Collector.toList()` in tests --- .../AbstractExecutionConditionTests.java | 5 ++--- .../extension/ExtensionComposabilityTests.java | 15 ++++++++------- .../descriptor/JupiterTestDescriptorTests.java | 3 +-- .../descriptor/LifecycleMethodUtilsTests.java | 3 +-- .../discovery/DiscoverySelectorResolverTests.java | 3 +-- .../commons/util/AnnotationUtilsTests.java | 8 +++----- .../commons/util/CollectionUtilsTests.java | 3 +-- .../commons/util/ReflectionUtilsTests.java | 3 +-- .../ParallelExecutionIntegrationTests.java | 5 ++--- .../LauncherDiscoveryRequestBuilderTests.java | 9 ++++----- .../launcher/core/LauncherFactoryTests.java | 5 ++--- .../launcher/tagexpression/TokenizerTests.java | 3 +-- 12 files changed, 27 insertions(+), 38 deletions(-) diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/AbstractExecutionConditionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/AbstractExecutionConditionTests.java index 281332e7a0d1..d57298ec576c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/AbstractExecutionConditionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/AbstractExecutionConditionTests.java @@ -10,7 +10,6 @@ package org.junit.jupiter.api.condition; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -61,10 +60,10 @@ void ensureAllTestMethodsAreCovered() { Predicate isTestMethod = method -> method.isAnnotationPresent(Test.class); List methodsToTest = findMethods(getTestClass(), isTestMethod, TOP_DOWN).stream()// - .map(Method::getName).sorted().collect(toList()); + .map(Method::getName).sorted().toList(); List localTestMethods = findMethods(getClass(), isTestMethod, TOP_DOWN).stream()// - .map(Method::getName).sorted().collect(toList()); + .map(Method::getName).sorted().toList(); assertThat(localTestMethods).isEqualTo(methodsToTest); } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExtensionComposabilityTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExtensionComposabilityTests.java index bf909c77c332..b624bed90df4 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExtensionComposabilityTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExtensionComposabilityTests.java @@ -11,7 +11,7 @@ package org.junit.jupiter.api.extension; import static java.util.function.Predicate.not; -import static java.util.stream.Collectors.toList; +import static java.util.stream.Collectors.toCollection; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -22,6 +22,7 @@ import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.lang.reflect.Proxy; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Stream; @@ -60,18 +61,18 @@ void ensureJupiterExtensionApisAreComposable() { .flatMap(Arrays::stream) .filter(not(Method::isSynthetic)) .filter(not(where(Method::getModifiers, Modifier::isStatic))) - .collect(toList()); + .toList(); List expectedMethodSignatures = expectedMethods.stream() .map(this::methodSignature) .sorted() - .collect(toList()); + .toList(); List expectedMethodNames = expectedMethods.stream() .map(Method::getName) .distinct() .sorted() - .collect(toList()); + .toList(); // @formatter:on // 3) Dynamically implement all Extension APIs @@ -83,19 +84,19 @@ void ensureJupiterExtensionApisAreComposable() { // @formatter:off List actualMethods = Arrays.stream(dynamicKitchenSinkExtension.getClass().getDeclaredMethods()) .filter(ModifierSupport::isNotStatic) - .collect(toList()); + .toList(); List actualMethodSignatures = actualMethods.stream() .map(this::methodSignature) .distinct() .sorted() - .collect(toList()); + .collect(toCollection(ArrayList::new)); List actualMethodNames = actualMethods.stream() .map(Method::getName) .distinct() .sorted() - .collect(toList()); + .collect(toCollection(ArrayList::new)); // @formatter:on // 5) Remove methods from java.lang.Object diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptorTests.java index b81a9f658514..b96a1d3b5bf9 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptorTests.java @@ -10,7 +10,6 @@ package org.junit.jupiter.engine.descriptor; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; @@ -135,7 +134,7 @@ void constructFromMethodWithAnnotations() throws Exception { assertEquals("custom test name", methodDescriptor.getDisplayName(), "display name:"); assertEquals("foo()", methodDescriptor.getLegacyReportingName(), "legacy name:"); - List tags = methodDescriptor.getTags().stream().map(TestTag::getName).collect(toList()); + List tags = methodDescriptor.getTags().stream().map(TestTag::getName).toList(); assertThat(tags).containsExactlyInAnyOrder("inherited-class-level-tag", "classTag1", "classTag2", "methodTag1", "methodTag2"); } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtilsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtilsTests.java index 85a8fed7160b..8ac3a007347a 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtilsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtilsTests.java @@ -10,7 +10,6 @@ package org.junit.jupiter.engine.descriptor; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -131,7 +130,7 @@ void findAfterAllMethodsWithLifeCyclePerClassAndRequiringStatic() { } private static List namesOf(List methods) { - return methods.stream().map(Method::getName).collect(toList()); + return methods.stream().map(Method::getName).toList(); } } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolverTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolverTests.java index 5347a3609388..4f2fb79dbf24 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolverTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolverTests.java @@ -11,7 +11,6 @@ package org.junit.jupiter.engine.discovery; import static java.util.Collections.singleton; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertSame; @@ -759,7 +758,7 @@ private TestDescriptor descriptorByUniqueId(UniqueId uniqueId) { } private List uniqueIds() { - return engineDescriptor.getDescendants().stream().map(TestDescriptor::getUniqueId).collect(toList()); + return engineDescriptor.getDescendants().stream().map(TestDescriptor::getUniqueId).toList(); } private LauncherDiscoveryRequestBuilder request() { diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/AnnotationUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/AnnotationUtilsTests.java index db22575efaa3..4b921b1920e0 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/AnnotationUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/AnnotationUtilsTests.java @@ -10,7 +10,6 @@ package org.junit.platform.commons.util; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -273,8 +272,7 @@ void findRepeatableAnnotationsWithComposedTagBeforeContainer() { } private void assertTagsFound(Class clazz, String... tags) { - assertEquals(List.of(tags), - findRepeatableAnnotations(clazz, Tag.class).stream().map(Tag::value).collect(toList()), + assertEquals(List.of(tags), findRepeatableAnnotations(clazz, Tag.class).stream().map(Tag::value).toList(), () -> "Tags found for class " + clazz.getName()); } @@ -332,7 +330,7 @@ void findInheritedRepeatableAnnotationsWithMultipleComposedAnnotationsOnSupercla private void assertExtensionsFound(Class clazz, String... tags) { assertEquals(List.of(tags), - findRepeatableAnnotations(clazz, ExtendWith.class).stream().map(ExtendWith::value).collect(toList()), + findRepeatableAnnotations(clazz, ExtendWith.class).stream().map(ExtendWith::value).toList(), () -> "Extensions found for class " + clazz.getName()); } @@ -610,7 +608,7 @@ void findPublicAnnotatedFieldsForDirectlyAnnotatedFieldsInClassAndInterface() { } private List asNames(List fields) { - return fields.stream().map(Field::getName).collect(toList()); + return fields.stream().map(Field::getName).toList(); } // ------------------------------------------------------------------------- diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/CollectionUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/CollectionUtilsTests.java index ddc08e339f93..d3b34205e6c3 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/CollectionUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/CollectionUtilsTests.java @@ -10,7 +10,6 @@ package org.junit.platform.commons.util; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertSame; @@ -260,7 +259,7 @@ public Stream stream() { }; try (var stream = (Stream) CollectionUtils.toStream(input)) { - var result = stream.collect(toList()); + var result = stream.toList(); assertThat(result).containsExactly("foo", "bar"); } diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java index 843b07a85ab1..5f4cd8f1d431 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java @@ -13,7 +13,6 @@ import static java.time.Duration.ofMillis; import static java.util.Arrays.stream; import static java.util.stream.Collectors.joining; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -1645,7 +1644,7 @@ private static List signaturesOf(List methods) { // @formatter:off return methods.stream() .map(m -> String.format("%s(%s)", m.getName(), ClassUtils.nullSafeToString(m.getParameterTypes()))) - .collect(toList()); + .toList(); // @formatter:on } diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionIntegrationTests.java index 4634c4c94f57..156ea60dad6e 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionIntegrationTests.java @@ -11,7 +11,6 @@ package org.junit.platform.engine.support.hierarchical; import static java.util.concurrent.TimeUnit.MILLISECONDS; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -522,7 +521,7 @@ void b() throws Exception { private List getEventsOfChildren(EngineExecutionResults results, TestDescriptor container) { return results.testEvents().filter( - event -> event.getTestDescriptor().getParent().orElseThrow().equals(container)).collect(toList()); + event -> event.getTestDescriptor().getParent().orElseThrow().equals(container)).toList(); } private TestDescriptor findFirstTestDescriptor(EngineExecutionResults results, Condition condition) { @@ -534,7 +533,7 @@ private List getTimestampsFor(List events, Condition cond return events.stream() .filter(condition::matches) .map(Event::getTimestamp) - .collect(toList()); + .toList(); // @formatter:on } diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilderTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilderTests.java index 3ec50bc52dc0..7bd1fc8f5d31 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilderTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilderTests.java @@ -10,7 +10,6 @@ package org.junit.platform.launcher.core; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -64,7 +63,7 @@ void modulesAreStoredInDiscoveryRequest() { // @formatter:on var packageSelectors = discoveryRequest.getSelectorsByType(ModuleSelector.class).stream().map( - ModuleSelector::getModuleName).collect(toList()); + ModuleSelector::getModuleName).toList(); assertThat(packageSelectors).contains("java.base"); } @@ -78,7 +77,7 @@ void packagesAreStoredInDiscoveryRequest() { // @formatter:on var packageSelectors = discoveryRequest.getSelectorsByType(PackageSelector.class).stream().map( - PackageSelector::getPackageName).collect(toList()); + PackageSelector::getPackageName).toList(); assertThat(packageSelectors).contains("org.junit.platform.engine"); } @@ -94,7 +93,7 @@ void classesAreStoredInDiscoveryRequest() { // @formatter:on List> classes = discoveryRequest.getSelectorsByType(ClassSelector.class).stream().map( - ClassSelector::getJavaClass).collect(toList()); + ClassSelector::getJavaClass).toList(); assertThat(classes).contains(SampleTestClass.class, LauncherDiscoveryRequestBuilderTests.class); } @@ -167,7 +166,7 @@ void uniqueIdsAreStoredInDiscoveryRequest() { // @formatter:on var uniqueIds = discoveryRequest.getSelectorsByType(UniqueIdSelector.class).stream().map( - UniqueIdSelector::getUniqueId).map(Object::toString).collect(toList()); + UniqueIdSelector::getUniqueId).map(Object::toString).toList(); assertThat(uniqueIds).contains(id1.toString(), id2.toString()); } diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherFactoryTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherFactoryTests.java index 69dba3c41872..e3831ab4e81e 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherFactoryTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherFactoryTests.java @@ -10,7 +10,6 @@ package org.junit.platform.launcher.core; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -112,7 +111,7 @@ void create() { // @formatter:off var ids = roots.stream() .map(TestIdentifier::getUniqueId) - .collect(toList()); + .toList(); // @formatter:on assertThat(ids).containsOnly("[engine:junit-vintage]", "[engine:junit-jupiter]", @@ -135,7 +134,7 @@ void createWithConfig() { // @formatter:off var ids = roots.stream() .map(TestIdentifier::getUniqueId) - .collect(toList()); + .toList(); // @formatter:on assertThat(ids).containsOnly("[engine:junit-jupiter]"); diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/TokenizerTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/TokenizerTests.java index e882fe92d908..e4651128c67b 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/TokenizerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/TokenizerTests.java @@ -10,7 +10,6 @@ package org.junit.platform.launcher.tagexpression; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import java.util.List; @@ -87,7 +86,7 @@ private Stream rawStringsExtractedFrom(String expression) { } private List tokenStringsExtractedFrom(String expression) { - return tokensExtractedFrom(expression).map(Token::string).collect(toList()); + return tokensExtractedFrom(expression).map(Token::string).toList(); } private Stream tokensExtractedFrom(String expression) { From eba399e73a75f0edcef6ee6f4b0ce03313134f36 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 9 Oct 2024 14:49:51 +0200 Subject: [PATCH 156/611] Add ArchUnit test for consistency of repeatable annotations Issues: #4059 and #4063 --- .../tooling/support/tests/ArchUnitTests.java | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java index ff32c0777736..deef517d9f3b 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java @@ -17,10 +17,13 @@ import static com.tngtech.archunit.core.domain.JavaClass.Predicates.resideInAPackage; import static com.tngtech.archunit.core.domain.JavaClass.Predicates.resideInAnyPackage; import static com.tngtech.archunit.core.domain.JavaClass.Predicates.simpleName; +import static com.tngtech.archunit.core.domain.JavaClass.Predicates.type; import static com.tngtech.archunit.core.domain.JavaModifier.PUBLIC; +import static com.tngtech.archunit.core.domain.properties.CanBeAnnotated.Predicates.annotatedWith; import static com.tngtech.archunit.core.domain.properties.HasModifiers.Predicates.modifier; import static com.tngtech.archunit.core.domain.properties.HasName.Predicates.name; import static com.tngtech.archunit.core.domain.properties.HasName.Predicates.nameContaining; +import static com.tngtech.archunit.core.domain.properties.HasName.Predicates.nameStartingWith; import static com.tngtech.archunit.lang.conditions.ArchPredicates.are; import static com.tngtech.archunit.lang.conditions.ArchPredicates.have; import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes; @@ -28,24 +31,36 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import static platform.tooling.support.Helper.loadJarFiles; +import java.lang.annotation.Annotation; +import java.lang.annotation.Repeatable; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; +import java.util.Arrays; import java.util.Set; +import java.util.function.BiPredicate; import java.util.stream.Collectors; +import com.tngtech.archunit.base.DescribedPredicate; +import com.tngtech.archunit.core.domain.JavaClass; import com.tngtech.archunit.core.domain.JavaClasses; import com.tngtech.archunit.core.importer.Location; import com.tngtech.archunit.junit.AnalyzeClasses; import com.tngtech.archunit.junit.ArchTest; import com.tngtech.archunit.junit.LocationProvider; +import com.tngtech.archunit.lang.ArchCondition; import com.tngtech.archunit.lang.ArchRule; import com.tngtech.archunit.library.GeneralCodingRules; import org.apiguardian.api.API; import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.params.provider.ArgumentsSource; @Order(Integer.MAX_VALUE) @AnalyzeClasses(locations = ArchUnitTests.AllJars.class) class ArchUnitTests { + @SuppressWarnings("unused") @ArchTest private final ArchRule allPublicTopLevelTypesHaveApiAnnotations = classes() // .that(have(modifier(PUBLIC))) // @@ -55,6 +70,17 @@ class ArchUnitTests { .and(not(describe("are shadowed", resideInAnyPackage("..shadow..")))) // .should().beAnnotatedWith(API.class); + @SuppressWarnings("unused") + @ArchTest // Consistency of @Documented and @Inherited is checked by the compiler but not for @Retention and @Target + private final ArchRule repeatableAnnotationsShouldHaveMatchingContainerAnnotations = classes() // + .that(nameStartingWith("org.junit.")) // + .and().areAnnotations() // + .and().areAnnotatedWith(Repeatable.class) // + .and(are(not(type(ExtendWith.class)))) // to be resolved in https://github.com/junit-team/junit5/issues/4059 + .and(are(not(type(ArgumentsSource.class).or(annotatedWith(ArgumentsSource.class))))) // to be resolved in https://github.com/junit-team/junit5/issues/4063 + .should(haveContainerAnnotationWithSameRetentionPolicy()) // + .andShould(haveContainerAnnotationWithSameTargetTypes()); + @ArchTest void allAreIn(JavaClasses classes) { // about 928 classes found in all jars @@ -94,6 +120,16 @@ void avoidAccessingStandardStreams(JavaClasses classes) { GeneralCodingRules.NO_CLASSES_SHOULD_ACCESS_STANDARD_STREAMS.check(subset); } + private static ArchCondition haveContainerAnnotationWithSameRetentionPolicy() { + return ArchCondition.from(new RepeatableAnnotationPredicate<>(Retention.class, + (expectedTarget, actualTarget) -> expectedTarget.value() == actualTarget.value())); + } + + private static ArchCondition haveContainerAnnotationWithSameTargetTypes() { + return ArchCondition.from(new RepeatableAnnotationPredicate<>(Target.class, + (expectedTarget, actualTarget) -> Arrays.equals(expectedTarget.value(), actualTarget.value()))); + } + static class AllJars implements LocationProvider { @Override @@ -103,4 +139,27 @@ public Set get(Class testClass) { } + private static class RepeatableAnnotationPredicate extends DescribedPredicate { + + private final Class annotationType; + private final BiPredicate predicate; + + public RepeatableAnnotationPredicate(Class annotationType, BiPredicate predicate) { + super("have identical @%s annotation as container annotation", annotationType.getSimpleName()); + this.annotationType = annotationType; + this.predicate = predicate; + } + + @Override + public boolean test(JavaClass annotationClass) { + var containerAnnotationClass = (JavaClass) annotationClass.getAnnotationOfType( + Repeatable.class.getName()).get("value").orElseThrow(); + var expectedAnnotation = annotationClass.tryGetAnnotationOfType(annotationType); + var actualAnnotation = containerAnnotationClass.tryGetAnnotationOfType(annotationType); + return expectedAnnotation.map(expectedTarget -> actualAnnotation // + .map(actualTarget -> predicate.test(expectedTarget, actualTarget)) // + .orElse(false)) // + .orElse(actualAnnotation.isEmpty()); + } + } } From 4ff42a7069c58c6fa7d481283cef30266440645e Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 9 Oct 2024 16:52:43 +0200 Subject: [PATCH 157/611] =?UTF-8?q?Allow=20repeating=20`@=E2=80=A6Source`?= =?UTF-8?q?=20annotations=20when=20used=20as=20meta=20annotations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #4063. --- .../release-notes/release-notes-5.11.3.adoc | 2 + .../params/provider/ArgumentsSources.java | 2 +- .../params/provider/CsvFileSources.java | 2 +- .../jupiter/params/provider/CsvSources.java | 2 +- .../jupiter/params/provider/EnumSources.java | 2 +- .../jupiter/params/provider/FieldSources.java | 2 +- .../params/provider/MethodSources.java | 2 +- .../jupiter/params/provider/ValueSources.java | 2 +- .../ParameterizedTestIntegrationTests.java | 140 +++++++++++++++--- .../tooling/support/tests/ArchUnitTests.java | 3 - 10 files changed, 125 insertions(+), 34 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc index 63fb2973d97b..c8ed02a67ceb 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc @@ -37,6 +37,8 @@ on GitHub. * Extensions can once again be registered via multiple `@ExtendWith` meta-annotations on the same composed annotation on a field within a test class. +* All `@...Source` annotations of parameterized tests can now also be repeated when used + as meta annotations. [[release-notes-5.11.3-junit-jupiter-deprecations-and-breaking-changes]] diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsSources.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsSources.java index a5673bae9d87..ea7dd0494da6 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsSources.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsSources.java @@ -31,7 +31,7 @@ * @since 5.0 * @see org.junit.jupiter.params.provider.ArgumentsSource */ -@Target(ElementType.METHOD) +@Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) @Documented @API(status = STABLE, since = "5.7") diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvFileSources.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvFileSources.java index bc6bf3503fc9..92928d0ff715 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvFileSources.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvFileSources.java @@ -32,7 +32,7 @@ * @see CsvFileSource * @see java.lang.annotation.Repeatable */ -@Target(ElementType.METHOD) +@Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) @Documented @API(status = STABLE, since = "5.11") diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvSources.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvSources.java index 6c6951a75beb..297a4a8ddda5 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvSources.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvSources.java @@ -32,7 +32,7 @@ * @see CsvSource * @see java.lang.annotation.Repeatable */ -@Target(ElementType.METHOD) +@Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) @Documented @API(status = STABLE, since = "5.11") diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumSources.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumSources.java index 22feb5aa46d6..6b1a30a68ed5 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumSources.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumSources.java @@ -32,7 +32,7 @@ * @see EnumSource * @see java.lang.annotation.Repeatable */ -@Target(ElementType.METHOD) +@Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) @Documented @API(status = STABLE, since = "5.11") diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/FieldSources.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/FieldSources.java index 0b46746db5e4..36e9cd57d604 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/FieldSources.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/FieldSources.java @@ -32,7 +32,7 @@ * @see FieldSource * @see java.lang.annotation.Repeatable */ -@Target(ElementType.METHOD) +@Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) @Documented @API(status = EXPERIMENTAL, since = "5.11") diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/MethodSources.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/MethodSources.java index 056453f29820..33fa077567ee 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/MethodSources.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/MethodSources.java @@ -32,7 +32,7 @@ * @see MethodSource * @see java.lang.annotation.Repeatable */ -@Target(ElementType.METHOD) +@Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) @Documented @API(status = STABLE, since = "5.11") diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ValueSources.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ValueSources.java index 8db4dcc5b01f..9b3a489c6a66 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ValueSources.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ValueSources.java @@ -32,7 +32,7 @@ * @see ValueSource * @see java.lang.annotation.Repeatable */ -@Target(ElementType.METHOD) +@Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) @Documented @API(status = STABLE, since = "5.11") diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java index 4ff8ba90e1e5..56418a7a84f9 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java @@ -10,6 +10,7 @@ package org.junit.jupiter.params; +import static java.lang.annotation.RetentionPolicy.RUNTIME; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.within; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -40,7 +41,6 @@ import java.lang.annotation.ElementType; import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.lang.reflect.Constructor; import java.util.ArrayList; @@ -1096,9 +1096,10 @@ private EngineExecutionResults execute(String methodName, Class... methodPara @Nested class RepeatableSourcesIntegrationTests { - @Test - void executesWithRepeatableCsvFileSource() { - var results = execute("testWithRepeatableCsvFileSource", String.class, String.class); + @ParameterizedTest + @ValueSource(strings = { "testWithRepeatableCsvFileSource", "testWithRepeatableCsvFileSourceAsMetaAnnotation" }) + void executesWithRepeatableCsvFileSource(String methodName) { + var results = execute(methodName, String.class, String.class); results.allEvents().assertThatEvents() // .haveExactly(1, event(test(), displayName("[1] column1=foo, column2=1"), finishedWithFailure(message("foo 1")))) // @@ -1106,17 +1107,19 @@ void executesWithRepeatableCsvFileSource() { finishedWithFailure(message("apple 1")))); } - @Test - void executesWithRepeatableCsvSource() { - var results = execute("testWithRepeatableCsvSource", String.class); + @ParameterizedTest + @ValueSource(strings = { "testWithRepeatableCsvSource", "testWithRepeatableCsvSourceAsMetaAnnotation" }) + void executesWithRepeatableCsvSource(String methodName) { + var results = execute(methodName, String.class); results.allEvents().assertThatEvents() // .haveExactly(1, event(test(), displayName("[1] argument=a"), finishedWithFailure(message("a")))) // .haveExactly(1, event(test(), displayName("[2] argument=b"), finishedWithFailure(message("b")))); } - @Test - void executesWithRepeatableMethodSource() { - var results = execute("testWithRepeatableMethodSource", String.class); + @ParameterizedTest + @ValueSource(strings = { "testWithRepeatableMethodSource", "testWithRepeatableMethodSourceAsMetaAnnotation" }) + void executesWithRepeatableMethodSource(String methodName) { + var results = execute(methodName, String.class); results.allEvents().assertThatEvents() // .haveExactly(1, event(test(), displayName("[1] argument=some"), finishedWithFailure(message("some")))) // @@ -1124,27 +1127,30 @@ void executesWithRepeatableMethodSource() { event(test(), displayName("[2] argument=other"), finishedWithFailure(message("other")))); } - @Test - void executesWithRepeatableEnumSource() { - var results = execute("testWithRepeatableEnumSource", Action.class); + @ParameterizedTest + @ValueSource(strings = { "testWithRepeatableEnumSource", "testWithRepeatableEnumSourceAsMetaAnnotation" }) + void executesWithRepeatableEnumSource(String methodName) { + var results = execute(methodName, Action.class); results.allEvents().assertThatEvents() // .haveExactly(1, event(test(), displayName("[1] argument=FOO"), finishedWithFailure(message("FOO")))) // .haveExactly(1, event(test(), displayName("[2] argument=BAR"), finishedWithFailure(message("BAR")))); } - @Test - void executesWithRepeatableValueSource() { - var results = execute("testWithRepeatableValueSource", String.class); + @ParameterizedTest + @ValueSource(strings = { "testWithRepeatableValueSource", "testWithRepeatableValueSourceAsMetaAnnotation" }) + void executesWithRepeatableValueSource(String methodName) { + var results = execute(methodName, String.class); results.allEvents().assertThatEvents() // .haveExactly(1, event(test(), displayName("[1] argument=foo"), finishedWithFailure(message("foo")))) // .haveExactly(1, event(test(), displayName("[2] argument=bar"), finishedWithFailure(message("bar")))); } - @Test - void executesWithRepeatableFieldSource() { - var results = execute("testWithRepeatableFieldSource", String.class); + @ParameterizedTest + @ValueSource(strings = { "testWithRepeatableFieldSource", "testWithRepeatableFieldSourceAsMetaAnnotation" }) + void executesWithRepeatableFieldSource(String methodName) { + var results = execute(methodName, String.class); results.allEvents().assertThatEvents() // .haveExactly(1, event(test(), displayName("[1] argument=some"), finishedWithFailure(message("some")))) // @@ -1152,9 +1158,11 @@ void executesWithRepeatableFieldSource() { event(test(), displayName("[2] argument=other"), finishedWithFailure(message("other")))); } - @Test - void executesWithRepeatableArgumentsSource() { - var results = execute("testWithRepeatableArgumentsSource", String.class); + @ParameterizedTest + @ValueSource(strings = { "testWithRepeatableArgumentsSource", + "testWithRepeatableArgumentsSourceAsMetaAnnotation" }) + void executesWithRepeatableArgumentsSource(String methodName) { + var results = execute(methodName, String.class); results.allEvents().assertThatEvents() // .haveExactly(1, event(test(), displayName("[1] argument=foo"), finishedWithFailure(message("foo")))) // .haveExactly(1, event(test(), displayName("[2] argument=bar"), finishedWithFailure(message("bar")))) // @@ -1574,7 +1582,7 @@ void testWithNullAndEmptySourceForTwoDimensionalStringArray(String[][] argument) static class MethodSourceTestCase { @Target(ElementType.METHOD) - @Retention(RetentionPolicy.RUNTIME) + @Retention(RUNTIME) @ParameterizedTest(name = "{arguments}") @MethodSource @interface MethodSourceTest { @@ -1799,7 +1807,7 @@ private static Stream test() { static class FieldSourceTestCase { @Target(ElementType.METHOD) - @Retention(RetentionPolicy.RUNTIME) + @Retention(RUNTIME) @ParameterizedTest(name = "{arguments}") @FieldSource @interface FieldSourceTest { @@ -2067,6 +2075,18 @@ void testWithRepeatableCsvFileSource(String column1, String column2) { fail("%s %s".formatted(column1, column2)); } + @CsvFileSource(resources = "two-column.csv") + @CsvFileSource(resources = "two-column-with-headers.csv", delimiter = '|', useHeadersInDisplayName = true, nullValues = "NIL") + @Retention(RUNTIME) + @interface TwoCsvFileSources { + } + + @ParameterizedTest + @TwoCsvFileSources + void testWithRepeatableCsvFileSourceAsMetaAnnotation(String column1, String column2) { + fail("%s %s".formatted(column1, column2)); + } + @ParameterizedTest @CsvSource({ "a" }) @CsvSource({ "b" }) @@ -2074,6 +2094,18 @@ void testWithRepeatableCsvSource(String argument) { fail(argument); } + @CsvSource({ "a" }) + @CsvSource({ "b" }) + @Retention(RUNTIME) + @interface TwoCsvSources { + } + + @ParameterizedTest + @TwoCsvSources + void testWithRepeatableCsvSourceAsMetaAnnotation(String argument) { + fail(argument); + } + @ParameterizedTest @EnumSource(SmartAction.class) @EnumSource(QuickAction.class) @@ -2081,6 +2113,18 @@ void testWithRepeatableEnumSource(Action argument) { fail(argument.toString()); } + @EnumSource(SmartAction.class) + @EnumSource(QuickAction.class) + @Retention(RUNTIME) + @interface TwoEnumSources { + } + + @ParameterizedTest + @TwoEnumSources + void testWithRepeatableEnumSourceAsMetaAnnotation(Action argument) { + fail(argument.toString()); + } + interface Action { } @@ -2099,6 +2143,18 @@ void testWithRepeatableMethodSource(String argument) { fail(argument); } + @MethodSource("someArgumentsMethodSource") + @MethodSource("otherArgumentsMethodSource") + @Retention(RUNTIME) + @interface TwoMethodSources { + } + + @ParameterizedTest + @TwoMethodSources + void testWithRepeatableMethodSourceAsMetaAnnotation(String argument) { + fail(argument); + } + public static Stream someArgumentsMethodSource() { return Stream.of(Arguments.of("some")); } @@ -2114,6 +2170,18 @@ void testWithRepeatableFieldSource(String argument) { fail(argument); } + @FieldSource("someArgumentsContainer") + @FieldSource("otherArgumentsContainer") + @Retention(RUNTIME) + @interface TwoFieldSources { + } + + @ParameterizedTest + @TwoFieldSources + void testWithRepeatableFieldSourceAsMetaAnnotation(String argument) { + fail(argument); + } + static List someArgumentsContainer = List.of("some"); static List otherArgumentsContainer = List.of("other"); @@ -2124,6 +2192,18 @@ void testWithRepeatableValueSource(String argument) { fail(argument); } + @ValueSource(strings = "foo") + @ValueSource(strings = "bar") + @Retention(RUNTIME) + @interface TwoValueSources { + } + + @ParameterizedTest + @TwoValueSources + void testWithRepeatableValueSourceAsMetaAnnotation(String argument) { + fail(argument); + } + @ParameterizedTest @ValueSource(strings = "foo") @ValueSource(strings = "foo") @@ -2149,6 +2229,18 @@ void testWithDifferentRepeatableAnnotations(String argument) { void testWithRepeatableArgumentsSource(String argument) { fail(argument); } + + @ArgumentsSource(TwoSingleStringArgumentsProvider.class) + @ArgumentsSource(TwoUnusedStringArgumentsProvider.class) + @Retention(RUNTIME) + @interface TwoArgumentsSources { + } + + @ParameterizedTest + @TwoArgumentsSources + void testWithRepeatableArgumentsSourceAsMetaAnnotation(String argument) { + fail(argument); + } } static class SpiParameterInjectionTestCase { diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java index deef517d9f3b..538d0397add3 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java @@ -19,7 +19,6 @@ import static com.tngtech.archunit.core.domain.JavaClass.Predicates.simpleName; import static com.tngtech.archunit.core.domain.JavaClass.Predicates.type; import static com.tngtech.archunit.core.domain.JavaModifier.PUBLIC; -import static com.tngtech.archunit.core.domain.properties.CanBeAnnotated.Predicates.annotatedWith; import static com.tngtech.archunit.core.domain.properties.HasModifiers.Predicates.modifier; import static com.tngtech.archunit.core.domain.properties.HasName.Predicates.name; import static com.tngtech.archunit.core.domain.properties.HasName.Predicates.nameContaining; @@ -54,7 +53,6 @@ import org.apiguardian.api.API; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.extension.ExtendWith; -import org.junit.jupiter.params.provider.ArgumentsSource; @Order(Integer.MAX_VALUE) @AnalyzeClasses(locations = ArchUnitTests.AllJars.class) @@ -77,7 +75,6 @@ class ArchUnitTests { .and().areAnnotations() // .and().areAnnotatedWith(Repeatable.class) // .and(are(not(type(ExtendWith.class)))) // to be resolved in https://github.com/junit-team/junit5/issues/4059 - .and(are(not(type(ArgumentsSource.class).or(annotatedWith(ArgumentsSource.class))))) // to be resolved in https://github.com/junit-team/junit5/issues/4063 .should(haveContainerAnnotationWithSameRetentionPolicy()) // .andShould(haveContainerAnnotationWithSameTargetTypes()); From d7ab63e1a1604b595cfb0461e9129f64eb3ad01e Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 9 Oct 2024 16:53:53 +0200 Subject: [PATCH 158/611] Remove useless `Order` annotation Since `ArchUnitTests` is executed by the ArchUnit engine, declaring an order did not have any effect. --- .../test/java/platform/tooling/support/tests/ArchUnitTests.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java index 538d0397add3..3091293004dd 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java @@ -51,10 +51,8 @@ import com.tngtech.archunit.library.GeneralCodingRules; import org.apiguardian.api.API; -import org.junit.jupiter.api.Order; import org.junit.jupiter.api.extension.ExtendWith; -@Order(Integer.MAX_VALUE) @AnalyzeClasses(locations = ArchUnitTests.AllJars.class) class ArchUnitTests { From 5e7f0fb6ef378c8c4543bdfa11a48e6ed4f130d1 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 10 Oct 2024 13:16:36 +0200 Subject: [PATCH 159/611] Avoid deprecation warning for missing subcommand --- .../platform/tooling/support/tests/ModularUserGuideTests.java | 1 + 1 file changed, 1 insertion(+) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java index 2427bc41a08a..cd1feb988436 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java @@ -145,6 +145,7 @@ private static void junit(Path temp, Writer out, Writer err) throws Exception { command.add("--module"); command.add("org.junit.platform.console"); + command.add("execute"); command.add("--scan-modules"); command.add("--config"); From 43c8341d1d5ca4ee08528e112658efc674bf113e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 10 Oct 2024 13:28:11 +0000 Subject: [PATCH 160/611] Update plugin org.jetbrains.kotlin.jvm to v2.0.21 --- .../projects/gradle-kotlin-extensions/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts b/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts index 1811e4793aaf..ce55382514be 100644 --- a/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts +++ b/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts @@ -1,7 +1,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - kotlin("jvm") version "2.0.20" + kotlin("jvm") version "2.0.21" } repositories { From 12109012f6642a6c8ae3674cda5d9b7f0c961052 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 10 Oct 2024 16:26:43 +0200 Subject: [PATCH 161/611] Suppress IDEA's "malformed declaration" warning for TestCase classes --- .../test/java/example/TempDirectoryDemo.java | 5 ++++ .../discovery/VintageDiscovererTests.java | 2 ++ .../JUnit3ParallelSuiteWithSubsuites.java | 1 + .../junit3/JUnit3SuiteWithSubsuites.java | 1 + ...playNameGenerationInheritanceTestCase.java | 1 + .../api/DisplayNameGenerationTests.java | 3 ++ ...entencesGenerationInheritanceTestCase.java | 1 + .../CloseableResourceIntegrationTests.java | 2 ++ .../ExecutableInvokerIntegrationTests.java | 3 ++ ...AllAndAfterAllComposedAnnotationTests.java | 1 + ...chAndAfterEachComposedAnnotationTests.java | 1 + .../engine/DefaultExecutionModeTests.java | 2 ++ .../jupiter/engine/DefaultMethodTests.java | 2 ++ .../junit/jupiter/engine/DisabledTests.java | 2 ++ .../engine/ExceptionHandlingTests.java | 4 +++ .../engine/FailedAssumptionsTests.java | 2 ++ ...alidLifecycleMethodConfigurationTests.java | 9 ++++++ .../MultipleTestableAnnotationsTests.java | 2 ++ .../engine/NestedTestClassesTests.java | 4 +++ ...NonVoidTestableMethodIntegrationTests.java | 2 ++ .../engine/OverloadedTestMethodTests.java | 1 + .../org/junit/jupiter/engine/RecordTests.java | 1 + .../junit/jupiter/engine/ReportingTests.java | 1 + .../engine/StandardTestClassTests.java | 5 ++++ ...estedBeforeAllAndAfterAllMethodsTests.java | 1 + .../engine/TestClassInheritanceTests.java | 2 ++ ...stInstanceLifecycleConfigurationTests.java | 6 ++++ .../engine/TestInstanceLifecycleTests.java | 4 +++ .../descriptor/DisplayNameUtilsTests.java | 1 + .../JupiterTestDescriptorTests.java | 10 ++++++- .../descriptor/LifecycleMethodUtilsTests.java | 7 +++++ .../ClassWithStaticInnerTestCases.java | 3 +- .../DiscoverySelectorResolverTests.java | 2 ++ .../engine/discovery/DiscoveryTests.java | 1 + .../predicates/IsNestedTestClassTests.java | 2 ++ .../predicates/IsTestClassWithTestsTests.java | 3 ++ .../predicates/IsTestMethodTests.java | 6 ++++ ...singForArrayParameterIntegrationTests.java | 1 + .../engine/extension/AutoCloseTests.java | 6 ++++ .../extension/BeforeAndAfterAllTests.java | 6 ++++ .../extension/BeforeAndAfterEachTests.java | 8 +++++ ...oreAndAfterTestExecutionCallbackTests.java | 7 +++++ .../extension/ExecutionConditionTests.java | 2 ++ .../ExtensionContextExecutionTests.java | 1 + .../extension/InvocationInterceptorTests.java | 6 ++++ ...eMethodExecutionExceptionHandlerTests.java | 2 ++ .../engine/extension/OrderedMethodTests.java | 11 +++++-- ...rogrammaticExtensionRegistrationTests.java | 1 + .../extension/ParameterResolverTests.java | 13 +++++++++ ...rogrammaticExtensionRegistrationTests.java | 23 +++++++++++++++ .../engine/extension/RepeatedTestTests.java | 2 ++ .../extension/TempDirectoryCleanupTests.java | 11 +++++++ .../TempDirectoryMetaAnnotationTests.java | 2 ++ .../TempDirectoryPerContextTests.java | 25 +++++++++++++++- .../TempDirectoryPerDeclarationTests.java | 29 ++++++++++++++++++- .../TempDirectoryPreconditionTests.java | 3 ++ .../TestExecutionExceptionHandlerTests.java | 1 + .../extension/TestInstanceFactoryTests.java | 15 ++++++++++ ...stProcessorAndPreDestroyCallbackTests.java | 6 ++++ .../TestInstancePostProcessorTests.java | 2 ++ ...TestInstancePreConstructCallbackTests.java | 6 ++++ .../TestInstancePreDestroyCallbackTests.java | 3 ++ .../engine/extension/TestWatcherTests.java | 2 ++ .../extension/TimeoutExtensionTests.java | 21 ++++++++++++++ .../conditions/IgnoreConditionTests.java | 3 ++ .../rules/ExpectedExceptionSupportTests.java | 2 ++ ...pportForMixedMethodAndFieldRulesTests.java | 2 ++ ...rBasedEnableRuleMigrationSupportTests.java | 2 ++ .../ParameterizedTestExtensionTests.java | 1 + .../ParameterizedTestIntegrationTests.java | 1 + .../AggregatorIntegrationTests.java | 1 + .../platform/StackTracePruningTests.java | 2 ++ .../commons/support/ModifierSupportTests.java | 8 +++++ .../platform/console/ConsoleDetailsTests.java | 4 +++ .../ContainerForStaticNestedTest.java | 1 + .../ContainerForStaticNestedTests.java | 1 + .../ResourceLockAnnotationTests.java | 6 ++++ .../NodeTreeWalkerIntegrationTests.java | 6 ++++ .../SameThreadExecutionIntegrationTests.java | 1 + ...dingExecutionListenerIntegrationTests.java | 1 + .../launcher/TagIntegrationTests.java | 1 + .../LauncherConfigurationParametersTests.java | 1 + .../LauncherDiscoveryRequestBuilderTests.java | 1 + .../launcher/core/LauncherFactoryTests.java | 4 +-- ...queIdTrackingListenerIntegrationTests.java | 4 +++ .../engine/testcases/StatefulTestCase.java | 2 ++ .../testkit/engine/EngineTestKitTests.java | 1 + .../engine/ExecutionsIntegrationTests.java | 1 + .../NestedContainerEventConditionTests.java | 1 + 89 files changed, 371 insertions(+), 8 deletions(-) diff --git a/documentation/src/test/java/example/TempDirectoryDemo.java b/documentation/src/test/java/example/TempDirectoryDemo.java index 758710000fb3..451d8281816f 100644 --- a/documentation/src/test/java/example/TempDirectoryDemo.java +++ b/documentation/src/test/java/example/TempDirectoryDemo.java @@ -63,6 +63,7 @@ void copyFileFromSourceToTarget(@TempDir Path source, @TempDir Path target) thro } // end::user_guide_multiple_directories[] + @SuppressWarnings("JUnitMalformedDeclaration") static // tag::user_guide_field_injection[] class SharedTempDirectoryDemo { @@ -87,6 +88,7 @@ void anotherTestThatUsesTheSameTempDir() { } // end::user_guide_field_injection[] + @SuppressWarnings("JUnitMalformedDeclaration") static // tag::user_guide_cleanup_mode[] class CleanupModeDemo { @@ -99,6 +101,7 @@ void fileTest(@TempDir(cleanup = ON_SUCCESS) Path tempDir) { } // end::user_guide_cleanup_mode[] + @SuppressWarnings("JUnitMalformedDeclaration") static // tag::user_guide_factory_name_prefix[] class TempDirFactoryDemo { @@ -121,6 +124,7 @@ public Path createTempDirectory(AnnotatedElementContext elementContext, Extensio } // end::user_guide_factory_name_prefix[] + @SuppressWarnings("JUnitMalformedDeclaration") static // tag::user_guide_factory_jimfs[] class InMemoryTempDirDemo { @@ -158,6 +162,7 @@ public void close() throws IOException { } // end::user_guide_composed_annotation[] + @SuppressWarnings("JUnitMalformedDeclaration") static // tag::user_guide_composed_annotation_usage[] class JimfsTempDirAnnotationDemo { diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/discovery/VintageDiscovererTests.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/discovery/VintageDiscovererTests.java index 806e69769556..5ed15771d1ac 100644 --- a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/discovery/VintageDiscovererTests.java +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/discovery/VintageDiscovererTests.java @@ -125,6 +125,7 @@ private TestDescriptor discover(EngineDiscoveryRequest request) { return new VintageDiscoverer().discover(request, engineId()); } + @SuppressWarnings("JUnitMalformedDeclaration") public static class Foo { @org.junit.Test @@ -133,6 +134,7 @@ public void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") public static class Bar { @org.junit.Test diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3ParallelSuiteWithSubsuites.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3ParallelSuiteWithSubsuites.java index 5157c622dcce..fea0c802c957 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3ParallelSuiteWithSubsuites.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3ParallelSuiteWithSubsuites.java @@ -14,6 +14,7 @@ import junit.framework.TestCase; import junit.framework.TestSuite; +@SuppressWarnings("JUnitMalformedDeclaration") public class JUnit3ParallelSuiteWithSubsuites extends TestCase { private final String arg; diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3SuiteWithSubsuites.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3SuiteWithSubsuites.java index 3c11ed125bbb..390499a21f96 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3SuiteWithSubsuites.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3SuiteWithSubsuites.java @@ -13,6 +13,7 @@ import junit.framework.TestCase; import junit.framework.TestSuite; +@SuppressWarnings("JUnitMalformedDeclaration") public class JUnit3SuiteWithSubsuites extends TestCase { private final String arg; diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationInheritanceTestCase.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationInheritanceTestCase.java index e35aac0ba0b5..1d077189d2e8 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationInheritanceTestCase.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationInheritanceTestCase.java @@ -26,6 +26,7 @@ void this_is_a_test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class StaticNestedTestCase { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationTests.java index fe051e37e3ee..cf692a4be153 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationTests.java @@ -287,6 +287,7 @@ static class UnderscoreStyleInheritedFromSuperClassTestCase extends UnderscoreSt // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @DisplayName("A stack") @DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) static class StackTestCase { @@ -353,6 +354,7 @@ void peek_returns_that_element_without_removing_it_from_the_stack() { // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @DisplayName("A stack") @IndicativeSentencesGeneration(generator = DisplayNameGenerator.ReplaceUnderscores.class) static class IndicativeGeneratorTestCase { @@ -397,6 +399,7 @@ void is_no_longer_empty() { // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @DisplayName("A stack") @IndicativeSentencesGeneration(separator = " >> ", generator = DisplayNameGenerator.ReplaceUnderscores.class) static class IndicativeGeneratorWithCustomSeparatorTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesGenerationInheritanceTestCase.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesGenerationInheritanceTestCase.java index e0e779cf750b..c1e9d52f36f9 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesGenerationInheritanceTestCase.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesGenerationInheritanceTestCase.java @@ -26,6 +26,7 @@ void this_is_a_test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class StaticNestedTestCase { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/CloseableResourceIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/CloseableResourceIntegrationTests.java index 7d7038849878..8ff419f9d6d6 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/CloseableResourceIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/CloseableResourceIntegrationTests.java @@ -35,6 +35,7 @@ void closesCloseableResourcesInReverseInsertOrder() { reportEntry(Map.of("1", "closed"))); } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ExtensionContextParameterResolver.class) static class TestCase { @Test @@ -64,6 +65,7 @@ void exceptionsDuringCloseAreReportedAsSuppressed() { )))); } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ThrowingOnCloseExtension.class) static class ExceptionInCloseableResourceTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExecutableInvokerIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExecutableInvokerIntegrationTests.java index c3946331ec7e..f9b1458f349e 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExecutableInvokerIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExecutableInvokerIntegrationTests.java @@ -39,11 +39,13 @@ void invokeMethodViaExtensionContext() { assertEquals(2, ExecuteTestsTwiceTestCase.testInvocations); } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ExecuteTestsTwiceExtension.class) static class ExecuteTestsTwiceTestCase { static int testInvocations = 0; + @SuppressWarnings("JUnitMalformedDeclaration") @Test void testWithResolvedParameter(TestInfo testInfo, @ExtendWith(ExtensionContextParameterResolver.class) ExtensionContext extensionContext) { @@ -54,6 +56,7 @@ void testWithResolvedParameter(TestInfo testInfo, } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ExecuteConstructorTwiceExtension.class) static class ExecuteConstructorTwiceTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeAllAndAfterAllComposedAnnotationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeAllAndAfterAllComposedAnnotationTests.java index 1176fea22381..e62ea2d5cb27 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeAllAndAfterAllComposedAnnotationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeAllAndAfterAllComposedAnnotationTests.java @@ -39,6 +39,7 @@ void beforeAllAndAfterAllAsMetaAnnotations() { assertThat(methodsInvoked).containsExactly("beforeAll", "test", "afterAll"); } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase { @CustomBeforeAll diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeEachAndAfterEachComposedAnnotationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeEachAndAfterEachComposedAnnotationTests.java index 60091c7ae4a8..c9338fb40861 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeEachAndAfterEachComposedAnnotationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeEachAndAfterEachComposedAnnotationTests.java @@ -39,6 +39,7 @@ void beforeEachAndAfterEachAsMetaAnnotations() { assertThat(methodsInvoked).containsExactly("beforeEach", "test", "afterEach"); } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase { @CustomBeforeEach diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultExecutionModeTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultExecutionModeTests.java index aae9b97c1bc2..e116f4668472 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultExecutionModeTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultExecutionModeTests.java @@ -126,6 +126,7 @@ private T firstChild(TestDescriptor engineDescriptor, .orElseGet(() -> fail("No child of type " + testDescriptorClass + " found")); } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase { @Test @@ -155,6 +156,7 @@ static class ConcurrentTestCase extends TestCase { static class SameThreadTestCase extends TestCase { } + @SuppressWarnings("JUnitMalformedDeclaration") static class OuterTestCase { @Nested class LevelOne { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultMethodTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultMethodTests.java index 7fb690877718..b548e26def2c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultMethodTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultMethodTests.java @@ -200,6 +200,7 @@ default void afterAll() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class GenericTestCaseWithDefaultMethod implements GenericTestInterface { @Test @@ -210,6 +211,7 @@ void test(Double number) { } + @SuppressWarnings("JUnitMalformedDeclaration") static class GenericTestCaseWithOverriddenDefaultMethod implements GenericTestInterface { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/DisabledTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/DisabledTests.java index 62217371196b..d9af4d65202c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/DisabledTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/DisabledTests.java @@ -50,6 +50,7 @@ void executeTestsWithDisabledTestMethods() throws Exception { // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @Disabled static class DisabledTestClassTestCase { @@ -59,6 +60,7 @@ void disabledTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class DisabledTestMethodsTestCase { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/ExceptionHandlingTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/ExceptionHandlingTests.java index 80e730fa8566..e039e37e448f 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/ExceptionHandlingTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/ExceptionHandlingTests.java @@ -248,6 +248,7 @@ void cleanUpExceptions() { // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class FailureTestCase { static Optional exceptionToThrowInBeforeAll = Optional.empty(); @@ -309,6 +310,7 @@ void abortedTest() { } + @SuppressWarnings("JUnitMalformedDeclaration") @TestInstance(PER_METHOD) @ExtendWith(ThrowingAfterAllCallback.class) static class TestCaseWithInvalidConstructorAndThrowingAfterAllCallbackAndPerMethodLifecycle { @@ -322,6 +324,7 @@ void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") @TestInstance(PER_CLASS) @ExtendWith(ThrowingAfterAllCallback.class) static class TestCaseWithInvalidConstructorAndThrowingAfterAllCallbackAndPerClassLifecycle { @@ -334,6 +337,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ThrowingBeforeAllCallback.class) @ExtendWith(ThrowingAfterAllCallback.class) static class TestCaseWithThrowingBeforeAllAndAfterAllCallbacks { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/FailedAssumptionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/FailedAssumptionsTests.java index be2d03755a6c..8aec67537576 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/FailedAssumptionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/FailedAssumptionsTests.java @@ -42,6 +42,7 @@ void assumptionViolatedExceptionInBeforeAll() { // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class TestAbortedExceptionInBeforeAllTestCase { @BeforeAll @@ -54,6 +55,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class AssumptionViolatedExceptionInBeforeAllTestCase { @BeforeAll diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/InvalidLifecycleMethodConfigurationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/InvalidLifecycleMethodConfigurationTests.java index a7efbed7e73a..461c24c3a779 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/InvalidLifecycleMethodConfigurationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/InvalidLifecycleMethodConfigurationTests.java @@ -73,6 +73,7 @@ private void assertContainerFailed(Class invalidTestClass) { // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase { @Test @@ -80,9 +81,11 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithInvalidNonStaticBeforeAllMethod { // must be static + @SuppressWarnings("JUnitMalformedDeclaration") @BeforeAll void beforeAll() { } @@ -92,9 +95,11 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithInvalidNonStaticAfterAllMethod { // must be static + @SuppressWarnings("JUnitMalformedDeclaration") @AfterAll void afterAll() { } @@ -104,9 +109,11 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithInvalidStaticBeforeEachMethod { // must NOT be static + @SuppressWarnings("JUnitMalformedDeclaration") @BeforeEach static void beforeEach() { } @@ -116,9 +123,11 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithInvalidStaticAfterEachMethod { // must NOT be static + @SuppressWarnings("JUnitMalformedDeclaration") @AfterEach static void afterEach() { } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/MultipleTestableAnnotationsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/MultipleTestableAnnotationsTests.java index fd841d06e23e..713f56d52ca7 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/MultipleTestableAnnotationsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/MultipleTestableAnnotationsTests.java @@ -42,8 +42,10 @@ void testAndRepeatedTest(@TrackLogRecords LogRecordListener listener) { // @formatter:on } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase { + @SuppressWarnings("JUnitMalformedDeclaration") @Test @RepeatedTest(1) void testAndRepeatedTest(RepetitionInfo repetitionInfo) { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/NestedTestClassesTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/NestedTestClassesTests.java index 2fa1b21f524f..72650a841dec 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/NestedTestClassesTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/NestedTestClassesTests.java @@ -190,6 +190,7 @@ private void assertNestedCycle(Class start, Class from, Class to) { // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithNesting { @Test @@ -210,6 +211,7 @@ void failing() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithDoubleNesting { static int beforeTopCount = 0; @@ -283,6 +285,7 @@ void failing() { interface InterfaceWithNestedClass { + @SuppressWarnings("JUnitMalformedDeclaration") @Nested class NestedInInterface { @@ -334,6 +337,7 @@ class ConcreteInner2 extends AbstractSuperClass { static class AbstractOuterClass { } + @SuppressWarnings("JUnitMalformedDeclaration") static class OuterClass extends AbstractOuterClass { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/NonVoidTestableMethodIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/NonVoidTestableMethodIntegrationTests.java index abc364ea5147..b3694440c4f0 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/NonVoidTestableMethodIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/NonVoidTestableMethodIntegrationTests.java @@ -21,12 +21,14 @@ class NonVoidTestableMethodIntegrationTests { void valid() { } + @SuppressWarnings("JUnitMalformedDeclaration") @Test int invalidMethodReturningPrimitive() { fail("This method should never have been called."); return 1; } + @SuppressWarnings("JUnitMalformedDeclaration") @Test String invalidMethodReturningObject() { fail("This method should never have been called."); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/OverloadedTestMethodTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/OverloadedTestMethodTests.java index 5aa8eab7bbf2..bcd5d5f8fed3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/OverloadedTestMethodTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/OverloadedTestMethodTests.java @@ -64,6 +64,7 @@ void executeTestCaseWithOverloadedMethodsWithSingleMethodThatAcceptsArgumentsSel assertTrue(first.isPresent()); } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/RecordTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/RecordTests.java index 43930deffd6f..a42187591b72 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/RecordTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/RecordTests.java @@ -23,6 +23,7 @@ void recordsAreTestClasses() { .assertStatistics(stats -> stats.finished(2).succeeded(1).failed(1)); } + @SuppressWarnings("JUnitMalformedDeclaration") record TestCase() { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java index 0e19f0466f16..534cb625f481 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java @@ -36,6 +36,7 @@ void reportEntriesArePublished() { .reportingEntryPublished(7)); } + @SuppressWarnings("JUnitMalformedDeclaration") static class MyReportingTestCase { @BeforeEach diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/StandardTestClassTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/StandardTestClassTests.java index 3782fe7a9d5e..a5d1b6bfb6a2 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/StandardTestClassTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/StandardTestClassTests.java @@ -118,6 +118,7 @@ void testsFailWhenAfterEachFails() { assertTrue(TestCaseWithFailingAfter.testExecuted, "test executed?"); } + @SuppressWarnings("JUnitMalformedDeclaration") static class MyStandardTestCase { static int countBefore1 = 0; @@ -175,6 +176,7 @@ void testAbortedJUnit4Legacy() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class FirstOfTwoTestCases { @Test @@ -194,6 +196,7 @@ void failingTest() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class SecondOfTwoTestCases { @Test @@ -213,6 +216,7 @@ void succeedingTest3() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithFailingBefore { static int countBefore = 0; @@ -233,6 +237,7 @@ void test2() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithFailingAfter { static boolean testExecuted = false; diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/StaticNestedBeforeAllAndAfterAllMethodsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/StaticNestedBeforeAllAndAfterAllMethodsTests.java index 16549a1c4c1a..431830a6495f 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/StaticNestedBeforeAllAndAfterAllMethodsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/StaticNestedBeforeAllAndAfterAllMethodsTests.java @@ -49,6 +49,7 @@ void staticBeforeAllAndAfterAllMethodsInNestedTestClass() { ); } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase { @BeforeAll diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestClassInheritanceTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestClassInheritanceTests.java index 7768b76a49df..aed5b3eaa969 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestClassInheritanceTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestClassInheritanceTests.java @@ -157,6 +157,7 @@ void superTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class LocalTestCase extends AbstractTestCase { boolean throwExceptionInAfterMethod = false; @@ -252,6 +253,7 @@ static void afterAll2() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase3 extends TestCase2 { @BeforeAll diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleConfigurationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleConfigurationTests.java index e800c3fede1c..740807fbf0e3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleConfigurationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleConfigurationTests.java @@ -143,6 +143,7 @@ private void performAssertions(Class testClass, Map configPar // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @TestInstance(PER_METHOD) static class ExplicitInstancePerTestMethodTestCase { @@ -168,6 +169,7 @@ static void afterAllStatic() { * {@code @AfterAll} methods are static, even though there is no explicit * {@code @TestInstance} declaration. */ + @SuppressWarnings("JUnitMalformedDeclaration") static class AssumedInstancePerTestMethodTestCase { @BeforeAll @@ -187,6 +189,7 @@ static void afterAllStatic() { } + @SuppressWarnings("JUnitMalformedDeclaration") @TestInstance(PER_CLASS) static class ExplicitInstancePerClassTestCase { @@ -212,8 +215,10 @@ void afterAll(TestInfo testInfo) { * {@code @AfterAll} methods are non-static, even though there is no * explicit {@code @TestInstance} declaration. */ + @SuppressWarnings("JUnitMalformedDeclaration") static class AssumedInstancePerClassTestCase { + @SuppressWarnings("JUnitMalformedDeclaration") @BeforeAll void beforeAll(TestInfo testInfo) { methodsInvoked.add("beforeAll"); @@ -224,6 +229,7 @@ void test() { methodsInvoked.add("test"); } + @SuppressWarnings("JUnitMalformedDeclaration") @AfterAll void afterAll(TestInfo testInfo) { methodsInvoked.add("afterAll"); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleTests.java index 6358c0ad9ba3..a80c660b9a69 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleTests.java @@ -677,6 +677,7 @@ private static String concat(String... args) { // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(InstanceTrackingExtension.class) // The following is commented out b/c it's the default. // @TestInstance(Lifecycle.PER_METHOD) @@ -752,6 +753,7 @@ static class SubInstancePerClassTestCase extends InstancePerClassTestCase { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(InstanceTrackingExtension.class) // The following is commented out b/c it's the default. // @TestInstance(Lifecycle.PER_METHOD) @@ -817,6 +819,7 @@ void afterEach() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(InstanceTrackingExtension.class) @TestInstance(Lifecycle.PER_CLASS) static class InstancePerClassOuterTestCase { @@ -892,6 +895,7 @@ void afterAll(TestInfo testInfo) { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(InstanceTrackingExtension.class) // The following is commented out b/c it's the default. // @TestInstance(Lifecycle.PER_METHOD) diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/DisplayNameUtilsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/DisplayNameUtilsTests.java index 905747468b45..1bd74fd21f55 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/DisplayNameUtilsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/DisplayNameUtilsTests.java @@ -216,6 +216,7 @@ static class NotDisplayNameTestCase { class NestedTestCase { } + @SuppressWarnings("JUnitMalformedDeclaration") @DisplayNameGeneration(value = NullDisplayNameGenerator.class) static class NullDisplayNameTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptorTests.java index b96a1d3b5bf9..f2f07aca4548 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptorTests.java @@ -295,7 +295,7 @@ private static abstract class AbstractTestCase { @Tag("classTag1") @Tag("classTag2") @DisplayName("custom class name") - @SuppressWarnings("unused") + @SuppressWarnings({ "unused", "JUnitMalformedDeclaration" }) private static class TestCase extends AbstractTestCase { void test() { @@ -330,9 +330,11 @@ void customTestAnnotation() { } + @SuppressWarnings("JUnitMalformedDeclaration") private static class TestCaseWithInvalidBeforeAllMethod { // must be static + @SuppressWarnings("JUnitMalformedDeclaration") @BeforeAll void beforeAll() { } @@ -343,9 +345,11 @@ void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") private static class TestCaseWithInvalidAfterAllMethod { // must be static + @SuppressWarnings("JUnitMalformedDeclaration") @AfterAll void afterAll() { } @@ -356,9 +360,11 @@ void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") private static class TestCaseWithInvalidBeforeEachMethod { // must NOT be static + @SuppressWarnings("JUnitMalformedDeclaration") @BeforeEach static void beforeEach() { } @@ -369,9 +375,11 @@ void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") private static class TestCaseWithInvalidAfterEachMethod { // must NOT be static + @SuppressWarnings("JUnitMalformedDeclaration") @AfterEach static void afterEach() { } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtilsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtilsTests.java index 8ac3a007347a..9705c1fa162f 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtilsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtilsTests.java @@ -137,6 +137,7 @@ private static List namesOf(List methods) { class TestCaseWithStandardLifecycle { + @SuppressWarnings("JUnitMalformedDeclaration") @BeforeAll void one() { } @@ -157,10 +158,12 @@ void eleven() { void twelve() { } + @SuppressWarnings("JUnitMalformedDeclaration") @AfterAll void five() { } + @SuppressWarnings("JUnitMalformedDeclaration") @AfterAll void six() { } @@ -190,21 +193,25 @@ void eight() { class TestCaseWithNonVoidLifecyleMethods { + @SuppressWarnings("JUnitMalformedDeclaration") @BeforeEach String aa() { return null; } + @SuppressWarnings("JUnitMalformedDeclaration") @AfterEach int bb() { return 1; } + @SuppressWarnings("JUnitMalformedDeclaration") @BeforeAll Double cc() { return null; } + @SuppressWarnings("JUnitMalformedDeclaration") @AfterAll String dd() { return ""; diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/ClassWithStaticInnerTestCases.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/ClassWithStaticInnerTestCases.java index 0090eb336fcc..4f5b578f3124 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/ClassWithStaticInnerTestCases.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/ClassWithStaticInnerTestCases.java @@ -17,6 +17,7 @@ */ public class ClassWithStaticInnerTestCases { + @SuppressWarnings("JUnitMalformedDeclaration") public static class ShouldBeDiscovered { @Test @@ -24,7 +25,7 @@ void test1() { } } - @SuppressWarnings("unused") + @SuppressWarnings({ "unused", "JUnitMalformedDeclaration" }) private static class ShouldNotBeDiscovered { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolverTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolverTests.java index 4f2fb79dbf24..3e81ce9a98c9 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolverTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolverTests.java @@ -834,6 +834,7 @@ void test4() { class HerTestClass extends MyTestClass { + @SuppressWarnings("JUnitMalformedDeclaration") @Test void test7(String param) { } @@ -841,6 +842,7 @@ void test7(String param) { class OtherTestClass { + @SuppressWarnings("JUnitMalformedDeclaration") static class NestedTestClass { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoveryTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoveryTests.java index 87bbafe2485e..3916735e44ec 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoveryTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoveryTests.java @@ -170,6 +170,7 @@ void abstractTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class LocalTestCase { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsNestedTestClassTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsNestedTestClassTests.java index 434a105131fc..37133ca9587e 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsNestedTestClassTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsNestedTestClassTests.java @@ -45,10 +45,12 @@ private static class NestedClassesTestCase { class InnerClass { } + @SuppressWarnings("JUnitMalformedDeclaration") @Nested static class StaticNestedClass { } + @SuppressWarnings("JUnitMalformedDeclaration") @Nested private class PrivateInnerClass { } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestClassWithTestsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestClassWithTestsTests.java index d3bea9a00710..f92921c82932 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestClassWithTestsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestClassWithTestsTests.java @@ -95,6 +95,7 @@ void recursiveHierarchies() { // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") private class PrivateClassWithTestMethod { @Test @@ -138,6 +139,7 @@ void second() { // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class StaticTestCase { @Test @@ -145,6 +147,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") private static class PrivateStaticTestCase { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestMethodTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestMethodTests.java index a3a6c6e2b8f5..0865ef4889ed 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestMethodTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestMethodTests.java @@ -101,26 +101,32 @@ private static abstract class AbstractClassWithAbstractTestMethod { } + @SuppressWarnings("JUnitMalformedDeclaration") private static class ClassWithTestMethods { + @SuppressWarnings("JUnitMalformedDeclaration") @Test static void bogusStaticTestMethod() { } + @SuppressWarnings("JUnitMalformedDeclaration") @Test private void bogusPrivateTestMethod() { } + @SuppressWarnings("JUnitMalformedDeclaration") @Test String bogusTestMethodReturningObject() { return ""; } + @SuppressWarnings("JUnitMalformedDeclaration") @Test Void bogusTestMethodReturningVoidReference() { return null; } + @SuppressWarnings("JUnitMalformedDeclaration") @Test int bogusTestMethodReturningPrimitive() { return 0; diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/UniqueIdParsingForArrayParameterIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/UniqueIdParsingForArrayParameterIntegrationTests.java index bae7f2e80be4..7f5dde7869f2 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/UniqueIdParsingForArrayParameterIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/UniqueIdParsingForArrayParameterIntegrationTests.java @@ -55,6 +55,7 @@ void executeTestsForPrimitiveArrayMethodInjectionCases() { assertThat(UniqueId.parse(uniqueId.toString())).isEqualTo(uniqueId); } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(PrimitiveArrayParameterResolver.class) static class PrimitiveArrayMethodInjectionTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/AutoCloseTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/AutoCloseTests.java index 5c66a2ac0842..1b4c4c5bf17c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/AutoCloseTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/AutoCloseTests.java @@ -457,6 +457,7 @@ static class CloseMethodMustBeInvokedViaInterfaceTestCase implements TestInterfa } @TestInstance(PER_METHOD) + @SuppressWarnings("JUnitMalformedDeclaration") static class InstancePerMethodTestCase { @AutoClose @@ -489,6 +490,7 @@ void test2() { } @TestInstance(PER_CLASS) + @SuppressWarnings("JUnitMalformedDeclaration") static class InstancePerClassTestCase { static boolean closed = false; @@ -569,6 +571,7 @@ static void setup() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class SuperTestCase { @AutoClose @@ -589,6 +592,7 @@ void superTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class SubTestCase extends SuperTestCase { @AutoClose @@ -607,6 +611,7 @@ void subTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class FailingFieldsTestCase { @AutoClose @@ -639,6 +644,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class FailingFieldsEnclosingTestCase { @AutoClose diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterAllTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterAllTests.java index 34c178c045e8..c3f98cb7ec4a 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterAllTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterAllTests.java @@ -187,6 +187,7 @@ private void assertBeforeAllAndAfterAllCallbacks(Class testClass, int testsSt // ------------------------------------------------------------------------- // Must NOT be private; otherwise, the @Test method gets discovered but never executed. + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ FooClassLevelCallbacks.class, BarClassLevelCallbacks.class }) static class TopLevelTestCase { @@ -207,6 +208,7 @@ void test() { } // Must NOT be private; otherwise, the @Test method gets discovered but never executed. + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(BazClassLevelCallbacks.class) static class SecondLevelTestCase extends TopLevelTestCase { @@ -227,6 +229,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(QuuxClassLevelCallbacks.class) static class ThirdLevelTestCase extends SecondLevelTestCase { @@ -247,6 +250,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(QuuxClassLevelCallbacks.class) static class ThirdLevelStaticHidingTestCase extends SecondLevelTestCase { @@ -287,6 +291,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooClassLevelCallbacks.class) static class ExceptionInBeforeAllMethodTestCase { @@ -307,6 +312,7 @@ static void afterAll() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ FooClassLevelCallbacks.class, ExceptionThrowingBeforeAllCallback.class }) static class ExceptionInBeforeAllCallbackTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterEachTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterEachTests.java index 8c7f59f7eda3..123b786e3d93 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterEachTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterEachTests.java @@ -288,6 +288,7 @@ void testMethodThrowsAnException() { static class ParentTestCase { } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(BarMethodLevelCallbacks.class) static class ChildTestCase extends ParentTestCase { @@ -306,6 +307,7 @@ default void defaultTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(BarMethodLevelCallbacks.class) static class TestInterfaceTestCase implements TestInterface { @@ -315,6 +317,7 @@ void localTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ FooMethodLevelCallbacks.class, BarMethodLevelCallbacks.class }) static class OuterTestCase { @@ -354,6 +357,7 @@ void afterEachInnerMethod() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ FooMethodLevelCallbacks.class, ExceptionThrowingBeforeEachCallback.class, BarMethodLevelCallbacks.class }) static class ExceptionInBeforeEachCallbackTestCase { @@ -374,6 +378,7 @@ void afterEach() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ FooMethodLevelCallbacks.class, ExceptionThrowingAfterEachCallback.class, BarMethodLevelCallbacks.class }) static class ExceptionInAfterEachCallbackTestCase { @@ -394,6 +399,7 @@ void afterEach() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooMethodLevelCallbacks.class) static class ExceptionInBeforeEachMethodTestCase { @@ -421,6 +427,7 @@ void afterEach() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooMethodLevelCallbacks.class) static class ExceptionInAfterEachMethodTestCase { @@ -441,6 +448,7 @@ void afterEach() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooMethodLevelCallbacks.class) static class ExceptionInTestMethodTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterTestExecutionCallbackTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterTestExecutionCallbackTests.java index 89672560abba..b6cd2fb8df09 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterTestExecutionCallbackTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterTestExecutionCallbackTests.java @@ -256,6 +256,7 @@ void testMethodThrowsAnException() { static class ParentTestCase { } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(BarTestExecutionCallbacks.class) static class ChildTestCase extends ParentTestCase { @@ -274,6 +275,7 @@ default void defaultTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(BarTestExecutionCallbacks.class) static class TestInterfaceTestCase implements TestInterface { @@ -283,6 +285,7 @@ void localTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ FooTestExecutionCallbacks.class, BarTestExecutionCallbacks.class }) static class OuterTestCase { @@ -322,6 +325,7 @@ void afterInnerMethod() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ FooTestExecutionCallbacks.class, ExceptionThrowingBeforeTestExecutionCallback.class, BarTestExecutionCallbacks.class }) static class ExceptionInBeforeTestExecutionCallbackTestCase { @@ -342,6 +346,7 @@ void afterEach() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ FooTestExecutionCallbacks.class, ExceptionThrowingAfterTestExecutionCallback.class, BarTestExecutionCallbacks.class }) static class ExceptionInAfterTestExecutionCallbackTestCase { @@ -362,6 +367,7 @@ void afterEach() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooTestExecutionCallbacks.class) static class ExceptionInBeforeEachMethodTestCase { @@ -382,6 +388,7 @@ void afterEach() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooTestExecutionCallbacks.class) static class ExceptionInTestMethodTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExecutionConditionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExecutionConditionTests.java index b4c13b933d96..03005f9bd1df 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExecutionConditionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExecutionConditionTests.java @@ -151,6 +151,7 @@ private void assertExecutionConditionOverride(String deactivatePattern, int star // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @SystemProperty(key = FOO, value = BOGUS) @DeactivatedConditions static class TestCaseWithExecutionConditionOnClass { @@ -167,6 +168,7 @@ void atDisabledTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithExecutionConditionOnMethods { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionContextExecutionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionContextExecutionTests.java index 8d5694ce3071..3a6605bbc3af 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionContextExecutionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionContextExecutionTests.java @@ -53,6 +53,7 @@ void twoTestClassesCanShareStateViaEngineExtensionContext() { assertThat(Parent.counter).hasValue(1); } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(OnlyIncrementCounterOnce.class) static class Parent { static final AtomicInteger counter = new AtomicInteger(0); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/InvocationInterceptorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/InvocationInterceptorTests.java index 2dcc716ddc85..2557a8173236 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/InvocationInterceptorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/InvocationInterceptorTests.java @@ -60,6 +60,7 @@ void failsTestWhenInterceptorChainDoesNotCallInvocation() { message(it -> it.startsWith("Chain of InvocationInterceptors never called invocation"))))); } + @SuppressWarnings("JUnitMalformedDeclaration") static class InvocationIgnoringInterceptorTestCase { @RegisterExtension Extension interceptor = new InvocationInterceptor() { @@ -83,6 +84,7 @@ void successTestWhenInterceptorChainSkippedInvocation() { results.testEvents().assertStatistics(stats -> stats.failed(0).succeeded(1)); } + @SuppressWarnings("JUnitMalformedDeclaration") static class InvocationSkippedTestCase { @RegisterExtension Extension interceptor = new InvocationInterceptor() { @@ -109,6 +111,7 @@ void failsTestWhenInterceptorChainCallsInvocationMoreThanOnce() { "Chain of InvocationInterceptors called invocation multiple times instead of just once"))))); } + @SuppressWarnings("JUnitMalformedDeclaration") static class DoubleInvocationInterceptorTestCase { @RegisterExtension Extension interceptor = new InvocationInterceptor() { @@ -147,6 +150,7 @@ private Stream getEvents(EngineExecutionResults results, EnumSet map.values().stream()); } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ FooInvocationInterceptor.class, BarInvocationInterceptor.class, BazInvocationInterceptor.class }) static class TestCaseWithThreeInterceptors { @@ -154,6 +158,7 @@ public TestCaseWithThreeInterceptors(TestReporter reporter) { publish(reporter, InvocationType.CONSTRUCTOR); } + @SuppressWarnings("JUnitMalformedDeclaration") @BeforeAll static void beforeAll(TestReporter reporter) { publish(reporter, InvocationType.BEFORE_ALL); @@ -187,6 +192,7 @@ void afterEach(TestReporter reporter) { publish(reporter, InvocationType.AFTER_EACH); } + @SuppressWarnings("JUnitMalformedDeclaration") @AfterAll static void afterAll(TestReporter reporter) { publish(reporter, InvocationType.AFTER_ALL); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/LifecycleMethodExecutionExceptionHandlerTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/LifecycleMethodExecutionExceptionHandlerTests.java index b204cc241f45..7bc8c447ba97 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/LifecycleMethodExecutionExceptionHandlerTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/LifecycleMethodExecutionExceptionHandlerTests.java @@ -297,6 +297,7 @@ private boolean executeThrowingOutOfMemoryException() { // ------------------------------------------ + @SuppressWarnings("JUnitMalformedDeclaration") static class BaseTestCase { @BeforeAll static void throwBeforeAll() { @@ -348,6 +349,7 @@ static class SwallowingTestCase extends BaseTestCase { static class UnrecoverableExceptionTestCase extends BaseTestCase { } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ShouldNotBeCalledHandler.class) @ExtendWith(SwallowExceptionHandler.class) @ExtendWith(RethrowExceptionHandler.class) diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedMethodTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedMethodTests.java index 6291a7b4ecfa..eeeea87571e0 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedMethodTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedMethodTests.java @@ -337,6 +337,7 @@ private Events executeRandomTestCaseInParallelWithRandomSeed(String seed) { // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class BaseTestCase { @Test @@ -349,7 +350,7 @@ void c() { } - @SuppressWarnings("unused") + @SuppressWarnings({ "unused", "JUnitMalformedDeclaration" }) @TestMethodOrder(MethodName.class) static class MethodNameTestCase extends BaseTestCase { @@ -402,7 +403,7 @@ void zzz() { } } - @SuppressWarnings({ "deprecation", "unused" }) + @SuppressWarnings({ "deprecation", "unused", "JUnitMalformedDeclaration" }) @TestMethodOrder(org.junit.jupiter.api.MethodOrderer.Alphanumeric.class) static class AlphanumericTestCase extends BaseTestCase { @@ -455,6 +456,7 @@ void zzz() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @TestMethodOrder(MethodOrderer.DisplayName.class) static class DisplayNameTestCase { @@ -527,6 +529,7 @@ void No_display_name_attribute_2_caps() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @TestMethodOrder(OrderAnnotation.class) static class OrderAnnotationTestCase { @@ -594,6 +597,7 @@ class NestedOrderAnnotationTestCase extends OrderAnnotationTestCase { } } + @SuppressWarnings("JUnitMalformedDeclaration") @TestMethodOrder(Random.class) static class RandomTestCase { @@ -626,6 +630,7 @@ void test5() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @TestMethodOrder(MisbehavingByAdding.class) static class MisbehavingByAddingTestCase { @@ -643,6 +648,7 @@ void test2() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @TestMethodOrder(MisbehavingByRemoving.class) static class MisbehavingByRemovingTestCase { @@ -712,6 +718,7 @@ public void orderMethods(MethodOrdererContext context) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class WithoutTestMethodOrderTestCase { @BeforeEach diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedProgrammaticExtensionRegistrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedProgrammaticExtensionRegistrationTests.java index 126f662d47ef..c9f451ed4e2b 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedProgrammaticExtensionRegistrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedProgrammaticExtensionRegistrationTests.java @@ -200,6 +200,7 @@ private void assertOutcome(Class testClass, String... values) { // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") private static class AbstractTestCase { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ParameterResolverTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ParameterResolverTests.java index 5aa8f1205d64..87919d8a087f 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ParameterResolverTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ParameterResolverTests.java @@ -243,6 +243,7 @@ private void assertEventsForParameterizedTypes(EngineExecutionResults executionR // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(CustomTypeParameterResolver.class) static class ConstructorInjectionTestCase { @@ -281,6 +282,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(CustomAnnotationParameterResolver.class) static class AnnotatedParameterConstructorInjectionTestCase { @@ -320,6 +322,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ CustomTypeParameterResolver.class, CustomAnnotationParameterResolver.class }) static class MethodInjectionTestCase { @@ -362,6 +365,7 @@ void overloadedName(CustomType customType, @CustomAnnotation String value) { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(NullIntegerParameterResolver.class) static class NullMethodInjectionTestCase { @@ -376,6 +380,7 @@ void injectPrimitive(int number) { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(PrimitiveIntegerParameterResolver.class) static class PrimitiveIntegerMethodInjectionTestCase { @@ -385,6 +390,7 @@ void intPrimitive(int i) { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(PrimitiveArrayParameterResolver.class) static class PrimitiveArrayMethodInjectionTestCase { @@ -394,6 +400,7 @@ void primitiveArray(int... ints) { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(NumberParameterResolver.class) static class PotentiallyIncompatibleTypeMethodInjectionTestCase { @@ -417,6 +424,7 @@ void doubleParameterInjection(Double number) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class BeforeAndAfterMethodInjectionTestCase { @BeforeEach @@ -435,6 +443,7 @@ void after(TestInfo testInfo) { } } + @SuppressWarnings("JUnitMalformedDeclaration") @DisplayName("custom class name") static class BeforeAndAfterAllMethodInjectionTestCase { @@ -453,6 +462,7 @@ static void afterAll(TestInfo testInfo) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class ExtendWithOnMethodTestCase { /** @@ -463,6 +473,7 @@ static class ExtendWithOnMethodTestCase { * * @see #523 */ + @SuppressWarnings("JUnitMalformedDeclaration") @BeforeEach @AfterEach void setUpAndTearDown(CustomType customType, @CustomAnnotation String value) { @@ -479,6 +490,7 @@ void testMethodWithExtensionAnnotation(CustomType customType, @CustomAnnotation } } + @SuppressWarnings("JUnitMalformedDeclaration") static class ParameterizedTypeTestCase { @Test @@ -489,6 +501,7 @@ void testMapOfStrings(Map map) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TypeBasedParameterResolverTestCase { @Test @ExtendWith(MapOfListsTypeBasedParameterResolver.class) diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ProgrammaticExtensionRegistrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ProgrammaticExtensionRegistrationTests.java index 2a55678fa219..ac2f02350a66 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ProgrammaticExtensionRegistrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ProgrammaticExtensionRegistrationTests.java @@ -299,6 +299,7 @@ private static void assertWisdom(CrystalBall crystalBall, String wisdom, String assertEquals("Outlook good", wisdom, useCase); } + @SuppressWarnings("JUnitMalformedDeclaration") static class InstanceLevelExtensionRegistrationTestCase { @RegisterExtension @@ -321,6 +322,7 @@ void afterEach(String wisdom) { } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ExtensionInjector.class) static class InstanceLevelExtensionRegistrationWithInjectedExtensionTestCase { @@ -344,6 +346,7 @@ void afterEach(String wisdom) { } + @SuppressWarnings("JUnitMalformedDeclaration") @TestInstance(PER_CLASS) static class InstanceLevelExtensionRegistrationWithTestInstancePerClassLifecycleTestCase { @@ -377,6 +380,7 @@ void afterAll(String wisdom) { } + @SuppressWarnings("JUnitMalformedDeclaration") static class ClassLevelExtensionRegistrationTestCase { @RegisterExtension @@ -409,8 +413,10 @@ static void afterAll(String wisdom) { } + @SuppressWarnings("JUnitMalformedDeclaration") static class SubClassLevelExtensionRegistrationTestCase extends ClassLevelExtensionRegistrationTestCase { + @SuppressWarnings("JUnitMalformedDeclaration") @Test @Override void test(String wisdom) { @@ -446,8 +452,10 @@ static void afterAll(String wisdom) { } + @SuppressWarnings("JUnitMalformedDeclaration") static class ExtensionRegistrationFromInterfaceTestCase implements ClassLevelExtensionRegistrationInterface { + @SuppressWarnings("JUnitMalformedDeclaration") @Test void test(String wisdom) { assertWisdom(crystalBall, wisdom, "@Test"); @@ -475,6 +483,7 @@ public Object resolveParameter(ParameterContext parameterContext, ExtensionConte } + @SuppressWarnings("JUnitMalformedDeclaration") static class ClassLevelExtensionRegistrationParentTestCase { @RegisterExtension @@ -500,6 +509,7 @@ static class ClassLevelExtensionRegistrationChildTestCase extends ClassLevelExte } + @SuppressWarnings("JUnitMalformedDeclaration") static class InstanceLevelExtensionRegistrationParentTestCase { @RegisterExtension @@ -564,8 +574,10 @@ public void beforeEach(ExtensionContext context) throws Exception { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class InstanceLevelCustomExtensionApiTestCase { + @SuppressWarnings("JUnitMalformedDeclaration") @RegisterExtension CustomExtension extension = new CustomExtensionImpl(); @@ -576,8 +588,10 @@ void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class ClassLevelCustomExtensionApiTestCase { + @SuppressWarnings("JUnitMalformedDeclaration") @RegisterExtension static CustomExtension extension = new CustomExtensionImpl(); @@ -588,6 +602,7 @@ void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class AbstractTestCase { @Test @@ -598,6 +613,7 @@ void test() { static class InstanceLevelExtensionRegistrationWithPrivateFieldTestCase extends AbstractTestCase { + @SuppressWarnings("JUnitMalformedDeclaration") @RegisterExtension private Extension extension = new Extension() { }; @@ -606,6 +622,7 @@ static class InstanceLevelExtensionRegistrationWithPrivateFieldTestCase extends static class ClassLevelExtensionRegistrationWithPrivateFieldTestCase extends AbstractTestCase { + @SuppressWarnings("JUnitMalformedDeclaration") @RegisterExtension private static Extension extension = new Extension() { }; @@ -628,6 +645,7 @@ static class ClassLevelExtensionRegistrationWithNullFieldTestCase extends Abstra static class InstanceLevelExtensionRegistrationWithNonExtensionFieldValueTestCase extends AbstractTestCase { + @SuppressWarnings("JUnitMalformedDeclaration") @RegisterExtension Object extension = "not an extension type"; @@ -635,6 +653,7 @@ static class InstanceLevelExtensionRegistrationWithNonExtensionFieldValueTestCas static class ClassLevelExtensionRegistrationWithNonExtensionFieldValueTestCase extends AbstractTestCase { + @SuppressWarnings("JUnitMalformedDeclaration") @RegisterExtension static Object extension = "not an extension type"; @@ -727,11 +746,13 @@ static class TwoNestedClassesTestCase { @Nested class A { + @SuppressWarnings("JUnitMalformedDeclaration") @Test void first(Long n) { assertEquals(42L, n); } + @SuppressWarnings("JUnitMalformedDeclaration") @Test void second(Long n) { assertEquals(42L, n); @@ -742,11 +763,13 @@ void second(Long n) { @Nested class B { + @SuppressWarnings("JUnitMalformedDeclaration") @Test void first(Long n) { assertEquals(42L, n); } + @SuppressWarnings("JUnitMalformedDeclaration") @Test void second(Long n) { assertEquals(42L, n); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/RepeatedTestTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/RepeatedTestTests.java index b851b1f98f0b..df7b9f309014 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/RepeatedTestTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/RepeatedTestTests.java @@ -331,10 +331,12 @@ void testWithEmptyPattern() { void testWithBlankPattern() { } + @SuppressWarnings("JUnitMalformedDeclaration") @RepeatedTest(-99) void negativeRepeatCount() { } + @SuppressWarnings("JUnitMalformedDeclaration") @RepeatedTest(0) void zeroRepeatCount() { } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryCleanupTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryCleanupTests.java index ff7644a015b2..95f1c19eb285 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryCleanupTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryCleanupTests.java @@ -192,6 +192,7 @@ static void deleteIfNotNullAndExists(Path dir) throws IOException { // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class DefaultFieldCase { @TempDir @@ -203,6 +204,7 @@ void testDefaultField() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class NeverFieldCase { @TempDir(cleanup = NEVER) @@ -214,6 +216,7 @@ void testNeverField() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class AlwaysFieldCase { @TempDir(cleanup = ALWAYS) @@ -225,6 +228,7 @@ void testAlwaysField() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class OnSuccessPassingFieldCase { @TempDir(cleanup = ON_SUCCESS) @@ -236,6 +240,7 @@ void testOnSuccessPassingField() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class OnSuccessFailingFieldCase { @TempDir(cleanup = ON_SUCCESS) @@ -248,6 +253,7 @@ void testOnSuccessFailingField() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @TestMethodOrder(MethodOrderer.OrderAnnotation.class) static class OnSuccessFailingStaticFieldCase { @@ -398,6 +404,7 @@ static void afterAll() throws IOException { // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class DefaultParameterCase { @Test @@ -406,6 +413,7 @@ void testDefaultParameter(@TempDir Path defaultParameterDir) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class NeverParameterCase { @Test @@ -414,6 +422,7 @@ void testNeverParameter(@TempDir(cleanup = NEVER) Path neverParameterDir) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class AlwaysParameterCase { @Test @@ -422,6 +431,7 @@ void testAlwaysParameter(@TempDir(cleanup = ALWAYS) Path alwaysParameterDir) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class OnSuccessPassingParameterCase { @Test @@ -430,6 +440,7 @@ void testOnSuccessPassingParameter(@TempDir(cleanup = ON_SUCCESS) Path onSuccess } } + @SuppressWarnings("JUnitMalformedDeclaration") static class OnSuccessFailingParameterCase { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryMetaAnnotationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryMetaAnnotationTests.java index 905672bfbec5..a156270e356f 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryMetaAnnotationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryMetaAnnotationTests.java @@ -44,6 +44,7 @@ void annotationOnParameter() { .assertStatistics(stats -> stats.started(1).succeeded(1)); } + @SuppressWarnings("JUnitMalformedDeclaration") static class AnnotationOnFieldTestCase { @CustomTempDir @@ -56,6 +57,7 @@ void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class AnnotationOnParameterTestCase { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerContextTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerContextTests.java index ee61717f56be..07202e36696a 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerContextTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerContextTests.java @@ -513,6 +513,7 @@ private void assertResolvesSeparateTempDirs(Class testClass, Deque temp // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class BaseSharedTempDirFieldInjectionTestCase { static Path staticTempDir; @@ -613,6 +614,7 @@ static class AnnotationOnInstanceFieldAndBeforeAllMethodParameterWithTestInstanc } + @SuppressWarnings("JUnitMalformedDeclaration") static class AnnotationOnPrivateInstanceFieldTestCase { @SuppressWarnings("unused") @@ -626,6 +628,7 @@ void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class AnnotationOnPrivateStaticFieldTestCase { @SuppressWarnings("unused") @@ -639,6 +642,7 @@ void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class AnnotationOnStaticFieldWithUnsupportedTypeTestCase { @SuppressWarnings("unused") @@ -651,6 +655,7 @@ void test1() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class AnnotationOnInstanceFieldWithUnsupportedTypeTestCase { @SuppressWarnings("unused") @@ -663,6 +668,7 @@ void test1() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class BaseSharedTempDirParameterInjectionTestCase { static Path tempDir; @@ -696,6 +702,7 @@ static void check(Path tempDir) { } + @SuppressWarnings("JUnitMalformedDeclaration") static class BaseConstructorInjectionTestCase { static final Deque tempDirs = new LinkedList<>(); @@ -767,6 +774,7 @@ void beforeEach(@TempDir Path tempDir) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class NonDefaultFactoryTestCase { @Test @@ -785,6 +793,7 @@ public Path createTempDirectory(AnnotatedElementContext elementContext, Extensio } + @SuppressWarnings("JUnitMalformedDeclaration") static class StandardDefaultFactoryTestCase { @Test @@ -794,6 +803,7 @@ void test(@TempDir Path tempDir1, @TempDir Path tempDir2) { } + @SuppressWarnings("JUnitMalformedDeclaration") static class CustomDefaultFactoryTestCase { @Test @@ -803,6 +813,7 @@ void test(@TempDir Path tempDir1, @TempDir Path tempDir2) { } + @SuppressWarnings("JUnitMalformedDeclaration") static class CustomDefaultFactoryNotReturningDirectoryTestCase { @Test @@ -834,6 +845,7 @@ void beforeAll(@TempDir Path tempDir) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class AnnotationOnAfterAllMethodParameterTestCase { static Path firstTempDir = null; @@ -854,6 +866,7 @@ static void afterAll(@TempDir Path tempDir) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class BaseSeparateTempDirsFieldInjectionTestCase { static final Deque tempDirs = new LinkedList<>(); @@ -907,6 +920,7 @@ static class SeparateTempDirsWhenUsedOnForEachLifecycleMethodsWithTestInstancePe extends SeparateTempDirsWhenUsedOnForEachLifecycleMethodsFieldInjectionTestCase { } + @SuppressWarnings("JUnitMalformedDeclaration") static class BaseSeparateTempDirsParameterInjectionTestCase { static final Deque tempDirs = new LinkedList<>(); @@ -953,6 +967,7 @@ static class SeparateTempDirsWhenUsedOnForEachLifecycleMethodsWithTestInstancePe extends SeparateTempDirsWhenUsedOnForEachLifecycleMethodsParameterInjectionTestCase { } + @SuppressWarnings("JUnitMalformedDeclaration") static class InvalidTestCase { @Test @@ -961,6 +976,7 @@ void wrongParameterType(@SuppressWarnings("unused") @TempDir String ignored) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class FileInjectionTestCase { @TempDir @@ -989,6 +1005,7 @@ private static void writeFile(Path tempDir, TestInfo testInfo) throws IOExceptio } // https://github.com/junit-team/junit5/issues/1748 + @SuppressWarnings("JUnitMalformedDeclaration") static class TempDirectoryDoesNotPreventConstructorParameterResolutionTestCase { TempDirectoryDoesNotPreventConstructorParameterResolutionTestCase(TestInfo testInfo) { @@ -1002,6 +1019,7 @@ void test() { } // https://github.com/junit-team/junit5/issues/1801 + @SuppressWarnings("JUnitMalformedDeclaration") static class UserTempDirectoryDeletionDoesNotCauseFailureTestCase { @Test @@ -1013,6 +1031,7 @@ void deleteTempDir(@TempDir Path tempDir) throws IOException { } // https://github.com/junit-team/junit5/issues/2046 + @SuppressWarnings("JUnitMalformedDeclaration") static class NonWritableFileDoesNotCauseFailureTestCase { @Test @@ -1027,6 +1046,7 @@ void createReadonlyFile(@TempDir Path tempDir) throws IOException { } // https://github.com/junit-team/junit5/issues/2171 + @SuppressWarnings("JUnitMalformedDeclaration") static class ReadOnlyFileInReadOnlyDirDoesNotCauseFailureTestCase { @Test @@ -1040,6 +1060,7 @@ void createReadOnlyFileInReadOnlyDir(@TempDir File tempDir) throws IOException { } // https://github.com/junit-team/junit5/issues/2171 + @SuppressWarnings("JUnitMalformedDeclaration") static class ReadOnlyFileInDirInReadOnlyDirDoesNotCauseFailureTestCase { @Test @@ -1064,7 +1085,7 @@ private static boolean makeReadOnly(File file) throws IOException { } // https://github.com/junit-team/junit5/issues/2609 - @SuppressWarnings("ResultOfMethodCallIgnored") + @SuppressWarnings({ "ResultOfMethodCallIgnored", "JUnitMalformedDeclaration" }) static class NonMintPermissionContentInTempDirectoryDoesNotCauseFailureTestCase { @Test @@ -1443,6 +1464,7 @@ void makeTempDirectoryWithNonEmptyFolderContainingNonReadableFileNonExecutable(@ } // https://github.com/junit-team/junit5/issues/2079 + @SuppressWarnings("JUnitMalformedDeclaration") static class TempDirUsageInsideNestedClassesTestCase { @TempDir @@ -1475,6 +1497,7 @@ void deeplyNested() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class StaticTempDirUsageInsideNestedClassTestCase { @TempDir diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerDeclarationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerDeclarationTests.java index 33ba07a362d4..5414e18a5af3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerDeclarationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerDeclarationTests.java @@ -516,6 +516,7 @@ private static void assertSingleFailedTest(EngineExecutionResults results, Condi // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class AnnotationOnPrivateInstanceFieldTestCase { @SuppressWarnings("unused") @@ -529,6 +530,7 @@ void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class AnnotationOnPrivateStaticFieldTestCase { @SuppressWarnings("unused") @@ -542,6 +544,7 @@ void test() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class AnnotationOnStaticFieldWithUnsupportedTypeTestCase { @SuppressWarnings("unused") @@ -554,6 +557,7 @@ void test1() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class AnnotationOnInstanceFieldWithUnsupportedTypeTestCase { @SuppressWarnings("unused") @@ -566,6 +570,7 @@ void test1() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class InvalidTestCase { @Test @@ -600,6 +605,7 @@ private static void assertFileAndPathAreNotEqual(File tempDir, Path ref) { } // https://github.com/junit-team/junit5/issues/1748 + @SuppressWarnings("JUnitMalformedDeclaration") static class TempDirectoryDoesNotPreventConstructorParameterResolutionTestCase { @TempDir @@ -617,6 +623,7 @@ void test() { } // https://github.com/junit-team/junit5/issues/1801 + @SuppressWarnings("JUnitMalformedDeclaration") static class UserTempDirectoryDeletionDoesNotCauseFailureTestCase { @Test @@ -628,6 +635,7 @@ void deleteTempDir(@TempDir Path tempDir) throws IOException { } // https://github.com/junit-team/junit5/issues/2046 + @SuppressWarnings("JUnitMalformedDeclaration") static class NonWritableFileDoesNotCauseFailureTestCase { @Test @@ -642,6 +650,7 @@ void createReadonlyFile(@TempDir Path tempDir) throws IOException { } // https://github.com/junit-team/junit5/issues/2171 + @SuppressWarnings("JUnitMalformedDeclaration") static class ReadOnlyFileInReadOnlyDirDoesNotCauseFailureTestCase { @Test @@ -655,6 +664,7 @@ void createReadOnlyFileInReadOnlyDir(@TempDir File tempDir) throws IOException { } // https://github.com/junit-team/junit5/issues/2171 + @SuppressWarnings("JUnitMalformedDeclaration") static class ReadOnlyFileInDirInReadOnlyDirDoesNotCauseFailureTestCase { @Test @@ -670,7 +680,7 @@ void createReadOnlyFileInReadOnlyDir(@TempDir File tempDir) throws IOException { } // https://github.com/junit-team/junit5/issues/2609 - @SuppressWarnings("ResultOfMethodCallIgnored") + @SuppressWarnings({ "ResultOfMethodCallIgnored", "JUnitMalformedDeclaration" }) static class NonMintPermissionContentInTempDirectoryDoesNotCauseFailureTestCase { @Test @@ -1049,6 +1059,7 @@ void makeTempDirectoryWithNonEmptyFolderContainingNonReadableFileNonExecutable(@ } // https://github.com/junit-team/junit5/issues/2079 + @SuppressWarnings("JUnitMalformedDeclaration") static class TempDirUsageInsideNestedClassesTestCase { @TempDir @@ -1081,6 +1092,7 @@ void deeplyNested() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class StaticTempDirUsageInsideNestedClassTestCase { @TempDir @@ -1107,6 +1119,7 @@ void nested() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @DisplayName("class") static class AllPossibleDeclarationLocationsTestCase { @@ -1228,6 +1241,7 @@ void reportTempDir(TestReporter reporter) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class UndeletableDirectoryTestCase extends UndeletableTestCase { @Test void test() throws Exception { @@ -1235,6 +1249,7 @@ void test() throws Exception { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class UndeletableFileTestCase extends UndeletableTestCase { @Test void test() throws Exception { @@ -1242,6 +1257,7 @@ void test() throws Exception { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class FactoryWithTestMethodNameAsPrefixTestCase { @Test @@ -1262,6 +1278,7 @@ public Path createTempDirectory(AnnotatedElementContext elementContext, Extensio } // https://github.com/junit-team/junit5/issues/2088 + @SuppressWarnings("JUnitMalformedDeclaration") static class FactoryWithCustomParentDirectoryTestCase { @Test @@ -1287,6 +1304,7 @@ public Path createTempDirectory(AnnotatedElementContext elementContext, Extensio } + @SuppressWarnings("JUnitMalformedDeclaration") static class FactoryWithMemoryFileSystemTestCase { @Test @@ -1315,6 +1333,7 @@ public void close() throws IOException { } + @SuppressWarnings("JUnitMalformedDeclaration") static class FactoryWithJimfsTestCase { @Test @@ -1343,6 +1362,7 @@ public void close() throws IOException { } + @SuppressWarnings("JUnitMalformedDeclaration") static class FactoryWithAnnotatedElementNameAsPrefixTestCase { @TempDir(factory = Factory.class) @@ -1370,6 +1390,7 @@ private static String getName(AnnotatedElement element) { } + @SuppressWarnings("JUnitMalformedDeclaration") static class FactoryWithCustomMetaAnnotationTestCase { @TempDirForField @@ -1416,6 +1437,7 @@ public Path createTempDirectory(AnnotatedElementContext elementContext, Extensio } + @SuppressWarnings("JUnitMalformedDeclaration") static class FactoryNotReturningDirectoryTestCase { @Test @@ -1433,6 +1455,7 @@ public Path createTempDirectory(AnnotatedElementContext elementContext, Extensio } + @SuppressWarnings("JUnitMalformedDeclaration") static class FactoryReturningNonDefaultFileSystemPathForFileAnnotatedElementTestCase { @Test @@ -1458,6 +1481,7 @@ public void close() throws IOException { } + @SuppressWarnings("JUnitMalformedDeclaration") static class StandardDefaultFactoryTestCase { @Test @@ -1469,6 +1493,7 @@ void test(@TempDir Path tempDir1, @TempDir Path tempDir2) { } + @SuppressWarnings("JUnitMalformedDeclaration") static class CustomDefaultFactoryTestCase { @Test @@ -1480,6 +1505,7 @@ void test(@TempDir Path tempDir1, @TempDir Path tempDir2) { } + @SuppressWarnings("JUnitMalformedDeclaration") static class CustomDefaultFactoryWithStandardDeclarationTestCase { @Test @@ -1491,6 +1517,7 @@ void test(@TempDir Path tempDir1, @TempDir(factory = Standard.class) Path tempDi } + @SuppressWarnings("JUnitMalformedDeclaration") static class CustomDefaultFactoryNotReturningDirectoryTestCase { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPreconditionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPreconditionTests.java index 659dfca5771a..ebfa6cd8a054 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPreconditionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPreconditionTests.java @@ -87,6 +87,7 @@ void finalInstanceFieldIsNotSupported() { // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class ParameterTypeTestCase { @Test @@ -98,6 +99,7 @@ void invalidTempDirType(@TempDir String text) { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class FinalStaticFieldTestCase { static final @TempDir Path path = Paths.get("."); @@ -107,6 +109,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class FinalInstanceFieldTestCase { final @TempDir Path path = Paths.get("."); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestExecutionExceptionHandlerTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestExecutionExceptionHandlerTests.java index 71a5b9e65934..86a07926465b 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestExecutionExceptionHandlerTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestExecutionExceptionHandlerTests.java @@ -133,6 +133,7 @@ void severalHandlersAreCalledInOrder() { // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class ATestCase { @Test diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java index 48d4218faccd..8ed6da8c23d8 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java @@ -431,6 +431,7 @@ void instanceFactoryWithLegacyContext() { // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ FooInstanceFactory.class, BarInstanceFactory.class }) static class MultipleFactoriesRegisteredOnSingleTestCase { @@ -440,6 +441,7 @@ void testShouldNotBeCalled() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(NullTestInstanceFactory.class) static class NullTestInstanceFactoryTestCase { @@ -453,6 +455,7 @@ void testShouldNotBeCalled() { static class PerClassLifecycleNullTestInstanceFactoryTestCase extends NullTestInstanceFactoryTestCase { } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(BogusTestInstanceFactory.class) static class BogusTestInstanceFactoryTestCase { @@ -466,6 +469,7 @@ void testShouldNotBeCalled() { static class PerClassLifecycleBogusTestInstanceFactoryTestCase extends BogusTestInstanceFactoryTestCase { } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ExplosiveTestInstanceFactory.class) static class ExplosiveTestInstanceFactoryTestCase { @@ -488,6 +492,7 @@ public Object createTestInstance(TestInstanceFactoryContext factoryContext, Exte } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(MultipleConstructorsTestInstanceFactory.class) static class MultipleConstructorsTestCase { @@ -507,6 +512,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooInstanceFactory.class) static class ParentTestCase { @@ -516,6 +522,7 @@ void parentTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class InheritedFactoryTestCase extends ParentTestCase { @Test @@ -524,6 +531,7 @@ void childTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(BarInstanceFactory.class) static class MultipleFactoriesRegisteredWithinClassHierarchyTestCase extends ParentTestCase { @@ -533,6 +541,7 @@ void childTest() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooInstanceFactory.class) static class OuterTestCase { @@ -560,6 +569,7 @@ void innerTest2() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooInstanceFactory.class) static class MultipleFactoriesRegisteredWithinNestedClassStructureTestCase { @@ -581,6 +591,7 @@ void innerTest() { interface TestInterface { } + @SuppressWarnings("JUnitMalformedDeclaration") static class FactoryFromInterfaceTestCase implements TestInterface { @Test @@ -589,6 +600,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class LambdaFactoryTestCase { private final String text; @@ -611,6 +623,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooInstanceFactory.class) @TestInstance(PER_CLASS) static class PerClassLifecycleTestCase { @@ -647,6 +660,7 @@ void afterAll() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(LegacyInstanceFactory.class) static class LegacyContextTestCase { @@ -670,6 +684,7 @@ void innerTest2() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ProxyTestInstanceFactory.class) @TestInstance(PER_CLASS) static class ProxiedTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorAndPreDestroyCallbackTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorAndPreDestroyCallbackTests.java index fec5ad33bb04..bcd968a5f466 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorAndPreDestroyCallbackTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorAndPreDestroyCallbackTests.java @@ -120,6 +120,7 @@ private void assertPostProcessorAndPreDestroyCallbacks(Class testClass, int t // ------------------------------------------------------------------------- // Must NOT be private; otherwise, the @Test method gets discovered but never executed. + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ FooTestInstanceCallbacks.class, BarTestInstanceCallbacks.class }) static class TopLevelTestCase { @@ -130,6 +131,7 @@ void test() { } // Must NOT be private; otherwise, the @Test method gets discovered but never executed. + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(BazTestInstanceCallbacks.class) static class SecondLevelTestCase extends TopLevelTestCase { @@ -140,6 +142,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(QuuxTestInstanceCallbacks.class) static class ThirdLevelTestCase extends SecondLevelTestCase { @@ -150,6 +153,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ExceptionThrowingTestInstancePreDestroyCallback.class) static class ExceptionInTestInstancePreDestroyCallbackTestCase { @@ -159,6 +163,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ExceptionThrowingTestInstancePostProcessor.class) static class ExceptionInTestInstancePostProcessorTestCase { @@ -168,6 +173,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooTestInstanceCallbacks.class) static class ExceptionInTestClassConstructorTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java index 416e90e8e532..b6c1a3aaf976 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java @@ -96,6 +96,7 @@ void testSpecificTestInstancePostProcessorIsCalled() { // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooInstancePostProcessor.class) @ExtendWith(LegacyInstancePostProcessor.class) static class OuterTestCase implements Named { @@ -149,6 +150,7 @@ void testInner() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithTestSpecificTestInstancePostProcessor implements Named { private final Map names = new HashMap<>(); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java index 4da0833bd0d7..b3536eeae8d7 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java @@ -246,6 +246,7 @@ protected static void record(String event) { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(InstancePreConstructCallbackRecordingFoo.class) static class InstancePreConstructTestCase extends CallSequenceRecordingTestCase { @@ -284,6 +285,7 @@ static void afterAll() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(InstancePreConstructCallbackRecordingFoo.class) static class FactoryPreConstructTestCase extends CallSequenceRecordingTestCase { @@ -328,6 +330,7 @@ static void afterAll() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(InstancePreConstructCallbackRecordingFoo.class) static class PreConstructInNestedTestCase extends CallSequenceRecordingTestCase { @@ -405,6 +408,7 @@ void afterEachInner() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class PreConstructOnMethod extends CallSequenceRecordingTestCase { PreConstructOnMethod() { record("constructor"); @@ -432,6 +436,7 @@ void afterEach() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @TestInstance(TestInstance.Lifecycle.PER_CLASS) @ExtendWith(InstancePreConstructCallbackRecordingFoo.class) @ExtendWith(InstancePreConstructCallbackRecordingBar.class) @@ -456,6 +461,7 @@ void test2() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(InstancePreConstructCallbackRecordingFoo.class) @ExtendWith(InstancePreConstructCallbackRecordingLegacy.class) static class LegacyPreConstructTestCase extends CallSequenceRecordingTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreDestroyCallbackTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreDestroyCallbackTests.java index a417a00e8db7..3ae4d8997537 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreDestroyCallbackTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreDestroyCallbackTests.java @@ -104,6 +104,7 @@ void setDestroyed() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(FooInstancePreDestroyCallback.class) static class OuterTestCase extends Destroyable { @@ -136,6 +137,7 @@ void testInner() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithTestSpecificTestInstancePreDestroyCallback extends Destroyable { @BeforeEach @@ -151,6 +153,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @TestInstance(PER_CLASS) @ExtendWith(FooInstancePreDestroyCallback.class) @ExtendWith(BarInstancePreDestroyCallback.class) diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestWatcherTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestWatcherTests.java index a8400aa63ba3..fdbde376dfe9 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestWatcherTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestWatcherTests.java @@ -355,6 +355,7 @@ static class TestInstancePerMethodInstanceLevelTestWatcherTestCase extends Abstr TestWatcher watcher = new TrackingTestWatcher(); } + @SuppressWarnings("JUnitMalformedDeclaration") static class MethodLevelTestWatcherTestCase extends AbstractDisabledMethodsTestCase { @Override @@ -456,6 +457,7 @@ private static Store getStore(ExtensionContext context) { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(DataRetrievingTestWatcher.class) static class DataRetrievingTestWatcherTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutExtensionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutExtensionTests.java index 7a317a6f946f..85b00639a6bd 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutExtensionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutExtensionTests.java @@ -503,6 +503,7 @@ void nonTimeoutExceededInSeparateThreadOnClassLevel() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TimeoutAnnotatedTestMethodTestCase { @Test @Timeout(value = 10, unit = MILLISECONDS) @@ -524,6 +525,7 @@ Stream testFactoryMethod() throws Exception { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TimeoutAnnotatedBeforeAllMethodTestCase { @BeforeAll @Timeout(value = 10, unit = MILLISECONDS) @@ -537,6 +539,7 @@ void testMethod() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TimeoutAnnotatedBeforeEachMethodTestCase { @BeforeEach @Timeout(value = 10, unit = MILLISECONDS) @@ -550,6 +553,7 @@ void testMethod() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TimeoutAnnotatedAfterEachMethodTestCase { @Test void testMethod() { @@ -563,6 +567,7 @@ void tearDown() throws Exception { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TimeoutAnnotatedAfterAllMethodTestCase { @Test void testMethod() { @@ -601,6 +606,7 @@ Stream testFactoryMethod() throws Exception { static class InheritedTimeoutAnnotatedClassTestCase extends TimeoutAnnotatedClassTestCase { } + @SuppressWarnings("JUnitMalformedDeclaration") static class MethodWithoutInterruptedExceptionTestCase { @Test @Timeout(value = 1, unit = MILLISECONDS) @@ -609,6 +615,7 @@ void methodThatDoesNotThrowInterruptedException() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class PlainTestCase { public static String slowMethod; @@ -656,6 +663,7 @@ private static void waitForInterrupt(String methodName) throws InterruptedExcept } } + @SuppressWarnings("JUnitMalformedDeclaration") static class UnrecoverableExceptionTestCase { @Test @Timeout(value = 1, unit = NANOSECONDS) @@ -665,6 +673,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @Timeout(10) static class NonTimeoutExceedingTestCase { @Test @@ -705,6 +714,7 @@ void testMethod() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class IllegalTimeoutDurationTestCase { @Test @@ -714,6 +724,7 @@ void testMethod() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class TimeoutExceedingWithInferredThreadModeTestCase { @Test @Timeout(value = 10, unit = MILLISECONDS) @@ -722,6 +733,7 @@ void testMethod() throws InterruptedException { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TimeoutExceedingSeparateThreadTestCase { @Test @Timeout(value = 100, unit = MILLISECONDS, threadMode = SEPARATE_THREAD) @@ -730,6 +742,7 @@ void testMethod() throws InterruptedException { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class NonTimeoutExceedingSeparateThreadTestCase { @Test @Timeout(value = 100, unit = MILLISECONDS, threadMode = SEPARATE_THREAD) @@ -737,6 +750,7 @@ void testMethod() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class UnrecoverableExceptionInSeparateThreadTestCase { @Test @Timeout(value = 100, unit = SECONDS, threadMode = SEPARATE_THREAD) @@ -745,6 +759,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class ExceptionInSeparateThreadTestCase { @Test @Timeout(value = 5, unit = SECONDS, threadMode = SEPARATE_THREAD) @@ -753,6 +768,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class FailedAssertionInSeparateThreadTestCase { @Test @Timeout(value = 5, unit = SECONDS, threadMode = SEPARATE_THREAD) @@ -767,6 +783,7 @@ void testJavaLangAssertion() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @Timeout(value = 100, unit = MILLISECONDS, threadMode = SEPARATE_THREAD) static class TimeoutExceededOnClassLevelTestCase { @Test @@ -775,6 +792,7 @@ void exceptionThrown() throws InterruptedException { } } + @SuppressWarnings("JUnitMalformedDeclaration") @Timeout(value = 100, unit = MILLISECONDS, threadMode = SEPARATE_THREAD) static class NonTimeoutExceededOnClassLevelTestCase { @Test @@ -782,6 +800,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @TestMethodOrder(OrderAnnotation.class) static class OneTestStuckForeverAndTheOthersNotTestCase { @@ -805,6 +824,7 @@ void testOne() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class MixedSameThreadAndSeparateThreadTestCase { @Test @Timeout(value = 10, unit = MILLISECONDS, threadMode = SEPARATE_THREAD) @@ -825,6 +845,7 @@ void testTwo() throws InterruptedException { } } + @SuppressWarnings("JUnitMalformedDeclaration") @TestMethodOrder(OrderAnnotation.class) static class OneTestStuckForeverAndTheOthersInSameThreadNotTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/conditions/IgnoreConditionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/conditions/IgnoreConditionTests.java index f427d7d6769d..b50fe4528742 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/conditions/IgnoreConditionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/conditions/IgnoreConditionTests.java @@ -106,6 +106,7 @@ private EngineExecutionResults executeTestsForClass(Class testClass) { // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(IgnoreCondition.class) @Ignore static class IgnoredClassWithDefaultMessageTestCase { @@ -116,6 +117,7 @@ void ignoredBecauseClassIsIgnored() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(IgnoreCondition.class) @Ignore("Ignored Class") static class IgnoredClassWithCustomMessageTestCase { @@ -126,6 +128,7 @@ void ignoredBecauseClassIsIgnored() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(IgnoreCondition.class) static class IgnoredMethodsTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExpectedExceptionSupportTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExpectedExceptionSupportTests.java index be8df6202fd0..cf54fc79e067 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExpectedExceptionSupportTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExpectedExceptionSupportTests.java @@ -76,6 +76,7 @@ private Events executeTestsForClass(Class testClass) { return EngineTestKit.execute("junit-jupiter", request().selectors(selectClass(testClass)).build()).testEvents(); } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ExpectedExceptionSupport.class) static class ExpectedExceptionTestCase { @@ -107,6 +108,7 @@ void correctExceptionExpectedThrown() { } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(ExpectedExceptionSupport.class) static class ExpectedExceptionSupportWithoutExpectedExceptionRuleTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForMixedMethodAndFieldRulesTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForMixedMethodAndFieldRulesTests.java index e02d4d774ccc..18567a385668 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForMixedMethodAndFieldRulesTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForMixedMethodAndFieldRulesTests.java @@ -45,11 +45,13 @@ static void clear() { @Rule public ExternalResource fieldRule2 = new MyExternalResource("fieldRule2"); + @SuppressWarnings("JUnitMalformedDeclaration") @Rule ExternalResource methodRule1() { return new MyExternalResource("methodRule1"); } + @SuppressWarnings("JUnitMalformedDeclaration") @Rule ExternalResource methodRule2() { return new MyExternalResource("methodRule2"); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/LauncherBasedEnableRuleMigrationSupportTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/LauncherBasedEnableRuleMigrationSupportTests.java index 558a9c490336..13194fa224d5 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/LauncherBasedEnableRuleMigrationSupportTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/LauncherBasedEnableRuleMigrationSupportTests.java @@ -52,6 +52,7 @@ private Events executeTestsForClass(Class testClass) { return EngineTestKit.execute("junit-jupiter", request().selectors(selectClass(testClass)).build()).testEvents(); } + @SuppressWarnings("JUnitMalformedDeclaration") @EnableRuleMigrationSupport static class EnableRuleMigrationSupportWithBothRuleTypesTestCase { @@ -93,6 +94,7 @@ void beforeMethodOfBothRule2WasExecuted() { } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(VerifierSupport.class) static class VerifierSupportForErrorCollectorTestCase { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java index 3172140691ae..01dbe93e407c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java @@ -304,6 +304,7 @@ void method() { static class TestCaseWithAnnotatedMethod { + @SuppressWarnings("JUnitMalformedDeclaration") @ParameterizedTest void method() { } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java index 56418a7a84f9..9e5c5a8e6910 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java @@ -2149,6 +2149,7 @@ void testWithRepeatableMethodSource(String argument) { @interface TwoMethodSources { } + @SuppressWarnings("JUnitMalformedDeclaration") @ParameterizedTest @TwoMethodSources void testWithRepeatableMethodSourceAsMetaAnnotation(String argument) { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/aggregator/AggregatorIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/aggregator/AggregatorIntegrationTests.java index a6601c9ec05e..96a4890088b1 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/aggregator/AggregatorIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/aggregator/AggregatorIntegrationTests.java @@ -410,6 +410,7 @@ static class CountingTestCase { static final List output = new ArrayList<>(); + @SuppressWarnings("JUnitMalformedDeclaration") @ParameterizedTest @ValueSource(ints = { 1, 2, 3 }) void testWithCountingConverterAggregator(@ConvertWith(InstanceCountingConverter.class) int i, diff --git a/platform-tests/src/test/java/org/junit/platform/StackTracePruningTests.java b/platform-tests/src/test/java/org/junit/platform/StackTracePruningTests.java index 1babd73c2766..14efaa029759 100644 --- a/platform-tests/src/test/java/org/junit/platform/StackTracePruningTests.java +++ b/platform-tests/src/test/java/org/junit/platform/StackTracePruningTests.java @@ -195,6 +195,7 @@ private static void assertStackTraceDoesNotContain(List stack // ------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class FailingTestTestCase { @Test @@ -216,6 +217,7 @@ void failingAssumption() { } + @SuppressWarnings("JUnitMalformedDeclaration") static class FailingBeforeEachTestCase { @BeforeEach diff --git a/platform-tests/src/test/java/org/junit/platform/commons/support/ModifierSupportTests.java b/platform-tests/src/test/java/org/junit/platform/commons/support/ModifierSupportTests.java index 81fc84a10325..00ed5422a5b8 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/support/ModifierSupportTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/support/ModifierSupportTests.java @@ -45,6 +45,7 @@ void isPublicDelegates(Class clazz) { assertEquals(ReflectionUtils.isPublic(clazz), ModifierSupport.isPublic(clazz)); } + @SuppressWarnings("JUnitMalformedDeclaration") @Methods void isPublicDelegates(Method method) { assertEquals(ReflectionUtils.isPublic(method), ModifierSupport.isPublic(method)); @@ -61,6 +62,7 @@ void isPrivateDelegates(Class clazz) { assertEquals(ReflectionUtils.isPrivate(clazz), ModifierSupport.isPrivate(clazz)); } + @SuppressWarnings("JUnitMalformedDeclaration") @Methods void isPrivateDelegates(Method method) { assertEquals(ReflectionUtils.isPrivate(method), ModifierSupport.isPrivate(method)); @@ -77,6 +79,7 @@ void isNotPrivateDelegates(Class clazz) { assertEquals(ReflectionUtils.isNotPrivate(clazz), ModifierSupport.isNotPrivate(clazz)); } + @SuppressWarnings("JUnitMalformedDeclaration") @Methods void isNotPrivateDelegates(Method method) { assertEquals(ReflectionUtils.isNotPrivate(method), ModifierSupport.isNotPrivate(method)); @@ -93,6 +96,7 @@ void isAbstractDelegates(Class clazz) { assertEquals(ReflectionUtils.isAbstract(clazz), ModifierSupport.isAbstract(clazz)); } + @SuppressWarnings("JUnitMalformedDeclaration") @Methods void isAbstractDelegates(Method method) { assertEquals(ReflectionUtils.isAbstract(method), ModifierSupport.isAbstract(method)); @@ -109,6 +113,7 @@ void isStaticDelegates(Class clazz) { assertEquals(ReflectionUtils.isStatic(clazz), ModifierSupport.isStatic(clazz)); } + @SuppressWarnings("JUnitMalformedDeclaration") @Methods void isStaticDelegates(Method method) { assertEquals(ReflectionUtils.isStatic(method), ModifierSupport.isStatic(method)); @@ -125,6 +130,7 @@ void isNotStaticDelegates(Class clazz) { assertEquals(ReflectionUtils.isNotStatic(clazz), ModifierSupport.isNotStatic(clazz)); } + @SuppressWarnings("JUnitMalformedDeclaration") @Methods void isNotStaticDelegates(Method method) { assertEquals(ReflectionUtils.isNotStatic(method), ModifierSupport.isNotStatic(method)); @@ -141,6 +147,7 @@ void isFinalDelegates(Class clazz) { assertEquals(ReflectionUtils.isFinal(clazz), ModifierSupport.isFinal(clazz)); } + @SuppressWarnings("JUnitMalformedDeclaration") @Methods void isFinalDelegates(Method method) { assertEquals(ReflectionUtils.isFinal(method), ModifierSupport.isFinal(method)); @@ -157,6 +164,7 @@ void isNotFinalDelegates(Class clazz) { assertEquals(ReflectionUtils.isNotFinal(clazz), ModifierSupport.isNotFinal(clazz)); } + @SuppressWarnings("JUnitMalformedDeclaration") @Methods void isNotFinalDelegates(Method method) { assertEquals(ReflectionUtils.isNotFinal(method), ModifierSupport.isNotFinal(method)); diff --git a/platform-tests/src/test/java/org/junit/platform/console/ConsoleDetailsTests.java b/platform-tests/src/test/java/org/junit/platform/console/ConsoleDetailsTests.java index 2a3c4571f5ee..f4d7d80e4609 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/ConsoleDetailsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/ConsoleDetailsTests.java @@ -109,6 +109,7 @@ private List scanContainerClassAndCreateDynamicTests(Class conta return nodes; } + @SuppressWarnings("JUnitMalformedDeclaration") @DisplayName("Basic") static class BasicTestCase { @@ -123,6 +124,7 @@ void changeDisplayName() { } + @SuppressWarnings("JUnitMalformedDeclaration") @DisplayName("Skip") static class SkipTestCase { @@ -138,6 +140,7 @@ void skipWithMultiLineMessage() { } + @SuppressWarnings("JUnitMalformedDeclaration") @DisplayName("Fail") static class FailTestCase { @@ -153,6 +156,7 @@ void failWithMultiLineMessage() { } + @SuppressWarnings("JUnitMalformedDeclaration") @DisplayName("Report") static class ReportTestCase { diff --git a/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTest.java b/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTest.java index ecbe48c2e587..be1624fa7d87 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTest.java +++ b/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTest.java @@ -18,6 +18,7 @@ // problem since the test method here can never fail. class ContainerForStaticNestedTest { + @SuppressWarnings("JUnitMalformedDeclaration") static class NestedTest { @Test diff --git a/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTests.java b/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTests.java index 9f51d250dee0..bf95368df12a 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTests.java @@ -18,6 +18,7 @@ // problem since the test method here can never fail. class ContainerForStaticNestedTests { + @SuppressWarnings("JUnitMalformedDeclaration") static class NestedTests { @Test diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLockAnnotationTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLockAnnotationTests.java index 414e31c96993..e5f3d65fb099 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLockAnnotationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLockAnnotationTests.java @@ -214,6 +214,7 @@ private Set getNestedClassResources(Class testClass, Class // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class NoSharedResourcesTestCase { @Test @@ -225,6 +226,7 @@ class NestedClass { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ResourceLock("a1") @ResourceLock(value = "a2", mode = ResourceAccessMode.READ_WRITE) static class SharedResourcesViaAnnotationValueTestCase { @@ -242,6 +244,7 @@ class NestedClass { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ResourceLock(providers = { // SharedResourcesViaAnnotationProvidersTestCase.FirstClassLevelProvider.class, // SharedResourcesViaAnnotationProvidersTestCase.SecondClassLevelProvider.class // @@ -296,6 +299,7 @@ public Set provideForNestedClass(Class testClass) { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ResourceLock( // value = "a1", // mode = ResourceAccessMode.READ_WRITE, // @@ -341,6 +345,7 @@ public Set provideForNestedClass(Class testClass) { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ResourceLock static class EmptyAnnotationTestCase { @@ -357,6 +362,7 @@ class NestedClass { static class NestedNestedTestCase { + @SuppressWarnings("JUnitMalformedDeclaration") @Nested @ResourceLock(providers = NestedNestedTestCase.Provider.class) static class NestedClass { diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalkerIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalkerIntegrationTests.java index afb9addda85f..6e0a7f4c78c9 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalkerIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalkerIntegrationTests.java @@ -192,6 +192,7 @@ private TestDescriptor discover(Class testClass) { return new JupiterTestEngine().discover(discoveryRequest, UniqueId.forEngine("junit-jupiter")); } + @SuppressWarnings("JUnitMalformedDeclaration") @ResourceLock("a") static class TestCaseWithResourceLock { @Test @@ -200,6 +201,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCaseWithoutResourceLock { @Test @ResourceLock("a") @@ -227,6 +229,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ResourceLock("a") static class TestCaseWithResourceWriteLockOnClass { @Test @@ -234,6 +237,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ResourceLock(value = "a", mode = ResourceAccessMode.READ) static class TestCaseWithResourceReadLockOnClass { @Test @@ -241,6 +245,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ResourceLock(value = "a", mode = ResourceAccessMode.READ) static class TestCaseWithResourceReadLockOnClassAndWriteClockOnTestCase { @Test @@ -249,6 +254,7 @@ void test() { } } + @SuppressWarnings("JUnitMalformedDeclaration") @ResourceLock(value = "a", mode = ResourceAccessMode.READ) static class TestCaseWithResourceReadLockOnClassAndReadClockOnTestCase { @Test diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SameThreadExecutionIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SameThreadExecutionIntegrationTests.java index 64b1939cfe5e..ab06a7ed6982 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SameThreadExecutionIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SameThreadExecutionIntegrationTests.java @@ -53,6 +53,7 @@ private LogRecord firstDebugLogRecord(LogRecordListener listener) throws Asserti // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") @TestMethodOrder(MethodName.class) static class InterruptedThreadTestCase { diff --git a/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingExecutionListenerIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingExecutionListenerIntegrationTests.java index c209c692907b..7d3fe88736a4 100644 --- a/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingExecutionListenerIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingExecutionListenerIntegrationTests.java @@ -65,6 +65,7 @@ void reportsEvents() { .with("reason", "for demonstration purposes")); } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase { @Test void test(TestReporter reporter) { diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/TagIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/TagIntegrationTests.java index 745550c514f6..027a2228b1a8 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/TagIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/TagIntegrationTests.java @@ -85,6 +85,7 @@ private void executeTaggedTestCase(PostDiscoveryFilter filter) { .execute(); } + @SuppressWarnings("JUnitMalformedDeclaration") static class TaggedTestCase { static boolean tag1WasExecuted = false; diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherConfigurationParametersTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherConfigurationParametersTests.java index 3ef5cb275ee4..ccac05dcc9f7 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherConfigurationParametersTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherConfigurationParametersTests.java @@ -266,6 +266,7 @@ public void postProcessTestInstance(Object testInstance, ExtensionContext contex } } + @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith(Mutator.class) static class Something { diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilderTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilderTests.java index 7bd1fc8f5d31..fcd7345b227f 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilderTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilderTests.java @@ -397,6 +397,7 @@ void createsCompositeForMultipleListeners() { } + @SuppressWarnings("JUnitMalformedDeclaration") private static class SampleTestClass { @Test diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherFactoryTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherFactoryTests.java index e3831ab4e81e..ed5b7d755c68 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherFactoryTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherFactoryTests.java @@ -360,7 +360,7 @@ private LauncherDiscoveryRequest createLauncherDiscoveryRequestForBothStandardEn // @formatter:on } - @SuppressWarnings("NewClassNamingConvention") + @SuppressWarnings({ "NewClassNamingConvention", "JUnitMalformedDeclaration" }) public static class JUnit4Example { @org.junit.Test @@ -369,7 +369,7 @@ public void testJ4() { } - @SuppressWarnings("NewClassNamingConvention") + @SuppressWarnings({ "NewClassNamingConvention", "JUnitMalformedDeclaration" }) static class JUnit5Example { @Tag("test-post-discovery") diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListenerIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListenerIntegrationTests.java index 9d56bddc5761..ada4c823a6ad 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListenerIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListenerIntegrationTests.java @@ -294,6 +294,7 @@ private Stream readAllFiles(String outputDir, String prefix) throws IOEx // ------------------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase1 { @Test @@ -321,6 +322,7 @@ Stream dynamicTests() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase2 { @Test @@ -332,6 +334,7 @@ void testB() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase3 { @Test @@ -343,6 +346,7 @@ void testD() { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase4 { @Test diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/StatefulTestCase.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/StatefulTestCase.java index 3a2a32230c27..b480a7349aa7 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/StatefulTestCase.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/StatefulTestCase.java @@ -24,6 +24,7 @@ public class StatefulTestCase { public static List callSequence = new ArrayList<>(); + @SuppressWarnings("JUnitMalformedDeclaration") public static class Test1 { @Test @@ -33,6 +34,7 @@ void statefulTest() { } + @SuppressWarnings("JUnitMalformedDeclaration") public static class Test2 { @Test diff --git a/platform-tests/src/test/java/org/junit/platform/testkit/engine/EngineTestKitTests.java b/platform-tests/src/test/java/org/junit/platform/testkit/engine/EngineTestKitTests.java index 20d71f0c3def..6e852b821fb7 100644 --- a/platform-tests/src/test/java/org/junit/platform/testkit/engine/EngineTestKitTests.java +++ b/platform-tests/src/test/java/org/junit/platform/testkit/engine/EngineTestKitTests.java @@ -67,6 +67,7 @@ private Optional executeExampleTestCaseAndCollectValue(UnaryOperator stats.skipped(1).started(3).succeeded(1).aborted(1).failed(1)); } + @SuppressWarnings("JUnitMalformedDeclaration") static class ExampleTestCase { @Test diff --git a/platform-tests/src/test/java/org/junit/platform/testkit/engine/NestedContainerEventConditionTests.java b/platform-tests/src/test/java/org/junit/platform/testkit/engine/NestedContainerEventConditionTests.java index e7faa286c983..d328eb1065d5 100644 --- a/platform-tests/src/test/java/org/junit/platform/testkit/engine/NestedContainerEventConditionTests.java +++ b/platform-tests/src/test/java/org/junit/platform/testkit/engine/NestedContainerEventConditionTests.java @@ -123,6 +123,7 @@ void eventConditionsForMultipleLevelsOfNestedClasses() { // @formatter:on } + @SuppressWarnings("JUnitMalformedDeclaration") static class ATestCase { @Test From fe8c5f0ceb1c132436dce8a884c327317c701f22 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 9 Oct 2024 09:11:33 +0200 Subject: [PATCH 162/611] Replace annotation with boolean-returning method --- .../src/docs/asciidoc/link-attributes.adoc | 2 +- .../release-notes-5.12.0-M1.adoc | 8 +- .../docs/asciidoc/user-guide/extensions.adoc | 30 ++++--- .../EnableTestScopedConstructorContext.java | 80 ------------------- .../jupiter/api/extension/Extension.java | 67 ++++++++++++++++ .../api/extension/InvocationInterceptor.java | 7 +- .../api/extension/ParameterResolver.java | 10 +-- .../api/extension/TestInstanceFactory.java | 3 +- .../extension/TestInstancePostProcessor.java | 3 +- .../TestInstancePreConstructCallback.java | 8 +- .../execution/ExtensionContextSupplier.java | 4 +- .../engine/extension/TempDirectory.java | 7 +- .../ExtensionComposabilityTests.java | 2 +- .../api/extension/KitchenSinkExtension.java | 5 ++ .../extension/TestInstanceFactoryTests.java | 11 ++- .../TestInstancePostProcessorTests.java | 13 ++- ...TestInstancePreConstructCallbackTests.java | 19 ++++- 17 files changed, 148 insertions(+), 131 deletions(-) delete mode 100644 junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/EnableTestScopedConstructorContext.java diff --git a/documentation/src/docs/asciidoc/link-attributes.adoc b/documentation/src/docs/asciidoc/link-attributes.adoc index 90a80a566f55..af3b1665b084 100644 --- a/documentation/src/docs/asciidoc/link-attributes.adoc +++ b/documentation/src/docs/asciidoc/link-attributes.adoc @@ -139,10 +139,10 @@ endif::[] :BeforeAllCallback: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/BeforeAllCallback.html[BeforeAllCallback] :BeforeEachCallback: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/BeforeEachCallback.html[BeforeEachCallback] :BeforeTestExecutionCallback: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/BeforeTestExecutionCallback.html[BeforeTestExecutionCallback] -:EnableTestScopedConstructorContext: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/EnableTestScopedConstructorContext.html[@EnableTestScopedConstructorContext] :ExecutableInvoker: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/ExecutableInvoker.html[ExecutableInvoker] :ExecutionCondition: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/ExecutionCondition.html[ExecutionCondition] :ExtendWith: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/ExtendWith.html[@ExtendWith] +:Extension: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/Extension.html[Extension] :ExtensionContext: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/ExtensionContext.html[ExtensionContext] :ExtensionContext_Store: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/ExtensionContext.Store.html[Store] :InvocationInterceptor: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/InvocationInterceptor.html[InvocationInterceptor] diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 08a328c14cd3..5d4e04aca1b6 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -58,10 +58,10 @@ JUnit repository on GitHub. extensions. * Allow determining "shared resources" at runtime via the new `@ResourceLock#providers` attribute that accepts implementations of `ResourceLocksProvider`. -* `@EnableTestScopedConstructorContext` has been added to enable the use of a test-scoped - `ExtensionContext` while instantiating the test instance. - The behavior enabled by the annotation is expected to eventually become the default in - future versions of JUnit Jupiter. +* Overriding `Extension.isTestScopedConstructorContextEnabled()` enables using a + test-scoped `ExtensionContext` in `Extension` methods called during test class + instantiation. + This behavior will become the default in future versions of JUnit Jupiter. * `@TempDir` is now supported on test class constructors. diff --git a/documentation/src/docs/asciidoc/user-guide/extensions.adoc b/documentation/src/docs/asciidoc/user-guide/extensions.adoc index 12f8b6ad54ad..6e103f4c1e8c 100644 --- a/documentation/src/docs/asciidoc/user-guide/extensions.adoc +++ b/documentation/src/docs/asciidoc/user-guide/extensions.adoc @@ -383,8 +383,9 @@ instances and their lifecycle. [NOTE] ==== -You may annotate your extension with `{EnableTestScopedConstructorContext}` for revised -handling of `CloseableResource` and to make test-specific data available to your implementation. +You may override the `{Extension}.isTestScopedConstructorContextEnabled(...)` method to +return `true` for revised handling of `CloseableResource` and to make test-specific data +available to your implementation. ==== [[extensions-test-instance-factories]] @@ -415,8 +416,9 @@ registered for any specific test class. [NOTE] ==== -You may annotate your extension with `{EnableTestScopedConstructorContext}` for revised -handling of `CloseableResource` and to make test-specific data available to your implementation. +You may override the `{Extension}.isTestScopedConstructorContextEnabled(...)` method to +return `true` for revised handling of `CloseableResource` and to make test-specific data +available to your implementation. ==== [[extensions-test-instance-post-processing]] @@ -433,8 +435,9 @@ For a concrete example, consult the source code for the `{MockitoExtension}` and [NOTE] ==== -You may annotate your extension with `{EnableTestScopedConstructorContext}` for revised -handling of `CloseableResource` and to make test-specific data available to your implementation. +You may override the `{Extension}.isTestScopedConstructorContextEnabled(...)` method to +return `true` for revised handling of `CloseableResource` and to make test-specific data +available to your implementation. ==== [[extensions-test-instance-pre-destroy-callback]] @@ -485,10 +488,11 @@ those provided in `java.lang.reflect.Parameter` in order to avoid this bug in th [NOTE] ==== -You may annotate your extension with `{EnableTestScopedConstructorContext}` to support -injecting test specific data into constructor parameters of the test instance. -The annotation makes JUnit use a test-specific `ExtensionContext` while resolving -constructor parameters, unless the lifecycle is set to `TestInstance.Lifecycle.PER_CLASS`. +You may override the `{Extension}.isTestScopedConstructorContextEnabled(...)` method to +return `true` to support injecting test specific data into constructor parameters of the +test instance. Doing so causes a test-specific `{ExtensionContext}` to be used while +resolving constructor parameters, unless the +<> is set to `PER_CLASS`. ==== [NOTE] @@ -723,9 +727,9 @@ include::{testDir}/example/interceptor/SwingEdtInterceptor.java[tags=user_guide] [NOTE] ==== -You may annotate your extension with `{EnableTestScopedConstructorContext}` to make -test-specific data available to your implementation of `interceptTestClassConstructor` and -for a revised scope of the provided `Store` instance. +You may override the `{Extension}.isTestScopedConstructorContextEnabled(...)` method to +return `true` to make test-specific data available to your implementation of +`interceptTestClassConstructor` and for a revised scope of the provided `Store` instance. ==== [[extensions-test-templates]] diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/EnableTestScopedConstructorContext.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/EnableTestScopedConstructorContext.java deleted file mode 100644 index 58a3cc65ce5a..000000000000 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/EnableTestScopedConstructorContext.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2015-2024 the original author or authors. - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v2.0 which - * accompanies this distribution and is available at - * - * https://www.eclipse.org/legal/epl-v20.html - */ - -package org.junit.jupiter.api.extension; - -import static org.apiguardian.api.API.Status.MAINTAINED; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.apiguardian.api.API; -import org.junit.jupiter.api.TestInstance; -import org.junit.jupiter.api.extension.ExtensionContext.Store; -import org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource; - -/** - * {@code @EnableTestScopedConstructorContext} allows - * {@link Extension Extensions} to use a test-scoped {@link ExtensionContext} - * during creation of test instances. - * - *

The annotation should be used on extension classes. - * JUnit will call the following extension callbacks of annotated extensions - * with a test-scoped {@link ExtensionContext}, unless the test class is - * annotated with {@link TestInstance @TestInstance(Lifecycle.PER_CLASS)}. - * - *

    - *
  • {@link InvocationInterceptor#interceptTestClassConstructor(InvocationInterceptor.Invocation, ReflectiveInvocationContext, ExtensionContext) InvocationInterceptor.interceptTestClassConstructor(...)}
  • - *
  • {@link ParameterResolver} when resolving constructor parameters
  • - *
  • {@link TestInstancePreConstructCallback}
  • - *
  • {@link TestInstancePostProcessor}
  • - *
  • {@link TestInstanceFactory}
  • - *
- * - *

Implementations of these extension callbacks can observe the following - * differences if they are using {@code @EnableTestScopedConstructorContext}. - * - *

    - *
  • {@link ExtensionContext#getElement() getElement()} may refer to the test - * method and {@link ExtensionContext#getTestClass() getTestClass()} may refer - * to a nested test class. Use {@link TestInstanceFactoryContext#getTestClass()} - * to get the class under construction.
  • - *
  • {@link ExtensionContext#getTestMethod() getTestMethod()} is no-longer - * empty, unless the test class is annotated with - * {@link TestInstance @TestInstance(Lifecycle.PER_CLASS)}.
  • - *
  • If the callback adds a new {@link CloseableResource CloseableResource} to - * the {@link Store Store}, the resource is closed just after the instance is - * destroyed.
  • - *
  • The callbacks can now access data previously stored by - * {@link TestTemplateInvocationContext}, unless the test class is annotated - * with {@link TestInstance @TestInstance(Lifecycle.PER_CLASS)}.
  • - *
- * - *

Note: The behavior which is enabled by this annotation is - * expected to become the default in future versions of JUnit Jupiter. To ensure - * future compatibility, extension vendors are therefore advised to annotate - * their extensions, even if they don't need the new functionality. - * - * @since 5.12 - * @see InvocationInterceptor - * @see ParameterResolver - * @see TestInstancePreConstructCallback - * @see TestInstancePostProcessor - * @see TestInstanceFactory - */ -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -@Inherited -@API(status = MAINTAINED, since = "5.12") -public @interface EnableTestScopedConstructorContext { -} diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extension.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extension.java index 78c68ab96867..d0121293b38f 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extension.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extension.java @@ -10,9 +10,13 @@ package org.junit.jupiter.api.extension; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.STABLE; import org.apiguardian.api.API; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.extension.ExtensionContext.Store; +import org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource; /** * Marker interface for all extensions. @@ -38,4 +42,67 @@ */ @API(status = STABLE, since = "5.0") public interface Extension { + + /** + * Whether this extension should receive a test-scoped + * {@link ExtensionContext} during the creation of test instances. + * + *

If an extension returns {@code true} from this method, the following\ + * extension methods will be called with a test-scoped + * {@link ExtensionContext}, unless the test class is annotated with + * {@link TestInstance @TestInstance(Lifecycle.PER_CLASS)}: + * + *

    + *
  • {@link InvocationInterceptor#interceptTestClassConstructor}
  • + *
  • {@link ParameterResolver} when resolving constructor parameters
  • + *
  • {@link TestInstancePreConstructCallback}
  • + *
  • {@link TestInstancePostProcessor}
  • + *
  • {@link TestInstanceFactory}
  • + *
+ * + *

Implementations of these extension callbacks can observe the following + * differences if they are returning {@code true} from this method: + * + *

    + *
  • {@link ExtensionContext#getElement() getElement()} may refer to the + * test method and {@link ExtensionContext#getTestClass() getTestClass()} + * may refer to a nested test class. + * Use {@link TestInstanceFactoryContext#getTestClass()} to get the class + * under construction.
  • + *
  • {@link ExtensionContext#getTestMethod() getTestMethod()} is no-longer + * empty, unless the test class is annotated with + * {@link TestInstance @TestInstance(Lifecycle.PER_CLASS)}.
  • + *
  • If the callback adds a new {@link CloseableResource} to the + * {@link Store}, the resource is closed just after the instance is + * destroyed.
  • + *
  • The callbacks can now access data previously stored by + * {@link TestTemplateInvocationContext}, unless the test class is annotated + * with {@link TestInstance @TestInstance(Lifecycle.PER_CLASS)}.
  • + *
+ * + *

Note: The behavior which is enabled by returning + * {@code true} from this method will become the default in future versions + * of JUnit Jupiter. To ensure future compatibility, extension implementors + * are therefore advised to opt in, even if they don't require the new + * functionality. + * + * @implNote There are no guarantees about how often this method is called. + * Therefore, implementations should be idempotent and avoid side + * effects. They may, however, cache the result for performance in + * the {@link Store Store} of the supplied + * {@link ExtensionContext}. + * @param rootContext the root extension context to allow inspection of + * configuration parameters; never {@code null} + * @since 5.12 + * @see InvocationInterceptor#interceptTestClassConstructor + * @see ParameterResolver + * @see TestInstancePreConstructCallback + * @see TestInstancePostProcessor + * @see TestInstanceFactory + */ + @API(status = EXPERIMENTAL, since = "5.12") + default boolean isTestScopedConstructorContextEnabled(ExtensionContext rootContext) { + return false; + } + } diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java index c13e6ed841d1..d5f74cf12177 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java @@ -25,6 +25,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestFactory; import org.junit.jupiter.api.TestTemplate; +import org.junit.jupiter.api.extension.ExtensionContext.Store; /** * {@code InvocationInterceptor} defines the API for {@link Extension @@ -58,9 +59,9 @@ public interface InvocationInterceptor extends Extension { *

Note that the test class may not have been initialized * (static initialization) when this method is invoked. * - *

You may annotate your extension with {@link EnableTestScopedConstructorContext} - * to make test-specific data available to your implementation of this method and - * for a revised scope of the provided `Store` instance. + *

Extensions may override {@link #isTestScopedConstructorContextEnabled} + * to make test-specific data available to the implementation of this method + * and for a revised scope of the provided {@link Store} instance. * * @param invocation the invocation that is being intercepted; never * {@code null} diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java index 74ad7feaae61..a52082e623dd 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java @@ -31,11 +31,11 @@ * an argument for the parameter must be resolved at runtime by a * {@code ParameterResolver}. * - *

You may annotate your extension with {@link EnableTestScopedConstructorContext} - * to support injecting test specific data into constructor parameters of the test instance. - * The annotation makes JUnit use a test-specific `ExtensionContext` while resolving - * constructor parameters, unless the test class is annotated with - * {@link TestInstance @TestInstance(Lifecycle.PER_CLASS)}. + *

Extensions may override {@link #isTestScopedConstructorContextEnabled} + * to support injecting test specific data into constructor parameters of the + * test instance. Returning {@code true} from this method, causes a + * test-specific {@link ExtensionContext} to be used while resolving constructor + * parameters, unless the lifecycle is set to {@link TestInstance.Lifecycle#PER_CLASS PER_CLASS}. * *

Constructor Requirements

* diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java index f341e88e3e2d..ee05914b3053 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java @@ -57,8 +57,7 @@ public interface TestInstanceFactory extends Extension { /** * Callback for creating a test instance for the supplied context. * - *

You may annotate your extension with - * {@link EnableTestScopedConstructorContext @EnableTestScopedConstructorContext} + *

Extensions may override {@link #isTestScopedConstructorContextEnabled} * for revised handling of {@link CloseableResource CloseableResource} and * to make test-specific data available to your implementation. * diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java index a1aa465c5737..bee27445dfc9 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java @@ -46,8 +46,7 @@ public interface TestInstancePostProcessor extends Extension { /** * Callback for post-processing the supplied test instance. * - *

You may annotate your extension with - * {@link EnableTestScopedConstructorContext @EnableTestScopedConstructorContext} + *

Extensions may override {@link #isTestScopedConstructorContextEnabled} * for revised handling of {@link CloseableResource CloseableResource} and * to make test-specific data available to your implementation. * diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java index b627c52f9132..0c6a77086227 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java @@ -14,7 +14,6 @@ import org.apiguardian.api.API; import org.junit.jupiter.api.TestInstance.Lifecycle; -import org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource; /** * {@code TestInstancePreConstructCallback} defines the API for {@link Extension @@ -50,10 +49,9 @@ public interface TestInstancePreConstructCallback extends Extension { /** * Callback invoked prior to test instances being constructed. * - *

You may annotate your extension with - * {@link EnableTestScopedConstructorContext @EnableTestScopedConstructorContext} - * for revised handling of {@link CloseableResource CloseableResource} and - * to make test-specific data available to your implementation. + *

Extensions may override {@link #isTestScopedConstructorContextEnabled} + * to make test-specific data available to the implementation of this method + * and for a revised scope of the provided {@link ExtensionContext.Store} instance. * * @param factoryContext the context for the test instance about to be instantiated; * never {@code null} diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java index 1a81c0df6536..84b558375784 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java @@ -13,10 +13,8 @@ import static org.apiguardian.api.API.Status.INTERNAL; import org.apiguardian.api.API; -import org.junit.jupiter.api.extension.EnableTestScopedConstructorContext; import org.junit.jupiter.api.extension.Extension; import org.junit.jupiter.api.extension.ExtensionContext; -import org.junit.platform.commons.util.AnnotationUtils; /** * Container of two instances of {@link ExtensionContext} to simplify the legacy for @@ -37,7 +35,7 @@ public ExtensionContextSupplier(ExtensionContext currentExtensionContext, Extens public ExtensionContext get(Extension extension) { if (currentExtensionContext == legacyExtensionContext - || AnnotationUtils.isAnnotated(extension.getClass(), EnableTestScopedConstructorContext.class)) { + || extension.isTestScopedConstructorContextEnabled(currentExtensionContext.getRoot())) { return currentExtensionContext; } else { diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java index ff6484b960bb..e0ae5eb46631 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java @@ -44,7 +44,6 @@ import org.junit.jupiter.api.extension.AnnotatedElementContext; import org.junit.jupiter.api.extension.BeforeAllCallback; import org.junit.jupiter.api.extension.BeforeEachCallback; -import org.junit.jupiter.api.extension.EnableTestScopedConstructorContext; import org.junit.jupiter.api.extension.ExtensionConfigurationException; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ExtensionContext.Namespace; @@ -77,7 +76,6 @@ * @see TempDir * @see Files#createTempDirectory */ -@EnableTestScopedConstructorContext class TempDirectory implements BeforeAllCallback, BeforeEachCallback, ParameterResolver { static final Namespace NAMESPACE = Namespace.create(TempDirectory.class); @@ -94,6 +92,11 @@ public TempDirectory(JupiterConfiguration configuration) { this.configuration = configuration; } + @Override + public boolean isTestScopedConstructorContextEnabled(ExtensionContext rootContext) { + return true; + } + /** * Perform field injection for non-private, {@code static} fields (i.e., * class fields) of type {@link Path} or {@link File} that are annotated with diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExtensionComposabilityTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExtensionComposabilityTests.java index b624bed90df4..ec5e79116795 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExtensionComposabilityTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExtensionComposabilityTests.java @@ -146,7 +146,7 @@ private List> findExtensionApis() { } private boolean isExtensionApi(Class candidate) { - return candidate.isInterface() && (candidate != Extension.class) && Extension.class.isAssignableFrom(candidate); + return candidate.isInterface() && Extension.class.isAssignableFrom(candidate); } private String methodSignature(Method method) { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java index 47990d9bdce0..cb49945ab29a 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java @@ -65,6 +65,11 @@ public class KitchenSinkExtension implements // @formatter:on { + @Override + public boolean isTestScopedConstructorContextEnabled(ExtensionContext rootContext) { + return true; + } + // --- Lifecycle Callbacks ------------------------------------------------- @Override diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java index 8ed6da8c23d8..1270909909c3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java @@ -35,7 +35,6 @@ import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; -import org.junit.jupiter.api.extension.EnableTestScopedConstructorContext; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtensionConfigurationException; import org.junit.jupiter.api.extension.ExtensionContext; @@ -721,12 +720,18 @@ public Object createTestInstance(TestInstanceFactoryContext factoryContext, Exte } } - @EnableTestScopedConstructorContext private static class FooInstanceFactory extends AbstractTestInstanceFactory { + @Override + public boolean isTestScopedConstructorContextEnabled(ExtensionContext rootContext) { + return true; + } } - @EnableTestScopedConstructorContext private static class BarInstanceFactory extends AbstractTestInstanceFactory { + @Override + public boolean isTestScopedConstructorContextEnabled(ExtensionContext rootContext) { + return true; + } } private static class LegacyInstanceFactory extends AbstractTestInstanceFactory { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java index b6c1a3aaf976..16219a8c0c23 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java @@ -21,7 +21,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.EnableTestScopedConstructorContext; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.TestInstancePostProcessor; @@ -200,18 +199,26 @@ public void postProcessTestInstance(Object testInstance, ExtensionContext contex } } - @EnableTestScopedConstructorContext static class FooInstancePostProcessor extends AbstractInstancePostProcessor { FooInstancePostProcessor() { super("foo"); } + + @Override + public boolean isTestScopedConstructorContextEnabled(ExtensionContext rootContext) { + return true; + } } - @EnableTestScopedConstructorContext static class BarInstancePostProcessor extends AbstractInstancePostProcessor { BarInstancePostProcessor() { super("bar"); } + + @Override + public boolean isTestScopedConstructorContextEnabled(ExtensionContext rootContext) { + return true; + } } static class LegacyInstancePostProcessor extends AbstractInstancePostProcessor { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java index b3536eeae8d7..bbe2897d640a 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java @@ -23,7 +23,6 @@ import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; -import org.junit.jupiter.api.extension.EnableTestScopedConstructorContext; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.RegisterExtension; @@ -558,25 +557,37 @@ else if (context.getTestInstanceLifecycle().orElse(null) != TestInstance.Lifecyc } } - @EnableTestScopedConstructorContext static class InstancePreConstructCallbackRecordingFoo extends AbstractTestInstancePreConstructCallback { InstancePreConstructCallbackRecordingFoo() { super("foo"); } + + @Override + public boolean isTestScopedConstructorContextEnabled(ExtensionContext rootContext) { + return true; + } } - @EnableTestScopedConstructorContext static class InstancePreConstructCallbackRecordingBar extends AbstractTestInstancePreConstructCallback { InstancePreConstructCallbackRecordingBar() { super("bar"); } + + @Override + public boolean isTestScopedConstructorContextEnabled(ExtensionContext rootContext) { + return true; + } } - @EnableTestScopedConstructorContext static class InstancePreConstructCallbackRecordingBaz extends AbstractTestInstancePreConstructCallback { InstancePreConstructCallbackRecordingBaz() { super("baz"); } + + @Override + public boolean isTestScopedConstructorContextEnabled(ExtensionContext rootContext) { + return true; + } } static class InstancePreConstructCallbackRecordingLegacy extends AbstractTestInstancePreConstructCallback { From ddf9b19263c22b9fd6fba82b1fce35f5feb35527 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 9 Oct 2024 09:40:21 +0200 Subject: [PATCH 163/611] Return enum instead of boolean This avoids being able to opt out should the default be changed to test-scoped. --- .../release-notes-5.12.0-M1.adoc | 7 +-- .../docs/asciidoc/user-guide/extensions.adoc | 25 ++++---- .../jupiter/api/extension/Extension.java | 57 ++++++++++++++----- .../api/extension/InvocationInterceptor.java | 7 ++- .../api/extension/ParameterResolver.java | 12 ++-- .../api/extension/TestInstanceFactory.java | 7 ++- .../extension/TestInstancePostProcessor.java | 7 ++- .../TestInstancePreConstructCallback.java | 8 ++- .../execution/ExtensionContextSupplier.java | 9 ++- .../engine/extension/TempDirectory.java | 5 +- .../api/extension/KitchenSinkExtension.java | 4 +- .../extension/TestInstanceFactoryTests.java | 11 ++-- .../TestInstancePostProcessorTests.java | 11 ++-- ...TestInstancePreConstructCallbackTests.java | 16 ++++-- 14 files changed, 122 insertions(+), 64 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 5d4e04aca1b6..a716f5baa123 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -58,10 +58,9 @@ JUnit repository on GitHub. extensions. * Allow determining "shared resources" at runtime via the new `@ResourceLock#providers` attribute that accepts implementations of `ResourceLocksProvider`. -* Overriding `Extension.isTestScopedConstructorContextEnabled()` enables using a - test-scoped `ExtensionContext` in `Extension` methods called during test class - instantiation. - This behavior will become the default in future versions of JUnit Jupiter. +* Overriding `Extension.getExtensionContextScopeDuringTestInstanceConstruction()` enables + using a test-scoped `ExtensionContext` in `Extension` methods called during test class + construction. This behavior will become the default in future versions of JUnit. * `@TempDir` is now supported on test class constructors. diff --git a/documentation/src/docs/asciidoc/user-guide/extensions.adoc b/documentation/src/docs/asciidoc/user-guide/extensions.adoc index 6e103f4c1e8c..16452ced7de1 100644 --- a/documentation/src/docs/asciidoc/user-guide/extensions.adoc +++ b/documentation/src/docs/asciidoc/user-guide/extensions.adoc @@ -383,8 +383,9 @@ instances and their lifecycle. [NOTE] ==== -You may override the `{Extension}.isTestScopedConstructorContextEnabled(...)` method to -return `true` for revised handling of `CloseableResource` and to make test-specific data +You may override the +`{Extension}.getExtensionContextScopeDuringTestInstanceConstruction(...)` method to return +`TEST_SCOPED` for revised handling of `CloseableResource` and to make test-specific data available to your implementation. ==== @@ -416,8 +417,9 @@ registered for any specific test class. [NOTE] ==== -You may override the `{Extension}.isTestScopedConstructorContextEnabled(...)` method to -return `true` for revised handling of `CloseableResource` and to make test-specific data +You may override the +`{Extension}.getExtensionContextScopeDuringTestInstanceConstruction(...)` method to return +`TEST_SCOPED` for revised handling of `CloseableResource` and to make test-specific data available to your implementation. ==== @@ -435,8 +437,9 @@ For a concrete example, consult the source code for the `{MockitoExtension}` and [NOTE] ==== -You may override the `{Extension}.isTestScopedConstructorContextEnabled(...)` method to -return `true` for revised handling of `CloseableResource` and to make test-specific data +You may override the +`{Extension}.getExtensionContextScopeDuringTestInstanceConstruction(...)` method to return +`TEST_SCOPED` for revised handling of `CloseableResource` and to make test-specific data available to your implementation. ==== @@ -488,8 +491,9 @@ those provided in `java.lang.reflect.Parameter` in order to avoid this bug in th [NOTE] ==== -You may override the `{Extension}.isTestScopedConstructorContextEnabled(...)` method to -return `true` to support injecting test specific data into constructor parameters of the +You may override the +`{Extension}.getExtensionContextScopeDuringTestInstanceConstruction(...)` method to return +`TEST_SCOPED` to support injecting test specific data into constructor parameters of the test instance. Doing so causes a test-specific `{ExtensionContext}` to be used while resolving constructor parameters, unless the <> is set to `PER_CLASS`. @@ -727,8 +731,9 @@ include::{testDir}/example/interceptor/SwingEdtInterceptor.java[tags=user_guide] [NOTE] ==== -You may override the `{Extension}.isTestScopedConstructorContextEnabled(...)` method to -return `true` to make test-specific data available to your implementation of +You may override the +`{Extension}.getExtensionContextScopeDuringTestInstanceConstruction(...)` method to return +`TEST_SCOPED` to make test-specific data available to your implementation of `interceptTestClassConstructor` and for a revised scope of the provided `Store` instance. ==== diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extension.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extension.java index d0121293b38f..ac63d0c2eae2 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extension.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extension.java @@ -10,6 +10,7 @@ package org.junit.jupiter.api.extension; +import static org.apiguardian.api.API.Status.DEPRECATED; import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.STABLE; @@ -47,10 +48,11 @@ public interface Extension { * Whether this extension should receive a test-scoped * {@link ExtensionContext} during the creation of test instances. * - *

If an extension returns {@code true} from this method, the following\ - * extension methods will be called with a test-scoped - * {@link ExtensionContext}, unless the test class is annotated with - * {@link TestInstance @TestInstance(Lifecycle.PER_CLASS)}: + *

If an extension returns + * {@link ExtensionContextScope#TEST_SCOPED TEST_SCOPED} from this method, + * the following extension methods will be called with a test-scoped + * {@link ExtensionContext} instead of a class-scoped one, unless the + * {@link TestInstance.Lifecycle#PER_CLASS PER_CLASS} lifecycle is used: * *

    *
  • {@link InvocationInterceptor#interceptTestClassConstructor}
  • @@ -60,8 +62,8 @@ public interface Extension { *
  • {@link TestInstanceFactory}
  • *
* - *

Implementations of these extension callbacks can observe the following - * differences if they are returning {@code true} from this method: + *

In such cases, implementations of these extension callbacks can + * observe the following differences: * *

    *
  • {@link ExtensionContext#getElement() getElement()} may refer to the @@ -81,16 +83,16 @@ public interface Extension { *
* *

Note: The behavior which is enabled by returning - * {@code true} from this method will become the default in future versions - * of JUnit Jupiter. To ensure future compatibility, extension implementors - * are therefore advised to opt in, even if they don't require the new - * functionality. + * {@link ExtensionContextScope#TEST_SCOPED TEST_SCOPED} from this method + * will become the default in future versions of JUnit. To ensure future + * compatibility, extension implementors are therefore advised to opt in, + * even if they don't require the new functionality. * * @implNote There are no guarantees about how often this method is called. * Therefore, implementations should be idempotent and avoid side * effects. They may, however, cache the result for performance in * the {@link Store Store} of the supplied - * {@link ExtensionContext}. + * {@link ExtensionContext}, if necessary. * @param rootContext the root extension context to allow inspection of * configuration parameters; never {@code null} * @since 5.12 @@ -101,8 +103,37 @@ public interface Extension { * @see TestInstanceFactory */ @API(status = EXPERIMENTAL, since = "5.12") - default boolean isTestScopedConstructorContextEnabled(ExtensionContext rootContext) { - return false; + default ExtensionContextScope getExtensionContextScopeDuringTestInstanceConstruction(ExtensionContext rootContext) { + return ExtensionContextScope.DEFAULT; + } + + /** + * {@code ExtensionContextScope} is used to define the scope of the + * {@link ExtensionContext} passed to an extension during the creation of + * test instances. + * + * @since 5.12 + * @see org.junit.jupiter.api.extension.Extension#getExtensionContextScopeDuringTestInstanceConstruction + */ + @API(status = EXPERIMENTAL, since = "5.12") + enum ExtensionContextScope { + + /** + * The extension should receive an {@link ExtensionContext} scoped to + * the test class. + * + * @deprecated This behavior will be removed from future versions of + * JUnit and {@link #TEST_SCOPED} will become the default. + */ + @API(status = DEPRECATED, since = "5.12") // + @Deprecated + DEFAULT, + + /** + * The extension should receive an {@link ExtensionContext} scoped to + * the test instance. + */ + TEST_SCOPED } } diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java index d5f74cf12177..f54f8e1985b7 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java @@ -59,9 +59,10 @@ public interface InvocationInterceptor extends Extension { *

Note that the test class may not have been initialized * (static initialization) when this method is invoked. * - *

Extensions may override {@link #isTestScopedConstructorContextEnabled} - * to make test-specific data available to the implementation of this method - * and for a revised scope of the provided {@link Store} instance. + *

Extensions may override + * {@link #getExtensionContextScopeDuringTestInstanceConstruction} to make + * test-specific data available to the implementation of this method and for + * a revised scope of the provided {@link Store} instance. * * @param invocation the invocation that is being intercepted; never * {@code null} diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java index a52082e623dd..5cd86ad6a81d 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java @@ -31,11 +31,13 @@ * an argument for the parameter must be resolved at runtime by a * {@code ParameterResolver}. * - *

Extensions may override {@link #isTestScopedConstructorContextEnabled} - * to support injecting test specific data into constructor parameters of the - * test instance. Returning {@code true} from this method, causes a - * test-specific {@link ExtensionContext} to be used while resolving constructor - * parameters, unless the lifecycle is set to {@link TestInstance.Lifecycle#PER_CLASS PER_CLASS}. + *

Extensions may override + * {@link #getExtensionContextScopeDuringTestInstanceConstruction} to support + * injecting test specific data into constructor parameters of the test + * instance. Returning {@link ExtensionContextScope#TEST_SCOPED TEST_SCOPED} + * from this method, causes a test-specific {@link ExtensionContext} to be used + * while resolving constructor parameters, unless the lifecycle is set to + * {@link TestInstance.Lifecycle#PER_CLASS PER_CLASS}. * *

Constructor Requirements

* diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java index ee05914b3053..04bb2e6e0be4 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java @@ -57,9 +57,10 @@ public interface TestInstanceFactory extends Extension { /** * Callback for creating a test instance for the supplied context. * - *

Extensions may override {@link #isTestScopedConstructorContextEnabled} - * for revised handling of {@link CloseableResource CloseableResource} and - * to make test-specific data available to your implementation. + *

Extensions may override + * {@link #getExtensionContextScopeDuringTestInstanceConstruction} for + * revised handling of {@link CloseableResource CloseableResource} and to + * make test-specific data available to your implementation. * *

Note: the {@code ExtensionContext} supplied to a * {@code TestInstanceFactory} will always return an empty diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java index bee27445dfc9..c3f18d1c4d44 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java @@ -46,9 +46,10 @@ public interface TestInstancePostProcessor extends Extension { /** * Callback for post-processing the supplied test instance. * - *

Extensions may override {@link #isTestScopedConstructorContextEnabled} - * for revised handling of {@link CloseableResource CloseableResource} and - * to make test-specific data available to your implementation. + *

Extensions may override + * {@link #getExtensionContextScopeDuringTestInstanceConstruction} for + * revised handling of {@link CloseableResource CloseableResource} and to + * make test-specific data available to your implementation. * *

Note: the {@code ExtensionContext} supplied to a * {@code TestInstancePostProcessor} will always return an empty diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java index 0c6a77086227..6e946c6dd570 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java @@ -49,9 +49,11 @@ public interface TestInstancePreConstructCallback extends Extension { /** * Callback invoked prior to test instances being constructed. * - *

Extensions may override {@link #isTestScopedConstructorContextEnabled} - * to make test-specific data available to the implementation of this method - * and for a revised scope of the provided {@link ExtensionContext.Store} instance. + *

Extensions may override + * {@link #getExtensionContextScopeDuringTestInstanceConstruction} to make + * test-specific data available to the implementation of this method and for + * a revised scope of the provided {@link ExtensionContext.Store Store} + * instance. * * @param factoryContext the context for the test instance about to be instantiated; * never {@code null} diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java index 84b558375784..ca998f47c433 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java @@ -11,6 +11,7 @@ package org.junit.jupiter.engine.execution; import static org.apiguardian.api.API.Status.INTERNAL; +import static org.junit.jupiter.api.extension.Extension.ExtensionContextScope.TEST_SCOPED; import org.apiguardian.api.API; import org.junit.jupiter.api.extension.Extension; @@ -34,12 +35,16 @@ public ExtensionContextSupplier(ExtensionContext currentExtensionContext, Extens } public ExtensionContext get(Extension extension) { - if (currentExtensionContext == legacyExtensionContext - || extension.isTestScopedConstructorContextEnabled(currentExtensionContext.getRoot())) { + if (currentExtensionContext == legacyExtensionContext || isTestScoped(extension)) { return currentExtensionContext; } else { return legacyExtensionContext; } } + + private boolean isTestScoped(Extension extension) { + ExtensionContext rootContext = currentExtensionContext.getRoot(); + return extension.getExtensionContextScopeDuringTestInstanceConstruction(rootContext) == TEST_SCOPED; + } } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java index e0ae5eb46631..29dcac2179df 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java @@ -12,6 +12,7 @@ import static java.nio.file.FileVisitResult.CONTINUE; import static java.util.stream.Collectors.joining; +import static org.junit.jupiter.api.extension.Extension.ExtensionContextScope.TEST_SCOPED; import static org.junit.jupiter.api.io.CleanupMode.DEFAULT; import static org.junit.jupiter.api.io.CleanupMode.NEVER; import static org.junit.jupiter.api.io.CleanupMode.ON_SUCCESS; @@ -93,8 +94,8 @@ public TempDirectory(JupiterConfiguration configuration) { } @Override - public boolean isTestScopedConstructorContextEnabled(ExtensionContext rootContext) { - return true; + public ExtensionContextScope getExtensionContextScopeDuringTestInstanceConstruction(ExtensionContext rootContext) { + return TEST_SCOPED; } /** diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java index cb49945ab29a..bb4d06029f92 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java @@ -66,8 +66,8 @@ public class KitchenSinkExtension implements { @Override - public boolean isTestScopedConstructorContextEnabled(ExtensionContext rootContext) { - return true; + public ExtensionContextScope getExtensionContextScopeDuringTestInstanceConstruction(ExtensionContext rootContext) { + return ExtensionContextScope.TEST_SCOPED; } // --- Lifecycle Callbacks ------------------------------------------------- diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java index 1270909909c3..75e00765a2a3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java @@ -13,6 +13,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS; +import static org.junit.jupiter.api.extension.Extension.ExtensionContextScope.TEST_SCOPED; import static org.junit.platform.commons.util.ClassUtils.nullSafeToString; import static org.junit.platform.testkit.engine.EventConditions.container; import static org.junit.platform.testkit.engine.EventConditions.engine; @@ -722,15 +723,17 @@ public Object createTestInstance(TestInstanceFactoryContext factoryContext, Exte private static class FooInstanceFactory extends AbstractTestInstanceFactory { @Override - public boolean isTestScopedConstructorContextEnabled(ExtensionContext rootContext) { - return true; + public ExtensionContextScope getExtensionContextScopeDuringTestInstanceConstruction( + ExtensionContext rootContext) { + return TEST_SCOPED; } } private static class BarInstanceFactory extends AbstractTestInstanceFactory { @Override - public boolean isTestScopedConstructorContextEnabled(ExtensionContext rootContext) { - return true; + public ExtensionContextScope getExtensionContextScopeDuringTestInstanceConstruction( + ExtensionContext rootContext) { + return TEST_SCOPED; } } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java index 16219a8c0c23..820a6fdb226d 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java @@ -12,6 +12,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.extension.Extension.ExtensionContextScope.TEST_SCOPED; import java.util.ArrayList; import java.util.HashMap; @@ -205,8 +206,9 @@ static class FooInstancePostProcessor extends AbstractInstancePostProcessor { } @Override - public boolean isTestScopedConstructorContextEnabled(ExtensionContext rootContext) { - return true; + public ExtensionContextScope getExtensionContextScopeDuringTestInstanceConstruction( + ExtensionContext rootContext) { + return TEST_SCOPED; } } @@ -216,8 +218,9 @@ static class BarInstancePostProcessor extends AbstractInstancePostProcessor { } @Override - public boolean isTestScopedConstructorContextEnabled(ExtensionContext rootContext) { - return true; + public ExtensionContextScope getExtensionContextScopeDuringTestInstanceConstruction( + ExtensionContext rootContext) { + return TEST_SCOPED; } } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java index bbe2897d640a..fb89f503b838 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java @@ -11,6 +11,7 @@ package org.junit.jupiter.engine.extension; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.extension.Extension.ExtensionContextScope.TEST_SCOPED; import java.util.ArrayList; import java.util.List; @@ -563,8 +564,9 @@ static class InstancePreConstructCallbackRecordingFoo extends AbstractTestInstan } @Override - public boolean isTestScopedConstructorContextEnabled(ExtensionContext rootContext) { - return true; + public ExtensionContextScope getExtensionContextScopeDuringTestInstanceConstruction( + ExtensionContext rootContext) { + return TEST_SCOPED; } } @@ -574,8 +576,9 @@ static class InstancePreConstructCallbackRecordingBar extends AbstractTestInstan } @Override - public boolean isTestScopedConstructorContextEnabled(ExtensionContext rootContext) { - return true; + public ExtensionContextScope getExtensionContextScopeDuringTestInstanceConstruction( + ExtensionContext rootContext) { + return TEST_SCOPED; } } @@ -585,8 +588,9 @@ static class InstancePreConstructCallbackRecordingBaz extends AbstractTestInstan } @Override - public boolean isTestScopedConstructorContextEnabled(ExtensionContext rootContext) { - return true; + public ExtensionContextScope getExtensionContextScopeDuringTestInstanceConstruction( + ExtensionContext rootContext) { + return TEST_SCOPED; } } From 93acf9e087a90a5554d65a7eccc6d9ed8d64db1f Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 9 Oct 2024 10:10:52 +0200 Subject: [PATCH 164/611] Create specialized sub-interface of Extension This enforces that only potentially affected extensions can override the method determining the extension context scope during test class instance construction. --- .../src/docs/asciidoc/link-attributes.adoc | 1 - .../release-notes-5.12.0-M1.adoc | 5 +- .../docs/asciidoc/user-guide/extensions.adoc | 12 +- .../jupiter/api/extension/Extension.java | 98 -------------- .../api/extension/InvocationInterceptor.java | 8 +- .../api/extension/ParameterResolver.java | 13 +- ...nceConstructionParticipatingExtension.java | 121 ++++++++++++++++++ .../api/extension/TestInstanceFactory.java | 4 +- .../extension/TestInstancePostProcessor.java | 4 +- .../TestInstancePreConstructCallback.java | 10 +- .../execution/ExtensionContextSupplier.java | 13 +- .../engine/extension/TempDirectory.java | 5 +- .../ExtensionComposabilityTests.java | 2 +- .../api/extension/KitchenSinkExtension.java | 5 +- .../extension/TestInstanceFactoryTests.java | 6 +- .../TestInstancePostProcessorTests.java | 6 +- ...TestInstancePreConstructCallbackTests.java | 8 +- 17 files changed, 175 insertions(+), 146 deletions(-) create mode 100644 junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestClassInstanceConstructionParticipatingExtension.java diff --git a/documentation/src/docs/asciidoc/link-attributes.adoc b/documentation/src/docs/asciidoc/link-attributes.adoc index af3b1665b084..5c55bec09cf7 100644 --- a/documentation/src/docs/asciidoc/link-attributes.adoc +++ b/documentation/src/docs/asciidoc/link-attributes.adoc @@ -142,7 +142,6 @@ endif::[] :ExecutableInvoker: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/ExecutableInvoker.html[ExecutableInvoker] :ExecutionCondition: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/ExecutionCondition.html[ExecutionCondition] :ExtendWith: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/ExtendWith.html[@ExtendWith] -:Extension: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/Extension.html[Extension] :ExtensionContext: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/ExtensionContext.html[ExtensionContext] :ExtensionContext_Store: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/ExtensionContext.Store.html[Store] :InvocationInterceptor: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/InvocationInterceptor.html[InvocationInterceptor] diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index a716f5baa123..42510641fdfa 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -58,8 +58,9 @@ JUnit repository on GitHub. extensions. * Allow determining "shared resources" at runtime via the new `@ResourceLock#providers` attribute that accepts implementations of `ResourceLocksProvider`. -* Overriding `Extension.getExtensionContextScopeDuringTestInstanceConstruction()` enables - using a test-scoped `ExtensionContext` in `Extension` methods called during test class +* Extensions that participate in the construction of test class instances may override the + `getExtensionContextScopeDuringTestClassInstanceConstruction()` method to enable using a + test-scoped `ExtensionContext` in `Extension` methods called during test class instance construction. This behavior will become the default in future versions of JUnit. * `@TempDir` is now supported on test class constructors. diff --git a/documentation/src/docs/asciidoc/user-guide/extensions.adoc b/documentation/src/docs/asciidoc/user-guide/extensions.adoc index 16452ced7de1..78f258681173 100644 --- a/documentation/src/docs/asciidoc/user-guide/extensions.adoc +++ b/documentation/src/docs/asciidoc/user-guide/extensions.adoc @@ -384,7 +384,7 @@ instances and their lifecycle. [NOTE] ==== You may override the -`{Extension}.getExtensionContextScopeDuringTestInstanceConstruction(...)` method to return +`getExtensionContextScopeDuringTestClassInstanceConstruction(...)` method to return `TEST_SCOPED` for revised handling of `CloseableResource` and to make test-specific data available to your implementation. ==== @@ -418,7 +418,7 @@ registered for any specific test class. [NOTE] ==== You may override the -`{Extension}.getExtensionContextScopeDuringTestInstanceConstruction(...)` method to return +`getExtensionContextScopeDuringTestClassInstanceConstruction(...)` method to return `TEST_SCOPED` for revised handling of `CloseableResource` and to make test-specific data available to your implementation. ==== @@ -438,7 +438,7 @@ For a concrete example, consult the source code for the `{MockitoExtension}` and [NOTE] ==== You may override the -`{Extension}.getExtensionContextScopeDuringTestInstanceConstruction(...)` method to return +`getExtensionContextScopeDuringTestClassInstanceConstruction(...)` method to return `TEST_SCOPED` for revised handling of `CloseableResource` and to make test-specific data available to your implementation. ==== @@ -492,9 +492,9 @@ those provided in `java.lang.reflect.Parameter` in order to avoid this bug in th [NOTE] ==== You may override the -`{Extension}.getExtensionContextScopeDuringTestInstanceConstruction(...)` method to return +`getExtensionContextScopeDuringTestClassInstanceConstruction(...)` method to return `TEST_SCOPED` to support injecting test specific data into constructor parameters of the -test instance. Doing so causes a test-specific `{ExtensionContext}` to be used while +test class instance. Doing so causes a test-specific `{ExtensionContext}` to be used while resolving constructor parameters, unless the <> is set to `PER_CLASS`. ==== @@ -732,7 +732,7 @@ include::{testDir}/example/interceptor/SwingEdtInterceptor.java[tags=user_guide] [NOTE] ==== You may override the -`{Extension}.getExtensionContextScopeDuringTestInstanceConstruction(...)` method to return +`getExtensionContextScopeDuringTestClassInstanceConstruction(...)` method to return `TEST_SCOPED` to make test-specific data available to your implementation of `interceptTestClassConstructor` and for a revised scope of the provided `Store` instance. ==== diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extension.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extension.java index ac63d0c2eae2..78c68ab96867 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extension.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extension.java @@ -10,14 +10,9 @@ package org.junit.jupiter.api.extension; -import static org.apiguardian.api.API.Status.DEPRECATED; -import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.STABLE; import org.apiguardian.api.API; -import org.junit.jupiter.api.TestInstance; -import org.junit.jupiter.api.extension.ExtensionContext.Store; -import org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource; /** * Marker interface for all extensions. @@ -43,97 +38,4 @@ */ @API(status = STABLE, since = "5.0") public interface Extension { - - /** - * Whether this extension should receive a test-scoped - * {@link ExtensionContext} during the creation of test instances. - * - *

If an extension returns - * {@link ExtensionContextScope#TEST_SCOPED TEST_SCOPED} from this method, - * the following extension methods will be called with a test-scoped - * {@link ExtensionContext} instead of a class-scoped one, unless the - * {@link TestInstance.Lifecycle#PER_CLASS PER_CLASS} lifecycle is used: - * - *

    - *
  • {@link InvocationInterceptor#interceptTestClassConstructor}
  • - *
  • {@link ParameterResolver} when resolving constructor parameters
  • - *
  • {@link TestInstancePreConstructCallback}
  • - *
  • {@link TestInstancePostProcessor}
  • - *
  • {@link TestInstanceFactory}
  • - *
- * - *

In such cases, implementations of these extension callbacks can - * observe the following differences: - * - *

    - *
  • {@link ExtensionContext#getElement() getElement()} may refer to the - * test method and {@link ExtensionContext#getTestClass() getTestClass()} - * may refer to a nested test class. - * Use {@link TestInstanceFactoryContext#getTestClass()} to get the class - * under construction.
  • - *
  • {@link ExtensionContext#getTestMethod() getTestMethod()} is no-longer - * empty, unless the test class is annotated with - * {@link TestInstance @TestInstance(Lifecycle.PER_CLASS)}.
  • - *
  • If the callback adds a new {@link CloseableResource} to the - * {@link Store}, the resource is closed just after the instance is - * destroyed.
  • - *
  • The callbacks can now access data previously stored by - * {@link TestTemplateInvocationContext}, unless the test class is annotated - * with {@link TestInstance @TestInstance(Lifecycle.PER_CLASS)}.
  • - *
- * - *

Note: The behavior which is enabled by returning - * {@link ExtensionContextScope#TEST_SCOPED TEST_SCOPED} from this method - * will become the default in future versions of JUnit. To ensure future - * compatibility, extension implementors are therefore advised to opt in, - * even if they don't require the new functionality. - * - * @implNote There are no guarantees about how often this method is called. - * Therefore, implementations should be idempotent and avoid side - * effects. They may, however, cache the result for performance in - * the {@link Store Store} of the supplied - * {@link ExtensionContext}, if necessary. - * @param rootContext the root extension context to allow inspection of - * configuration parameters; never {@code null} - * @since 5.12 - * @see InvocationInterceptor#interceptTestClassConstructor - * @see ParameterResolver - * @see TestInstancePreConstructCallback - * @see TestInstancePostProcessor - * @see TestInstanceFactory - */ - @API(status = EXPERIMENTAL, since = "5.12") - default ExtensionContextScope getExtensionContextScopeDuringTestInstanceConstruction(ExtensionContext rootContext) { - return ExtensionContextScope.DEFAULT; - } - - /** - * {@code ExtensionContextScope} is used to define the scope of the - * {@link ExtensionContext} passed to an extension during the creation of - * test instances. - * - * @since 5.12 - * @see org.junit.jupiter.api.extension.Extension#getExtensionContextScopeDuringTestInstanceConstruction - */ - @API(status = EXPERIMENTAL, since = "5.12") - enum ExtensionContextScope { - - /** - * The extension should receive an {@link ExtensionContext} scoped to - * the test class. - * - * @deprecated This behavior will be removed from future versions of - * JUnit and {@link #TEST_SCOPED} will become the default. - */ - @API(status = DEPRECATED, since = "5.12") // - @Deprecated - DEFAULT, - - /** - * The extension should receive an {@link ExtensionContext} scoped to - * the test instance. - */ - TEST_SCOPED - } - } diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java index f54f8e1985b7..ae46fca1d5db 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java @@ -51,7 +51,7 @@ * @see ExtensionContext */ @API(status = STABLE, since = "5.10") -public interface InvocationInterceptor extends Extension { +public interface InvocationInterceptor extends TestClassInstanceConstructionParticipatingExtension { /** * Intercept the invocation of a test class constructor. @@ -60,9 +60,9 @@ public interface InvocationInterceptor extends Extension { * (static initialization) when this method is invoked. * *

Extensions may override - * {@link #getExtensionContextScopeDuringTestInstanceConstruction} to make - * test-specific data available to the implementation of this method and for - * a revised scope of the provided {@link Store} instance. + * {@link #getExtensionContextScopeDuringTestClassInstanceConstruction} to + * make test-specific data available to the implementation of this method + * and for a revised scope of the provided {@link Store Store} instance. * * @param invocation the invocation that is being intercepted; never * {@code null} diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java index 5cd86ad6a81d..7bb065e86ce1 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java @@ -32,11 +32,12 @@ * {@code ParameterResolver}. * *

Extensions may override - * {@link #getExtensionContextScopeDuringTestInstanceConstruction} to support - * injecting test specific data into constructor parameters of the test - * instance. Returning {@link ExtensionContextScope#TEST_SCOPED TEST_SCOPED} - * from this method, causes a test-specific {@link ExtensionContext} to be used - * while resolving constructor parameters, unless the lifecycle is set to + * {@link #getExtensionContextScopeDuringTestClassInstanceConstruction} to + * support injecting test specific data into constructor parameters of the test + * class instance. Returning + * {@link ExtensionContextScope#TEST_SCOPED TEST_SCOPED} from this method, + * causes a test-specific {@link ExtensionContext} to be used while resolving + * constructor parameters, unless the lifecycle is set to * {@link TestInstance.Lifecycle#PER_CLASS PER_CLASS}. * *

Constructor Requirements

@@ -53,7 +54,7 @@ * @see TestInstancePreDestroyCallback */ @API(status = STABLE, since = "5.0") -public interface ParameterResolver extends Extension { +public interface ParameterResolver extends TestClassInstanceConstructionParticipatingExtension { /** * Determine if this resolver supports resolution of an argument for the diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestClassInstanceConstructionParticipatingExtension.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestClassInstanceConstructionParticipatingExtension.java new file mode 100644 index 000000000000..8fbc4044be3e --- /dev/null +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestClassInstanceConstructionParticipatingExtension.java @@ -0,0 +1,121 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.api.extension; + +import static org.apiguardian.api.API.Status.DEPRECATED; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; + +import org.apiguardian.api.API; +import org.junit.jupiter.api.TestInstance; + +/** + * Interface for {@link Extension Extensions} that participate in the + * construction of test class instances. + * + * @since 5.12 + * @see InvocationInterceptor#interceptTestClassConstructor + * @see ParameterResolver + * @see TestInstancePreConstructCallback + * @see TestInstancePostProcessor + * @see TestInstanceFactory + */ +@API(status = EXPERIMENTAL, since = "5.12") +public interface TestClassInstanceConstructionParticipatingExtension extends Extension { + + /** + * Whether this extension should receive a test-scoped + * {@link ExtensionContext} during the creation of test instances. + * + *

If an extension returns + * {@link ExtensionContextScope#TEST_SCOPED TEST_SCOPED} from this method, + * the following extension methods will be called with a test-scoped + * {@link ExtensionContext} instead of a class-scoped one, unless the + * {@link TestInstance.Lifecycle#PER_CLASS PER_CLASS} lifecycle is used: + * + *

    + *
  • {@link InvocationInterceptor#interceptTestClassConstructor}
  • + *
  • {@link ParameterResolver} when resolving constructor parameters
  • + *
  • {@link TestInstancePreConstructCallback}
  • + *
  • {@link TestInstancePostProcessor}
  • + *
  • {@link TestInstanceFactory}
  • + *
+ * + *

In such cases, implementations of these extension callbacks can + * observe the following differences: + * + *

    + *
  • {@link ExtensionContext#getElement() getElement()} may refer to the + * test method and {@link ExtensionContext#getTestClass() getTestClass()} + * may refer to a nested test class. + * Use {@link TestInstanceFactoryContext#getTestClass()} to get the class + * under construction.
  • + *
  • {@link ExtensionContext#getTestMethod() getTestMethod()} is no-longer + * empty, unless the test class is annotated with + * {@link TestInstance @TestInstance(Lifecycle.PER_CLASS)}.
  • + *
  • If the callback adds a new {@link ExtensionContext.Store.CloseableResource} to the + * {@link ExtensionContext.Store}, the resource is closed just after the instance is + * destroyed.
  • + *
  • The callbacks can now access data previously stored by + * {@link TestTemplateInvocationContext}, unless the test class is annotated + * with {@link TestInstance @TestInstance(Lifecycle.PER_CLASS)}.
  • + *
+ * + *

Note: The behavior which is enabled by returning + * {@link ExtensionContextScope#TEST_SCOPED TEST_SCOPED} from this method + * will become the default in future versions of JUnit. To ensure future + * compatibility, extension implementors are therefore advised to opt in, + * even if they don't require the new functionality. + * + * @implNote There are no guarantees about how often this method is called. + * Therefore, implementations should be idempotent and avoid side + * effects. They may, however, cache the result for performance in + * the {@link ExtensionContext.Store Store} of the supplied + * {@link ExtensionContext}, if necessary. + * @param rootContext the root extension context to allow inspection of + * configuration parameters; never {@code null} + * @since 5.12 + */ + @API(status = EXPERIMENTAL, since = "5.12") + default ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( + ExtensionContext rootContext) { + return ExtensionContextScope.DEFAULT; + } + + /** + * {@code ExtensionContextScope} is used to define the scope of the + * {@link ExtensionContext} passed to an extension during the creation of + * test instances. + * + * @since 5.12 + * @see TestClassInstanceConstructionParticipatingExtension#getExtensionContextScopeDuringTestClassInstanceConstruction + */ + @API(status = EXPERIMENTAL, since = "5.12") + enum ExtensionContextScope { + + /** + * The extension should receive an {@link ExtensionContext} scoped to + * the test class. + * + * @deprecated This behavior will be removed from future versions of + * JUnit and {@link #TEST_SCOPED} will become the default. + */ + @API(status = DEPRECATED, since = "5.12") // + @Deprecated + DEFAULT, + + /** + * The extension should receive an {@link ExtensionContext} scoped to + * the test instance. + */ + TEST_SCOPED + } + +} diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java index 04bb2e6e0be4..ab982d7e9b9c 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java @@ -52,13 +52,13 @@ */ @FunctionalInterface @API(status = STABLE, since = "5.7") -public interface TestInstanceFactory extends Extension { +public interface TestInstanceFactory extends TestClassInstanceConstructionParticipatingExtension { /** * Callback for creating a test instance for the supplied context. * *

Extensions may override - * {@link #getExtensionContextScopeDuringTestInstanceConstruction} for + * {@link #getExtensionContextScopeDuringTestClassInstanceConstruction} for * revised handling of {@link CloseableResource CloseableResource} and to * make test-specific data available to your implementation. * diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java index c3f18d1c4d44..ac61cb33db45 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java @@ -41,13 +41,13 @@ */ @FunctionalInterface @API(status = STABLE, since = "5.0") -public interface TestInstancePostProcessor extends Extension { +public interface TestInstancePostProcessor extends TestClassInstanceConstructionParticipatingExtension { /** * Callback for post-processing the supplied test instance. * *

Extensions may override - * {@link #getExtensionContextScopeDuringTestInstanceConstruction} for + * {@link #getExtensionContextScopeDuringTestClassInstanceConstruction} for * revised handling of {@link CloseableResource CloseableResource} and to * make test-specific data available to your implementation. * diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java index 6e946c6dd570..263d4b5525cc 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java @@ -44,16 +44,16 @@ */ @FunctionalInterface @API(status = STABLE, since = "5.11") -public interface TestInstancePreConstructCallback extends Extension { +public interface TestInstancePreConstructCallback extends TestClassInstanceConstructionParticipatingExtension { /** * Callback invoked prior to test instances being constructed. * *

Extensions may override - * {@link #getExtensionContextScopeDuringTestInstanceConstruction} to make - * test-specific data available to the implementation of this method and for - * a revised scope of the provided {@link ExtensionContext.Store Store} - * instance. + * {@link #getExtensionContextScopeDuringTestClassInstanceConstruction} to + * make test-specific data available to the implementation of this method + * and for a revised scope of the provided + * {@link ExtensionContext.Store Store} instance. * * @param factoryContext the context for the test instance about to be instantiated; * never {@code null} diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java index ca998f47c433..f52c657f6ec2 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java @@ -11,17 +11,18 @@ package org.junit.jupiter.engine.execution; import static org.apiguardian.api.API.Status.INTERNAL; -import static org.junit.jupiter.api.extension.Extension.ExtensionContextScope.TEST_SCOPED; +import static org.junit.jupiter.api.extension.TestClassInstanceConstructionParticipatingExtension.ExtensionContextScope.TEST_SCOPED; import org.apiguardian.api.API; -import org.junit.jupiter.api.extension.Extension; import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.TestClassInstanceConstructionParticipatingExtension; /** * Container of two instances of {@link ExtensionContext} to simplify the legacy for - * #3445 (Introduction of Test-scoped ExtensionContext). + * #3445. * * @since 5.12 + * @see TestClassInstanceConstructionParticipatingExtension */ @API(status = INTERNAL, since = "5.12") public final class ExtensionContextSupplier { @@ -34,7 +35,7 @@ public ExtensionContextSupplier(ExtensionContext currentExtensionContext, Extens this.legacyExtensionContext = legacyExtensionContext; } - public ExtensionContext get(Extension extension) { + public ExtensionContext get(TestClassInstanceConstructionParticipatingExtension extension) { if (currentExtensionContext == legacyExtensionContext || isTestScoped(extension)) { return currentExtensionContext; } @@ -43,8 +44,8 @@ public ExtensionContext get(Extension extension) { } } - private boolean isTestScoped(Extension extension) { + private boolean isTestScoped(TestClassInstanceConstructionParticipatingExtension extension) { ExtensionContext rootContext = currentExtensionContext.getRoot(); - return extension.getExtensionContextScopeDuringTestInstanceConstruction(rootContext) == TEST_SCOPED; + return extension.getExtensionContextScopeDuringTestClassInstanceConstruction(rootContext) == TEST_SCOPED; } } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java index 29dcac2179df..b45485f57cba 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java @@ -12,7 +12,7 @@ import static java.nio.file.FileVisitResult.CONTINUE; import static java.util.stream.Collectors.joining; -import static org.junit.jupiter.api.extension.Extension.ExtensionContextScope.TEST_SCOPED; +import static org.junit.jupiter.api.extension.TestClassInstanceConstructionParticipatingExtension.ExtensionContextScope.TEST_SCOPED; import static org.junit.jupiter.api.io.CleanupMode.DEFAULT; import static org.junit.jupiter.api.io.CleanupMode.NEVER; import static org.junit.jupiter.api.io.CleanupMode.ON_SUCCESS; @@ -94,7 +94,8 @@ public TempDirectory(JupiterConfiguration configuration) { } @Override - public ExtensionContextScope getExtensionContextScopeDuringTestInstanceConstruction(ExtensionContext rootContext) { + public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( + ExtensionContext rootContext) { return TEST_SCOPED; } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExtensionComposabilityTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExtensionComposabilityTests.java index ec5e79116795..b624bed90df4 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExtensionComposabilityTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExtensionComposabilityTests.java @@ -146,7 +146,7 @@ private List> findExtensionApis() { } private boolean isExtensionApi(Class candidate) { - return candidate.isInterface() && Extension.class.isAssignableFrom(candidate); + return candidate.isInterface() && (candidate != Extension.class) && Extension.class.isAssignableFrom(candidate); } private String methodSignature(Method method) { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java index bb4d06029f92..8e9e7f70e26d 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java @@ -65,8 +65,11 @@ public class KitchenSinkExtension implements // @formatter:on { + // --- Test Class Instance Construction ------------------------------------ + @Override - public ExtensionContextScope getExtensionContextScopeDuringTestInstanceConstruction(ExtensionContext rootContext) { + public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( + ExtensionContext rootContext) { return ExtensionContextScope.TEST_SCOPED; } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java index 75e00765a2a3..879c08c7b977 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java @@ -13,7 +13,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS; -import static org.junit.jupiter.api.extension.Extension.ExtensionContextScope.TEST_SCOPED; +import static org.junit.jupiter.api.extension.TestClassInstanceConstructionParticipatingExtension.ExtensionContextScope.TEST_SCOPED; import static org.junit.platform.commons.util.ClassUtils.nullSafeToString; import static org.junit.platform.testkit.engine.EventConditions.container; import static org.junit.platform.testkit.engine.EventConditions.engine; @@ -723,7 +723,7 @@ public Object createTestInstance(TestInstanceFactoryContext factoryContext, Exte private static class FooInstanceFactory extends AbstractTestInstanceFactory { @Override - public ExtensionContextScope getExtensionContextScopeDuringTestInstanceConstruction( + public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( ExtensionContext rootContext) { return TEST_SCOPED; } @@ -731,7 +731,7 @@ public ExtensionContextScope getExtensionContextScopeDuringTestInstanceConstruct private static class BarInstanceFactory extends AbstractTestInstanceFactory { @Override - public ExtensionContextScope getExtensionContextScopeDuringTestInstanceConstruction( + public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( ExtensionContext rootContext) { return TEST_SCOPED; } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java index 820a6fdb226d..3a0627ae10f7 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java @@ -12,7 +12,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.extension.Extension.ExtensionContextScope.TEST_SCOPED; +import static org.junit.jupiter.api.extension.TestClassInstanceConstructionParticipatingExtension.ExtensionContextScope.TEST_SCOPED; import java.util.ArrayList; import java.util.HashMap; @@ -206,7 +206,7 @@ static class FooInstancePostProcessor extends AbstractInstancePostProcessor { } @Override - public ExtensionContextScope getExtensionContextScopeDuringTestInstanceConstruction( + public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( ExtensionContext rootContext) { return TEST_SCOPED; } @@ -218,7 +218,7 @@ static class BarInstancePostProcessor extends AbstractInstancePostProcessor { } @Override - public ExtensionContextScope getExtensionContextScopeDuringTestInstanceConstruction( + public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( ExtensionContext rootContext) { return TEST_SCOPED; } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java index fb89f503b838..38262cc2bda7 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java @@ -11,7 +11,7 @@ package org.junit.jupiter.engine.extension; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.extension.Extension.ExtensionContextScope.TEST_SCOPED; +import static org.junit.jupiter.api.extension.TestClassInstanceConstructionParticipatingExtension.ExtensionContextScope.TEST_SCOPED; import java.util.ArrayList; import java.util.List; @@ -564,7 +564,7 @@ static class InstancePreConstructCallbackRecordingFoo extends AbstractTestInstan } @Override - public ExtensionContextScope getExtensionContextScopeDuringTestInstanceConstruction( + public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( ExtensionContext rootContext) { return TEST_SCOPED; } @@ -576,7 +576,7 @@ static class InstancePreConstructCallbackRecordingBar extends AbstractTestInstan } @Override - public ExtensionContextScope getExtensionContextScopeDuringTestInstanceConstruction( + public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( ExtensionContext rootContext) { return TEST_SCOPED; } @@ -588,7 +588,7 @@ static class InstancePreConstructCallbackRecordingBaz extends AbstractTestInstan } @Override - public ExtensionContextScope getExtensionContextScopeDuringTestInstanceConstruction( + public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( ExtensionContext rootContext) { return TEST_SCOPED; } From 0da53ce2a5ea114c42e28142456e2292472930c0 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 10 Oct 2024 08:02:11 +0200 Subject: [PATCH 165/611] Revise naming and documentation of `ExtensionContextScope` --- .../jupiter/api/extension/ParameterResolver.java | 2 +- ...nstanceConstructionParticipatingExtension.java | 15 ++++++++------- .../execution/ExtensionContextSupplier.java | 4 ++-- .../jupiter/engine/extension/TempDirectory.java | 4 ++-- .../api/extension/KitchenSinkExtension.java | 2 +- .../extension/TestInstanceFactoryTests.java | 6 +++--- .../extension/TestInstancePostProcessorTests.java | 6 +++--- .../TestInstancePreConstructCallbackTests.java | 8 ++++---- 8 files changed, 24 insertions(+), 23 deletions(-) diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java index 7bb065e86ce1..add7c205a753 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java @@ -35,7 +35,7 @@ * {@link #getExtensionContextScopeDuringTestClassInstanceConstruction} to * support injecting test specific data into constructor parameters of the test * class instance. Returning - * {@link ExtensionContextScope#TEST_SCOPED TEST_SCOPED} from this method, + * {@link ExtensionContextScope#TEST_METHOD TEST_SCOPED} from this method, * causes a test-specific {@link ExtensionContext} to be used while resolving * constructor parameters, unless the lifecycle is set to * {@link TestInstance.Lifecycle#PER_CLASS PER_CLASS}. diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestClassInstanceConstructionParticipatingExtension.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestClassInstanceConstructionParticipatingExtension.java index 8fbc4044be3e..2c7228d769d8 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestClassInstanceConstructionParticipatingExtension.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestClassInstanceConstructionParticipatingExtension.java @@ -35,7 +35,7 @@ public interface TestClassInstanceConstructionParticipatingExtension extends Ext * {@link ExtensionContext} during the creation of test instances. * *

If an extension returns - * {@link ExtensionContextScope#TEST_SCOPED TEST_SCOPED} from this method, + * {@link ExtensionContextScope#TEST_METHOD TEST_SCOPED} from this method, * the following extension methods will be called with a test-scoped * {@link ExtensionContext} instead of a class-scoped one, unless the * {@link TestInstance.Lifecycle#PER_CLASS PER_CLASS} lifecycle is used: @@ -69,7 +69,7 @@ public interface TestClassInstanceConstructionParticipatingExtension extends Ext * * *

Note: The behavior which is enabled by returning - * {@link ExtensionContextScope#TEST_SCOPED TEST_SCOPED} from this method + * {@link ExtensionContextScope#TEST_METHOD TEST_SCOPED} from this method * will become the default in future versions of JUnit. To ensure future * compatibility, extension implementors are therefore advised to opt in, * even if they don't require the new functionality. @@ -91,8 +91,8 @@ default ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceCon /** * {@code ExtensionContextScope} is used to define the scope of the - * {@link ExtensionContext} passed to an extension during the creation of - * test instances. + * {@link ExtensionContext} passed to an extension during the construction + * of test class instances. * * @since 5.12 * @see TestClassInstanceConstructionParticipatingExtension#getExtensionContextScopeDuringTestClassInstanceConstruction @@ -105,7 +105,7 @@ enum ExtensionContextScope { * the test class. * * @deprecated This behavior will be removed from future versions of - * JUnit and {@link #TEST_SCOPED} will become the default. + * JUnit and {@link #TEST_METHOD} will become the default. */ @API(status = DEPRECATED, since = "5.12") // @Deprecated @@ -113,9 +113,10 @@ enum ExtensionContextScope { /** * The extension should receive an {@link ExtensionContext} scoped to - * the test instance. + * the test method, unless the + * {@link TestInstance.Lifecycle#PER_CLASS PER_CLASS} lifecycle is used. */ - TEST_SCOPED + TEST_METHOD } } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java index f52c657f6ec2..ca1eac049ca8 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java @@ -11,7 +11,7 @@ package org.junit.jupiter.engine.execution; import static org.apiguardian.api.API.Status.INTERNAL; -import static org.junit.jupiter.api.extension.TestClassInstanceConstructionParticipatingExtension.ExtensionContextScope.TEST_SCOPED; +import static org.junit.jupiter.api.extension.TestClassInstanceConstructionParticipatingExtension.ExtensionContextScope.TEST_METHOD; import org.apiguardian.api.API; import org.junit.jupiter.api.extension.ExtensionContext; @@ -46,6 +46,6 @@ public ExtensionContext get(TestClassInstanceConstructionParticipatingExtension private boolean isTestScoped(TestClassInstanceConstructionParticipatingExtension extension) { ExtensionContext rootContext = currentExtensionContext.getRoot(); - return extension.getExtensionContextScopeDuringTestClassInstanceConstruction(rootContext) == TEST_SCOPED; + return extension.getExtensionContextScopeDuringTestClassInstanceConstruction(rootContext) == TEST_METHOD; } } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java index b45485f57cba..ea79a5866559 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java @@ -12,7 +12,7 @@ import static java.nio.file.FileVisitResult.CONTINUE; import static java.util.stream.Collectors.joining; -import static org.junit.jupiter.api.extension.TestClassInstanceConstructionParticipatingExtension.ExtensionContextScope.TEST_SCOPED; +import static org.junit.jupiter.api.extension.TestClassInstanceConstructionParticipatingExtension.ExtensionContextScope.TEST_METHOD; import static org.junit.jupiter.api.io.CleanupMode.DEFAULT; import static org.junit.jupiter.api.io.CleanupMode.NEVER; import static org.junit.jupiter.api.io.CleanupMode.ON_SUCCESS; @@ -96,7 +96,7 @@ public TempDirectory(JupiterConfiguration configuration) { @Override public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( ExtensionContext rootContext) { - return TEST_SCOPED; + return TEST_METHOD; } /** diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java index 8e9e7f70e26d..a102e5d6a1ac 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java @@ -70,7 +70,7 @@ public class KitchenSinkExtension implements @Override public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( ExtensionContext rootContext) { - return ExtensionContextScope.TEST_SCOPED; + return ExtensionContextScope.TEST_METHOD; } // --- Lifecycle Callbacks ------------------------------------------------- diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java index 879c08c7b977..91b00c150de3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java @@ -13,7 +13,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS; -import static org.junit.jupiter.api.extension.TestClassInstanceConstructionParticipatingExtension.ExtensionContextScope.TEST_SCOPED; +import static org.junit.jupiter.api.extension.TestClassInstanceConstructionParticipatingExtension.ExtensionContextScope.TEST_METHOD; import static org.junit.platform.commons.util.ClassUtils.nullSafeToString; import static org.junit.platform.testkit.engine.EventConditions.container; import static org.junit.platform.testkit.engine.EventConditions.engine; @@ -725,7 +725,7 @@ private static class FooInstanceFactory extends AbstractTestInstanceFactory { @Override public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( ExtensionContext rootContext) { - return TEST_SCOPED; + return TEST_METHOD; } } @@ -733,7 +733,7 @@ private static class BarInstanceFactory extends AbstractTestInstanceFactory { @Override public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( ExtensionContext rootContext) { - return TEST_SCOPED; + return TEST_METHOD; } } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java index 3a0627ae10f7..5c86f6d9be99 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java @@ -12,7 +12,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.extension.TestClassInstanceConstructionParticipatingExtension.ExtensionContextScope.TEST_SCOPED; +import static org.junit.jupiter.api.extension.TestClassInstanceConstructionParticipatingExtension.ExtensionContextScope.TEST_METHOD; import java.util.ArrayList; import java.util.HashMap; @@ -208,7 +208,7 @@ static class FooInstancePostProcessor extends AbstractInstancePostProcessor { @Override public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( ExtensionContext rootContext) { - return TEST_SCOPED; + return TEST_METHOD; } } @@ -220,7 +220,7 @@ static class BarInstancePostProcessor extends AbstractInstancePostProcessor { @Override public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( ExtensionContext rootContext) { - return TEST_SCOPED; + return TEST_METHOD; } } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java index 38262cc2bda7..d43e71b7c6db 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java @@ -11,7 +11,7 @@ package org.junit.jupiter.engine.extension; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.extension.TestClassInstanceConstructionParticipatingExtension.ExtensionContextScope.TEST_SCOPED; +import static org.junit.jupiter.api.extension.TestClassInstanceConstructionParticipatingExtension.ExtensionContextScope.TEST_METHOD; import java.util.ArrayList; import java.util.List; @@ -566,7 +566,7 @@ static class InstancePreConstructCallbackRecordingFoo extends AbstractTestInstan @Override public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( ExtensionContext rootContext) { - return TEST_SCOPED; + return TEST_METHOD; } } @@ -578,7 +578,7 @@ static class InstancePreConstructCallbackRecordingBar extends AbstractTestInstan @Override public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( ExtensionContext rootContext) { - return TEST_SCOPED; + return TEST_METHOD; } } @@ -590,7 +590,7 @@ static class InstancePreConstructCallbackRecordingBaz extends AbstractTestInstan @Override public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( ExtensionContext rootContext) { - return TEST_SCOPED; + return TEST_METHOD; } } From e3c5383b54b92b6474ef8d7d0a68b87a9b78519b Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 11 Oct 2024 14:59:16 +0200 Subject: [PATCH 166/611] Rename to TestInstantiationAwareExtension --- .../release-notes-5.12.0-M1.adoc | 9 ++-- .../docs/asciidoc/user-guide/extensions.adoc | 15 +++---- .../api/extension/InvocationInterceptor.java | 4 +- .../api/extension/ParameterResolver.java | 4 +- .../api/extension/TestInstanceFactory.java | 4 +- .../extension/TestInstancePostProcessor.java | 4 +- .../TestInstancePreConstructCallback.java | 4 +- ...a => TestInstantiationAwareExtension.java} | 44 ++++++++++--------- .../execution/ExtensionContextSupplier.java | 12 ++--- .../engine/extension/TempDirectory.java | 5 +-- .../api/extension/KitchenSinkExtension.java | 5 +-- .../extension/TestInstanceFactoryTests.java | 8 ++-- .../TestInstancePostProcessorTests.java | 8 ++-- ...TestInstancePreConstructCallbackTests.java | 11 ++--- 14 files changed, 64 insertions(+), 73 deletions(-) rename junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/{TestClassInstanceConstructionParticipatingExtension.java => TestInstantiationAwareExtension.java} (71%) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 42510641fdfa..ba8710106188 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -58,10 +58,11 @@ JUnit repository on GitHub. extensions. * Allow determining "shared resources" at runtime via the new `@ResourceLock#providers` attribute that accepts implementations of `ResourceLocksProvider`. -* Extensions that participate in the construction of test class instances may override the - `getExtensionContextScopeDuringTestClassInstanceConstruction()` method to enable using a - test-scoped `ExtensionContext` in `Extension` methods called during test class instance - construction. This behavior will become the default in future versions of JUnit. +* Extensions that implement `TestInstancePreConstructCallback`, `TestInstanceFactory`, + `TestInstancePostProcessor`, `ParameterResolver`, or `InvocationInterceptor` may + override the `getTestInstantiationExtensionContextScope()` method to enable receiving + a test-scoped `ExtensionContext` in `Extension` methods called during test class + instantiation. This behavior will become the default in future versions of JUnit. * `@TempDir` is now supported on test class constructors. diff --git a/documentation/src/docs/asciidoc/user-guide/extensions.adoc b/documentation/src/docs/asciidoc/user-guide/extensions.adoc index 78f258681173..b651f4506ae5 100644 --- a/documentation/src/docs/asciidoc/user-guide/extensions.adoc +++ b/documentation/src/docs/asciidoc/user-guide/extensions.adoc @@ -383,8 +383,7 @@ instances and their lifecycle. [NOTE] ==== -You may override the -`getExtensionContextScopeDuringTestClassInstanceConstruction(...)` method to return +You may override the `getTestInstantiationExtensionContextScope(...)` method to return `TEST_SCOPED` for revised handling of `CloseableResource` and to make test-specific data available to your implementation. ==== @@ -417,8 +416,7 @@ registered for any specific test class. [NOTE] ==== -You may override the -`getExtensionContextScopeDuringTestClassInstanceConstruction(...)` method to return +You may override the `getTestInstantiationExtensionContextScope(...)` method to return `TEST_SCOPED` for revised handling of `CloseableResource` and to make test-specific data available to your implementation. ==== @@ -437,8 +435,7 @@ For a concrete example, consult the source code for the `{MockitoExtension}` and [NOTE] ==== -You may override the -`getExtensionContextScopeDuringTestClassInstanceConstruction(...)` method to return +You may override the `getTestInstantiationExtensionContextScope(...)` method to return `TEST_SCOPED` for revised handling of `CloseableResource` and to make test-specific data available to your implementation. ==== @@ -491,8 +488,7 @@ those provided in `java.lang.reflect.Parameter` in order to avoid this bug in th [NOTE] ==== -You may override the -`getExtensionContextScopeDuringTestClassInstanceConstruction(...)` method to return +You may override the `getTestInstantiationExtensionContextScope(...)` method to return `TEST_SCOPED` to support injecting test specific data into constructor parameters of the test class instance. Doing so causes a test-specific `{ExtensionContext}` to be used while resolving constructor parameters, unless the @@ -731,8 +727,7 @@ include::{testDir}/example/interceptor/SwingEdtInterceptor.java[tags=user_guide] [NOTE] ==== -You may override the -`getExtensionContextScopeDuringTestClassInstanceConstruction(...)` method to return +You may override the `getTestInstantiationExtensionContextScope(...)` method to return `TEST_SCOPED` to make test-specific data available to your implementation of `interceptTestClassConstructor` and for a revised scope of the provided `Store` instance. ==== diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java index ae46fca1d5db..58aa743cd27a 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java @@ -51,7 +51,7 @@ * @see ExtensionContext */ @API(status = STABLE, since = "5.10") -public interface InvocationInterceptor extends TestClassInstanceConstructionParticipatingExtension { +public interface InvocationInterceptor extends TestInstantiationAwareExtension { /** * Intercept the invocation of a test class constructor. @@ -60,7 +60,7 @@ public interface InvocationInterceptor extends TestClassInstanceConstructionPart * (static initialization) when this method is invoked. * *

Extensions may override - * {@link #getExtensionContextScopeDuringTestClassInstanceConstruction} to + * {@link #getTestInstantiationExtensionContextScope} to * make test-specific data available to the implementation of this method * and for a revised scope of the provided {@link Store Store} instance. * diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java index add7c205a753..a0274c8558ab 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java @@ -32,7 +32,7 @@ * {@code ParameterResolver}. * *

Extensions may override - * {@link #getExtensionContextScopeDuringTestClassInstanceConstruction} to + * {@link #getTestInstantiationExtensionContextScope} to * support injecting test specific data into constructor parameters of the test * class instance. Returning * {@link ExtensionContextScope#TEST_METHOD TEST_SCOPED} from this method, @@ -54,7 +54,7 @@ * @see TestInstancePreDestroyCallback */ @API(status = STABLE, since = "5.0") -public interface ParameterResolver extends TestClassInstanceConstructionParticipatingExtension { +public interface ParameterResolver extends TestInstantiationAwareExtension { /** * Determine if this resolver supports resolution of an argument for the diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java index ab982d7e9b9c..4b9880dc79ba 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java @@ -52,13 +52,13 @@ */ @FunctionalInterface @API(status = STABLE, since = "5.7") -public interface TestInstanceFactory extends TestClassInstanceConstructionParticipatingExtension { +public interface TestInstanceFactory extends TestInstantiationAwareExtension { /** * Callback for creating a test instance for the supplied context. * *

Extensions may override - * {@link #getExtensionContextScopeDuringTestClassInstanceConstruction} for + * {@link #getTestInstantiationExtensionContextScope} for * revised handling of {@link CloseableResource CloseableResource} and to * make test-specific data available to your implementation. * diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java index ac61cb33db45..9e80175cffb4 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java @@ -41,13 +41,13 @@ */ @FunctionalInterface @API(status = STABLE, since = "5.0") -public interface TestInstancePostProcessor extends TestClassInstanceConstructionParticipatingExtension { +public interface TestInstancePostProcessor extends TestInstantiationAwareExtension { /** * Callback for post-processing the supplied test instance. * *

Extensions may override - * {@link #getExtensionContextScopeDuringTestClassInstanceConstruction} for + * {@link #getTestInstantiationExtensionContextScope} for * revised handling of {@link CloseableResource CloseableResource} and to * make test-specific data available to your implementation. * diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java index 263d4b5525cc..774b9a375a09 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java @@ -44,13 +44,13 @@ */ @FunctionalInterface @API(status = STABLE, since = "5.11") -public interface TestInstancePreConstructCallback extends TestClassInstanceConstructionParticipatingExtension { +public interface TestInstancePreConstructCallback extends TestInstantiationAwareExtension { /** * Callback invoked prior to test instances being constructed. * *

Extensions may override - * {@link #getExtensionContextScopeDuringTestClassInstanceConstruction} to + * {@link #getTestInstantiationExtensionContextScope} to * make test-specific data available to the implementation of this method * and for a revised scope of the provided * {@link ExtensionContext.Store Store} instance. diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestClassInstanceConstructionParticipatingExtension.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstantiationAwareExtension.java similarity index 71% rename from junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestClassInstanceConstructionParticipatingExtension.java rename to junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstantiationAwareExtension.java index 2c7228d769d8..48c327705413 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestClassInstanceConstructionParticipatingExtension.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstantiationAwareExtension.java @@ -15,10 +15,15 @@ import org.apiguardian.api.API; import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.extension.ExtensionContext.Store; +import org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource; /** - * Interface for {@link Extension Extensions} that participate in the - * construction of test class instances. + * Interface for {@link Extension Extensions} that are aware and can influence + * the instantiation of test instances. + * + *

This interface is not indented to be implemented directly. Instead, extend + * one of its sub-interfaces. * * @since 5.12 * @see InvocationInterceptor#interceptTestClassConstructor @@ -28,14 +33,14 @@ * @see TestInstanceFactory */ @API(status = EXPERIMENTAL, since = "5.12") -public interface TestClassInstanceConstructionParticipatingExtension extends Extension { +public interface TestInstantiationAwareExtension extends Extension { /** * Whether this extension should receive a test-scoped - * {@link ExtensionContext} during the creation of test instances. + * {@link ExtensionContext} during the instantiation of test instances. * *

If an extension returns - * {@link ExtensionContextScope#TEST_METHOD TEST_SCOPED} from this method, + * {@link ExtensionContextScope#TEST_METHOD TEST_METHOD} from this method, * the following extension methods will be called with a test-scoped * {@link ExtensionContext} instead of a class-scoped one, unless the * {@link TestInstance.Lifecycle#PER_CLASS PER_CLASS} lifecycle is used: @@ -57,45 +62,44 @@ public interface TestClassInstanceConstructionParticipatingExtension extends Ext * may refer to a nested test class. * Use {@link TestInstanceFactoryContext#getTestClass()} to get the class * under construction. - *

  • {@link ExtensionContext#getTestMethod() getTestMethod()} is no-longer - * empty, unless the test class is annotated with - * {@link TestInstance @TestInstance(Lifecycle.PER_CLASS)}.
  • - *
  • If the callback adds a new {@link ExtensionContext.Store.CloseableResource} to the - * {@link ExtensionContext.Store}, the resource is closed just after the instance is + *
  • {@link ExtensionContext#getTestMethod() getTestMethod()} is no longer + * empty, unless the {@link TestInstance.Lifecycle#PER_CLASS PER_CLASS} + * lifecycle is used.
  • + *
  • If the callback adds a new {@link CloseableResource} to the + * {@link Store Store}, the resource is closed just after the instance is * destroyed.
  • *
  • The callbacks can now access data previously stored by - * {@link TestTemplateInvocationContext}, unless the test class is annotated - * with {@link TestInstance @TestInstance(Lifecycle.PER_CLASS)}.
  • + * {@link TestTemplateInvocationContext}, unless the + * {@link TestInstance.Lifecycle#PER_CLASS PER_CLASS} lifecycle is used. * * *

    Note: The behavior which is enabled by returning - * {@link ExtensionContextScope#TEST_METHOD TEST_SCOPED} from this method - * will become the default in future versions of JUnit. To ensure future + * {@link ExtensionContextScope#TEST_METHOD TEST_METHOD} from this method + * will become the default in future versions of JUnit. To ensure forward * compatibility, extension implementors are therefore advised to opt in, * even if they don't require the new functionality. * * @implNote There are no guarantees about how often this method is called. * Therefore, implementations should be idempotent and avoid side * effects. They may, however, cache the result for performance in - * the {@link ExtensionContext.Store Store} of the supplied + * the {@link Store Store} of the supplied * {@link ExtensionContext}, if necessary. * @param rootContext the root extension context to allow inspection of * configuration parameters; never {@code null} * @since 5.12 */ @API(status = EXPERIMENTAL, since = "5.12") - default ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( - ExtensionContext rootContext) { + default ExtensionContextScope getTestInstantiationExtensionContextScope(ExtensionContext rootContext) { return ExtensionContextScope.DEFAULT; } /** * {@code ExtensionContextScope} is used to define the scope of the - * {@link ExtensionContext} passed to an extension during the construction - * of test class instances. + * {@link ExtensionContext} passed to an extension during the instantiation + * of test instances. * * @since 5.12 - * @see TestClassInstanceConstructionParticipatingExtension#getExtensionContextScopeDuringTestClassInstanceConstruction + * @see TestInstantiationAwareExtension#getTestInstantiationExtensionContextScope */ @API(status = EXPERIMENTAL, since = "5.12") enum ExtensionContextScope { diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java index ca1eac049ca8..bc42951196cf 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java @@ -11,18 +11,18 @@ package org.junit.jupiter.engine.execution; import static org.apiguardian.api.API.Status.INTERNAL; -import static org.junit.jupiter.api.extension.TestClassInstanceConstructionParticipatingExtension.ExtensionContextScope.TEST_METHOD; +import static org.junit.jupiter.api.extension.TestInstantiationAwareExtension.ExtensionContextScope.TEST_METHOD; import org.apiguardian.api.API; import org.junit.jupiter.api.extension.ExtensionContext; -import org.junit.jupiter.api.extension.TestClassInstanceConstructionParticipatingExtension; +import org.junit.jupiter.api.extension.TestInstantiationAwareExtension; /** * Container of two instances of {@link ExtensionContext} to simplify the legacy for * #3445. * * @since 5.12 - * @see TestClassInstanceConstructionParticipatingExtension + * @see TestInstantiationAwareExtension */ @API(status = INTERNAL, since = "5.12") public final class ExtensionContextSupplier { @@ -35,7 +35,7 @@ public ExtensionContextSupplier(ExtensionContext currentExtensionContext, Extens this.legacyExtensionContext = legacyExtensionContext; } - public ExtensionContext get(TestClassInstanceConstructionParticipatingExtension extension) { + public ExtensionContext get(TestInstantiationAwareExtension extension) { if (currentExtensionContext == legacyExtensionContext || isTestScoped(extension)) { return currentExtensionContext; } @@ -44,8 +44,8 @@ public ExtensionContext get(TestClassInstanceConstructionParticipatingExtension } } - private boolean isTestScoped(TestClassInstanceConstructionParticipatingExtension extension) { + private boolean isTestScoped(TestInstantiationAwareExtension extension) { ExtensionContext rootContext = currentExtensionContext.getRoot(); - return extension.getExtensionContextScopeDuringTestClassInstanceConstruction(rootContext) == TEST_METHOD; + return extension.getTestInstantiationExtensionContextScope(rootContext) == TEST_METHOD; } } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java index ea79a5866559..c72802b9de24 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java @@ -12,7 +12,7 @@ import static java.nio.file.FileVisitResult.CONTINUE; import static java.util.stream.Collectors.joining; -import static org.junit.jupiter.api.extension.TestClassInstanceConstructionParticipatingExtension.ExtensionContextScope.TEST_METHOD; +import static org.junit.jupiter.api.extension.TestInstantiationAwareExtension.ExtensionContextScope.TEST_METHOD; import static org.junit.jupiter.api.io.CleanupMode.DEFAULT; import static org.junit.jupiter.api.io.CleanupMode.NEVER; import static org.junit.jupiter.api.io.CleanupMode.ON_SUCCESS; @@ -94,8 +94,7 @@ public TempDirectory(JupiterConfiguration configuration) { } @Override - public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( - ExtensionContext rootContext) { + public ExtensionContextScope getTestInstantiationExtensionContextScope(ExtensionContext rootContext) { return TEST_METHOD; } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java index a102e5d6a1ac..762c0414c3e3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java @@ -65,11 +65,10 @@ public class KitchenSinkExtension implements // @formatter:on { - // --- Test Class Instance Construction ------------------------------------ + // --- Test Class Instantiation -------------------------------------------- @Override - public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( - ExtensionContext rootContext) { + public ExtensionContextScope getTestInstantiationExtensionContextScope(ExtensionContext rootContext) { return ExtensionContextScope.TEST_METHOD; } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java index 91b00c150de3..15a280b5683c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java @@ -13,7 +13,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS; -import static org.junit.jupiter.api.extension.TestClassInstanceConstructionParticipatingExtension.ExtensionContextScope.TEST_METHOD; +import static org.junit.jupiter.api.extension.TestInstantiationAwareExtension.ExtensionContextScope.TEST_METHOD; import static org.junit.platform.commons.util.ClassUtils.nullSafeToString; import static org.junit.platform.testkit.engine.EventConditions.container; import static org.junit.platform.testkit.engine.EventConditions.engine; @@ -723,16 +723,14 @@ public Object createTestInstance(TestInstanceFactoryContext factoryContext, Exte private static class FooInstanceFactory extends AbstractTestInstanceFactory { @Override - public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( - ExtensionContext rootContext) { + public ExtensionContextScope getTestInstantiationExtensionContextScope(ExtensionContext rootContext) { return TEST_METHOD; } } private static class BarInstanceFactory extends AbstractTestInstanceFactory { @Override - public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( - ExtensionContext rootContext) { + public ExtensionContextScope getTestInstantiationExtensionContextScope(ExtensionContext rootContext) { return TEST_METHOD; } } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java index 5c86f6d9be99..0a1c3fa0e0d8 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java @@ -12,7 +12,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.extension.TestClassInstanceConstructionParticipatingExtension.ExtensionContextScope.TEST_METHOD; +import static org.junit.jupiter.api.extension.TestInstantiationAwareExtension.ExtensionContextScope.TEST_METHOD; import java.util.ArrayList; import java.util.HashMap; @@ -206,8 +206,7 @@ static class FooInstancePostProcessor extends AbstractInstancePostProcessor { } @Override - public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( - ExtensionContext rootContext) { + public ExtensionContextScope getTestInstantiationExtensionContextScope(ExtensionContext rootContext) { return TEST_METHOD; } } @@ -218,8 +217,7 @@ static class BarInstancePostProcessor extends AbstractInstancePostProcessor { } @Override - public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( - ExtensionContext rootContext) { + public ExtensionContextScope getTestInstantiationExtensionContextScope(ExtensionContext rootContext) { return TEST_METHOD; } } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java index d43e71b7c6db..0065d9234d10 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java @@ -11,7 +11,7 @@ package org.junit.jupiter.engine.extension; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.extension.TestClassInstanceConstructionParticipatingExtension.ExtensionContextScope.TEST_METHOD; +import static org.junit.jupiter.api.extension.TestInstantiationAwareExtension.ExtensionContextScope.TEST_METHOD; import java.util.ArrayList; import java.util.List; @@ -564,8 +564,7 @@ static class InstancePreConstructCallbackRecordingFoo extends AbstractTestInstan } @Override - public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( - ExtensionContext rootContext) { + public ExtensionContextScope getTestInstantiationExtensionContextScope(ExtensionContext rootContext) { return TEST_METHOD; } } @@ -576,8 +575,7 @@ static class InstancePreConstructCallbackRecordingBar extends AbstractTestInstan } @Override - public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( - ExtensionContext rootContext) { + public ExtensionContextScope getTestInstantiationExtensionContextScope(ExtensionContext rootContext) { return TEST_METHOD; } } @@ -588,8 +586,7 @@ static class InstancePreConstructCallbackRecordingBaz extends AbstractTestInstan } @Override - public ExtensionContextScope getExtensionContextScopeDuringTestClassInstanceConstruction( - ExtensionContext rootContext) { + public ExtensionContextScope getTestInstantiationExtensionContextScope(ExtensionContext rootContext) { return TEST_METHOD; } } From 36e72cbb431eeb56c7d826fc922a3d9f34c55e91 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 10 Oct 2024 11:42:26 +0200 Subject: [PATCH 167/611] Make ExtensionContextSupplier a functional interface To allow simple constant lambda implementations --- .../descriptor/ClassBasedTestDescriptor.java | 2 +- .../execution/ExtensionContextSupplier.java | 42 ++++++++++++------- .../execution/ParameterResolutionUtils.java | 3 +- .../InterceptingExecutableInvokerTests.java | 2 +- 4 files changed, 29 insertions(+), 20 deletions(-) diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java index c604cab089cf..69ad2ee520d0 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java @@ -287,7 +287,7 @@ private TestInstances instantiateAndPostProcessTestInstance(JupiterEngineExecuti ClassExtensionContext ourExtensionContext, ExtensionRegistry registry, JupiterEngineExecutionContext context) { - ExtensionContextSupplier extensionContext = new ExtensionContextSupplier(context.getExtensionContext(), + ExtensionContextSupplier extensionContext = ExtensionContextSupplier.create(context.getExtensionContext(), ourExtensionContext); TestInstances instances = instantiateTestClass(parentExecutionContext, extensionContext, registry, context); context.getThrowableCollector().execute(() -> { diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java index bc42951196cf..9b911c86a626 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java @@ -24,28 +24,38 @@ * @since 5.12 * @see TestInstantiationAwareExtension */ +@FunctionalInterface @API(status = INTERNAL, since = "5.12") -public final class ExtensionContextSupplier { +public interface ExtensionContextSupplier { - private final ExtensionContext currentExtensionContext; - private final ExtensionContext legacyExtensionContext; - - public ExtensionContextSupplier(ExtensionContext currentExtensionContext, ExtensionContext legacyExtensionContext) { - this.currentExtensionContext = currentExtensionContext; - this.legacyExtensionContext = legacyExtensionContext; + static ExtensionContextSupplier create(ExtensionContext currentExtensionContext, + ExtensionContext legacyExtensionContext) { + if (currentExtensionContext == legacyExtensionContext) { + return __ -> currentExtensionContext; + } + return new ScopeBasedExtensionContextSupplier(currentExtensionContext, legacyExtensionContext); } - public ExtensionContext get(TestInstantiationAwareExtension extension) { - if (currentExtensionContext == legacyExtensionContext || isTestScoped(extension)) { - return currentExtensionContext; + ExtensionContext get(TestInstantiationAwareExtension extension); + + class ScopeBasedExtensionContextSupplier implements ExtensionContextSupplier { + + private final ExtensionContext currentExtensionContext; + private final ExtensionContext legacyExtensionContext; + + private ScopeBasedExtensionContextSupplier(ExtensionContext currentExtensionContext, + ExtensionContext legacyExtensionContext) { + this.currentExtensionContext = currentExtensionContext; + this.legacyExtensionContext = legacyExtensionContext; } - else { - return legacyExtensionContext; + + public ExtensionContext get(TestInstantiationAwareExtension extension) { + return isTestScoped(extension) ? currentExtensionContext : legacyExtensionContext; } - } - private boolean isTestScoped(TestInstantiationAwareExtension extension) { - ExtensionContext rootContext = currentExtensionContext.getRoot(); - return extension.getTestInstantiationExtensionContextScope(rootContext) == TEST_METHOD; + private boolean isTestScoped(TestInstantiationAwareExtension extension) { + ExtensionContext rootContext = legacyExtensionContext.getRoot(); + return extension.getTestInstantiationExtensionContextScope(rootContext) == TEST_METHOD; + } } } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ParameterResolutionUtils.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ParameterResolutionUtils.java index 93ee83d0e94b..a677e87c62a2 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ParameterResolutionUtils.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ParameterResolutionUtils.java @@ -83,8 +83,7 @@ public static Object[] resolveParameters(Method method, Optional target, */ public static Object[] resolveParameters(Executable executable, Optional target, Optional outerInstance, ExtensionContext extensionContext, ExtensionRegistry extensionRegistry) { - ExtensionContextSupplier context = new ExtensionContextSupplier(extensionContext, extensionContext); - return resolveParameters(executable, target, outerInstance, context, extensionRegistry); + return resolveParameters(executable, target, outerInstance, __ -> extensionContext, extensionRegistry); } public static Object[] resolveParameters(Executable executable, Optional target, diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvokerTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvokerTests.java index c2dca032546a..aea972a34978 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvokerTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvokerTests.java @@ -31,7 +31,7 @@ void invokeMethod() { @Override T invokeConstructor(Constructor constructor, Object outerInstance) { - ExtensionContextSupplier context = new ExtensionContextSupplier(extensionContext, extensionContext); + ExtensionContextSupplier context = ExtensionContextSupplier.create(extensionContext, extensionContext); return newInvoker().invoke(constructor, Optional.ofNullable(outerInstance), context, extensionRegistry, passthroughInterceptor()); } From 95cd63f744059e3572d305cebcecc5a698a4b1cb Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 10 Oct 2024 12:10:29 +0200 Subject: [PATCH 168/611] Introduce configuration parameter for default extension context scope --- .../TestInstantiationAwareExtension.java | 22 ++++++++++- .../org/junit/jupiter/engine/Constants.java | 11 ++++++ .../config/CachingJupiterConfiguration.java | 29 +++++++++------ .../config/DefaultJupiterConfiguration.java | 10 +++++ .../engine/config/JupiterConfiguration.java | 6 ++- .../descriptor/ClassBasedTestDescriptor.java | 2 +- .../execution/ExtensionContextSupplier.java | 6 ++- .../InterceptingExecutableInvokerTests.java | 5 +-- .../extension/TestInstanceFactoryTests.java | 37 ++++++++++++++++++- 9 files changed, 106 insertions(+), 22 deletions(-) diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstantiationAwareExtension.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstantiationAwareExtension.java index 48c327705413..5308f65cb516 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstantiationAwareExtension.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstantiationAwareExtension.java @@ -106,10 +106,16 @@ enum ExtensionContextScope { /** * The extension should receive an {@link ExtensionContext} scoped to - * the test class. + * in the default scope. + * + *

    The default scope is determined by the configuration parameter + * {@link #DEFAULT_SCOPE_PROPERTY_NAME}. If not specified, extensions + * will receive an {@link ExtensionContext} scoped to the test class. * * @deprecated This behavior will be removed from future versions of * JUnit and {@link #TEST_METHOD} will become the default. + * + * @see #DEFAULT_SCOPE_PROPERTY_NAME */ @API(status = DEPRECATED, since = "5.12") // @Deprecated @@ -120,7 +126,19 @@ enum ExtensionContextScope { * the test method, unless the * {@link TestInstance.Lifecycle#PER_CLASS PER_CLASS} lifecycle is used. */ - TEST_METHOD + TEST_METHOD; + + /** + * Property name used to set the default extension context scope: {@value} + * + *

    Supported Values

    + * + *

    Supported values include names of enum constants defined in this + * class, ignoring case. + * + * @see #DEFAULT + */ + public static final String DEFAULT_SCOPE_PROPERTY_NAME = "junit.jupiter.extensions.testInstantiation.extensionContextScope.default"; } } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java index 1b0636f18d10..2f64dd866cd2 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java @@ -33,6 +33,7 @@ import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.Timeout; +import org.junit.jupiter.api.extension.TestInstantiationAwareExtension.ExtensionContextScope; import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.api.parallel.Execution; import org.junit.jupiter.engine.config.JupiterConfiguration; @@ -369,6 +370,16 @@ public final class Constants { @API(status = EXPERIMENTAL, since = "5.10") public static final String DEFAULT_TEMP_DIR_FACTORY_PROPERTY_NAME = TempDir.DEFAULT_FACTORY_PROPERTY_NAME; + /** + * Property name used to set the default extension context scope for + * extensions that participate in test instantiation: {@value} + * + * @since 5.12 + * @see org.junit.jupiter.api.extension.TestInstantiationAwareExtension + */ + @API(status = EXPERIMENTAL, since = "5.12") + public static final String DEFAULT_TEST_CLASS_INSTANCE_CONSTRUCTION_EXTENSION_CONTEXT_SCOPE_PROPERTY_NAME = ExtensionContextScope.DEFAULT_SCOPE_PROPERTY_NAME; + private Constants() { /* no-op */ } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/CachingJupiterConfiguration.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/CachingJupiterConfiguration.java index 1280c4b12a11..3082830d2146 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/CachingJupiterConfiguration.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/CachingJupiterConfiguration.java @@ -26,6 +26,7 @@ import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.extension.ExecutionCondition; +import org.junit.jupiter.api.extension.TestInstantiationAwareExtension.ExtensionContextScope; import org.junit.jupiter.api.io.CleanupMode; import org.junit.jupiter.api.io.TempDirFactory; import org.junit.jupiter.api.parallel.ExecutionMode; @@ -58,71 +59,77 @@ public Optional getRawConfigurationParameter(String key, Function delegate.isParallelExecutionEnabled()); + __ -> delegate.isParallelExecutionEnabled()); } @Override public boolean isExtensionAutoDetectionEnabled() { return (boolean) cache.computeIfAbsent(EXTENSIONS_AUTODETECTION_ENABLED_PROPERTY_NAME, - key -> delegate.isExtensionAutoDetectionEnabled()); + __ -> delegate.isExtensionAutoDetectionEnabled()); } @Override public ExecutionMode getDefaultExecutionMode() { return (ExecutionMode) cache.computeIfAbsent(DEFAULT_EXECUTION_MODE_PROPERTY_NAME, - key -> delegate.getDefaultExecutionMode()); + __ -> delegate.getDefaultExecutionMode()); } @Override public ExecutionMode getDefaultClassesExecutionMode() { return (ExecutionMode) cache.computeIfAbsent(DEFAULT_CLASSES_EXECUTION_MODE_PROPERTY_NAME, - key -> delegate.getDefaultClassesExecutionMode()); + __ -> delegate.getDefaultClassesExecutionMode()); } @Override public TestInstance.Lifecycle getDefaultTestInstanceLifecycle() { return (TestInstance.Lifecycle) cache.computeIfAbsent(DEFAULT_TEST_INSTANCE_LIFECYCLE_PROPERTY_NAME, - key -> delegate.getDefaultTestInstanceLifecycle()); + __ -> delegate.getDefaultTestInstanceLifecycle()); } @SuppressWarnings("unchecked") @Override public Predicate getExecutionConditionFilter() { return (Predicate) cache.computeIfAbsent(DEACTIVATE_CONDITIONS_PATTERN_PROPERTY_NAME, - key -> delegate.getExecutionConditionFilter()); + __ -> delegate.getExecutionConditionFilter()); } @Override public DisplayNameGenerator getDefaultDisplayNameGenerator() { return (DisplayNameGenerator) cache.computeIfAbsent(DEFAULT_DISPLAY_NAME_GENERATOR_PROPERTY_NAME, - key -> delegate.getDefaultDisplayNameGenerator()); + __ -> delegate.getDefaultDisplayNameGenerator()); } @SuppressWarnings("unchecked") @Override public Optional getDefaultTestMethodOrderer() { return (Optional) cache.computeIfAbsent(DEFAULT_TEST_METHOD_ORDER_PROPERTY_NAME, - key -> delegate.getDefaultTestMethodOrderer()); + __ -> delegate.getDefaultTestMethodOrderer()); } @SuppressWarnings("unchecked") @Override public Optional getDefaultTestClassOrderer() { return (Optional) cache.computeIfAbsent(DEFAULT_TEST_CLASS_ORDER_PROPERTY_NAME, - key -> delegate.getDefaultTestClassOrderer()); + __ -> delegate.getDefaultTestClassOrderer()); } @Override public CleanupMode getDefaultTempDirCleanupMode() { return (CleanupMode) cache.computeIfAbsent(DEFAULT_CLEANUP_MODE_PROPERTY_NAME, - key -> delegate.getDefaultTempDirCleanupMode()); + __ -> delegate.getDefaultTempDirCleanupMode()); } @SuppressWarnings("unchecked") @Override public Supplier getDefaultTempDirFactorySupplier() { return (Supplier) cache.computeIfAbsent(DEFAULT_FACTORY_PROPERTY_NAME, - key -> delegate.getDefaultTempDirFactorySupplier()); + __ -> delegate.getDefaultTempDirFactorySupplier()); } + @Override + public ExtensionContextScope getDefaultTestInstantiationExtensionContextScope() { + return (ExtensionContextScope) cache.computeIfAbsent( + DEFAULT_TEST_INSTANTIATION_EXTENSION_CONTEXT_SCOPE_PROPERTY_NAME, + __ -> delegate.getDefaultTestInstantiationExtensionContextScope()); + } } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/DefaultJupiterConfiguration.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/DefaultJupiterConfiguration.java index 83ef7592534f..1057ab563b1f 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/DefaultJupiterConfiguration.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/DefaultJupiterConfiguration.java @@ -26,6 +26,7 @@ import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.TestInstance.Lifecycle; import org.junit.jupiter.api.extension.ExecutionCondition; +import org.junit.jupiter.api.extension.TestInstantiationAwareExtension.ExtensionContextScope; import org.junit.jupiter.api.io.CleanupMode; import org.junit.jupiter.api.io.TempDirFactory; import org.junit.jupiter.api.parallel.ExecutionMode; @@ -62,6 +63,9 @@ public class DefaultJupiterConfiguration implements JupiterConfiguration { private static final InstantiatingConfigurationParameterConverter tempDirFactoryConverter = // new InstantiatingConfigurationParameterConverter<>(TempDirFactory.class, "temp dir factory"); + private static final EnumConfigurationParameterConverter extensionContextScopeConverter = // + new EnumConfigurationParameterConverter<>(ExtensionContextScope.class, "extension context scope"); + private final ConfigurationParameters configurationParameters; public DefaultJupiterConfiguration(ConfigurationParameters configurationParameters) { @@ -141,4 +145,10 @@ public Supplier getDefaultTempDirFactorySupplier() { return () -> supplier.get().orElse(TempDirFactory.Standard.INSTANCE); } + @SuppressWarnings("deprecation") + @Override + public ExtensionContextScope getDefaultTestInstantiationExtensionContextScope() { + return extensionContextScopeConverter.get(configurationParameters, + DEFAULT_TEST_INSTANTIATION_EXTENSION_CONTEXT_SCOPE_PROPERTY_NAME, ExtensionContextScope.DEFAULT); + } } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java index 7a90072363d2..c695e7e4b10b 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java @@ -23,6 +23,7 @@ import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.extension.ExecutionCondition; +import org.junit.jupiter.api.extension.TestInstantiationAwareExtension.ExtensionContextScope; import org.junit.jupiter.api.io.CleanupMode; import org.junit.jupiter.api.io.TempDirFactory; import org.junit.jupiter.api.parallel.Execution; @@ -42,7 +43,8 @@ public interface JupiterConfiguration { String DEFAULT_TEST_INSTANCE_LIFECYCLE_PROPERTY_NAME = TestInstance.Lifecycle.DEFAULT_LIFECYCLE_PROPERTY_NAME; String DEFAULT_DISPLAY_NAME_GENERATOR_PROPERTY_NAME = DisplayNameGenerator.DEFAULT_GENERATOR_PROPERTY_NAME; String DEFAULT_TEST_METHOD_ORDER_PROPERTY_NAME = MethodOrderer.DEFAULT_ORDER_PROPERTY_NAME; - String DEFAULT_TEST_CLASS_ORDER_PROPERTY_NAME = ClassOrderer.DEFAULT_ORDER_PROPERTY_NAME; + String DEFAULT_TEST_CLASS_ORDER_PROPERTY_NAME = ClassOrderer.DEFAULT_ORDER_PROPERTY_NAME;; + String DEFAULT_TEST_INSTANTIATION_EXTENSION_CONTEXT_SCOPE_PROPERTY_NAME = ExtensionContextScope.DEFAULT_SCOPE_PROPERTY_NAME; Optional getRawConfigurationParameter(String key); @@ -70,4 +72,6 @@ public interface JupiterConfiguration { Supplier getDefaultTempDirFactorySupplier(); + ExtensionContextScope getDefaultTestInstantiationExtensionContextScope(); + } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java index 69ad2ee520d0..ee53adcb2500 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java @@ -288,7 +288,7 @@ private TestInstances instantiateAndPostProcessTestInstance(JupiterEngineExecuti JupiterEngineExecutionContext context) { ExtensionContextSupplier extensionContext = ExtensionContextSupplier.create(context.getExtensionContext(), - ourExtensionContext); + ourExtensionContext, configuration); TestInstances instances = instantiateTestClass(parentExecutionContext, extensionContext, registry, context); context.getThrowableCollector().execute(() -> { invokeTestInstancePostProcessors(instances.getInnermostInstance(), registry, extensionContext); diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java index 9b911c86a626..84c172765b93 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java @@ -16,6 +16,7 @@ import org.apiguardian.api.API; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.TestInstantiationAwareExtension; +import org.junit.jupiter.engine.config.JupiterConfiguration; /** * Container of two instances of {@link ExtensionContext} to simplify the legacy for @@ -29,8 +30,9 @@ public interface ExtensionContextSupplier { static ExtensionContextSupplier create(ExtensionContext currentExtensionContext, - ExtensionContext legacyExtensionContext) { - if (currentExtensionContext == legacyExtensionContext) { + ExtensionContext legacyExtensionContext, JupiterConfiguration configuration) { + if (currentExtensionContext == legacyExtensionContext + || configuration.getDefaultTestInstantiationExtensionContextScope() == TEST_METHOD) { return __ -> currentExtensionContext; } return new ScopeBasedExtensionContextSupplier(currentExtensionContext, legacyExtensionContext); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvokerTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvokerTests.java index aea972a34978..6de1cd4935eb 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvokerTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvokerTests.java @@ -31,9 +31,8 @@ void invokeMethod() { @Override T invokeConstructor(Constructor constructor, Object outerInstance) { - ExtensionContextSupplier context = ExtensionContextSupplier.create(extensionContext, extensionContext); - return newInvoker().invoke(constructor, Optional.ofNullable(outerInstance), context, extensionRegistry, - passthroughInterceptor()); + return newInvoker().invoke(constructor, Optional.ofNullable(outerInstance), __ -> extensionContext, + extensionRegistry, passthroughInterceptor()); } private InterceptingExecutableInvoker newInvoker() { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java index 15a280b5683c..1549260f0007 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java @@ -15,6 +15,8 @@ import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS; import static org.junit.jupiter.api.extension.TestInstantiationAwareExtension.ExtensionContextScope.TEST_METHOD; import static org.junit.platform.commons.util.ClassUtils.nullSafeToString; +import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; +import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; import static org.junit.platform.testkit.engine.EventConditions.container; import static org.junit.platform.testkit.engine.EventConditions.engine; import static org.junit.platform.testkit.engine.EventConditions.event; @@ -44,6 +46,7 @@ import org.junit.jupiter.api.extension.TestInstanceFactoryContext; import org.junit.jupiter.api.extension.TestInstantiationException; import org.junit.jupiter.engine.AbstractJupiterTestEngineTests; +import org.junit.jupiter.engine.Constants; import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.test.TestClassLoader; import org.junit.platform.testkit.engine.EngineExecutionResults; @@ -429,6 +432,36 @@ void instanceFactoryWithLegacyContext() { // @formatter:on } + @Test + void instanceFactoryWithLegacyContextAndChangedDefaultScope() { + var executionResults = executeTests(request() // + .selectors(selectClass(LegacyContextTestCase.class)) // + .configurationParameter( + Constants.DEFAULT_TEST_CLASS_INSTANCE_CONSTRUCTION_EXTENSION_CONTEXT_SCOPE_PROPERTY_NAME, + TEST_METHOD.name())); + + assertEquals(3, executionResults.testEvents().started().count(), "# tests started"); + assertEquals(3, executionResults.testEvents().succeeded().count(), "# tests succeeded"); + + // @formatter:off + assertThat(callSequence).containsExactly( + "LegacyInstanceFactory instantiated: LegacyContextTestCase", + "outerTest", + "close LegacyContextTestCase", + "LegacyInstanceFactory instantiated: LegacyContextTestCase", + "LegacyInstanceFactory instantiated: InnerTestCase", + "innerTest1", + "close InnerTestCase", + "close LegacyContextTestCase", + "LegacyInstanceFactory instantiated: LegacyContextTestCase", + "LegacyInstanceFactory instantiated: InnerTestCase", + "innerTest2", + "close InnerTestCase", + "close LegacyContextTestCase" + ); + // @formatter:on + } + // ------------------------------------------------------------------------- @SuppressWarnings("JUnitMalformedDeclaration") @@ -797,8 +830,8 @@ public Object createTestInstance(TestInstanceFactoryContext factoryContext, Exte } } - private static boolean instantiated(Class factoryClass, Class testClass) { - return callSequence.add(factoryClass.getSimpleName() + " instantiated: " + testClass.getSimpleName()); + private static void instantiated(Class factoryClass, Class testClass) { + callSequence.add(factoryClass.getSimpleName() + " instantiated: " + testClass.getSimpleName()); } } From e98949e210203082ae100c84f56a722a73151984 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 10 Oct 2024 12:36:21 +0200 Subject: [PATCH 169/611] Use new scope in TimeoutExtension This extension is not affected by the change in behavior since annotating test class constructors with `@Timeout` is not supported. --- .../org/junit/jupiter/engine/extension/TimeoutExtension.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutExtension.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutExtension.java index f9b23e0e4cbd..f8b87a62bed8 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutExtension.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutExtension.java @@ -45,6 +45,11 @@ class TimeoutExtension implements BeforeAllCallback, BeforeEachCallback, Invocat private static final String DISABLED_MODE_VALUE = "disabled"; private static final String DISABLED_ON_DEBUG_MODE_VALUE = "disabled_on_debug"; + @Override + public ExtensionContextScope getTestInstantiationExtensionContextScope(ExtensionContext rootContext) { + return ExtensionContextScope.TEST_METHOD; + } + @Override public void beforeAll(ExtensionContext context) { readAndStoreTimeoutSoChildrenInheritIt(context); From b14cc39f1348a4379d8c9740b6e0b3c122233683 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 10 Oct 2024 12:45:35 +0200 Subject: [PATCH 170/611] Use new scope in RepetitionExtension This extension is not affected by the change in behavior since it did not use the supplied `ExtensionContext`. --- .../junit/jupiter/engine/extension/RepetitionExtension.java | 5 +++++ .../junit/jupiter/engine/extension/RepeatedTestTests.java | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepetitionExtension.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepetitionExtension.java index e4975f866d52..6e1682db8ec6 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepetitionExtension.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepetitionExtension.java @@ -45,6 +45,11 @@ class RepetitionExtension implements ParameterResolver, TestWatcher, ExecutionCo this.repetitionInfo = repetitionInfo; } + @Override + public ExtensionContextScope getTestInstantiationExtensionContextScope(ExtensionContext rootContext) { + return ExtensionContextScope.TEST_METHOD; + } + @Override public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) { return (parameterContext.getParameter().getType() == RepetitionInfo.class); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/RepeatedTestTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/RepeatedTestTests.java index df7b9f309014..410255454622 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/RepeatedTestTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/RepeatedTestTests.java @@ -12,6 +12,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.engine.Constants.DEFAULT_PARALLEL_EXECUTION_MODE; import static org.junit.jupiter.engine.Constants.PARALLEL_CONFIG_FIXED_PARALLELISM_PROPERTY_NAME; @@ -120,6 +121,11 @@ static void afterAll() { assertEquals(42, fortyTwo); } + // Can be injected into test class constructors if the test class only has @RepeatedTest methods + public LifecycleMethodTests(RepetitionInfo repetitionInfo) { + assertNotNull(repetitionInfo); + } + @BeforeEach @AfterEach void beforeAndAfterEach(TestInfo testInfo, RepetitionInfo repetitionInfo) { From 8f49c2d3bc382b4ac9d7a78a64b3b711b0363392 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 10 Oct 2024 12:48:52 +0200 Subject: [PATCH 171/611] Use new scope in ParameterizedTestParameterResolver This extension is not affected by the change in behavior since it does not support resolving parameters for test class constructors. --- .../jupiter/params/ParameterizedTestParameterResolver.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestParameterResolver.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestParameterResolver.java index f4ea4a177ec6..10e0085c1a73 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestParameterResolver.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestParameterResolver.java @@ -44,6 +44,11 @@ class ParameterizedTestParameterResolver implements ParameterResolver, AfterTest this.invocationIndex = invocationIndex; } + @Override + public ExtensionContextScope getTestInstantiationExtensionContextScope(ExtensionContext rootContext) { + return ExtensionContextScope.TEST_METHOD; + } + @Override public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) { Executable declaringExecutable = parameterContext.getDeclaringExecutable(); From 75bd39e12e62331152209aa0458fbbd0c3d4bb96 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 10 Oct 2024 13:02:08 +0200 Subject: [PATCH 172/611] Use new scope in TestReporterParameterResolver When injecting `TestReporter` into test class constructors the published report entries are now associated with the test method rather than the test class unless the test instance lifecycle is set to `PER_CLASS` (in which case they will continue to be associated with the test class). --- .../release-notes-5.12.0-M1.adoc | 7 +++- .../TestReporterParameterResolver.java | 5 +++ .../junit/jupiter/engine/ReportingTests.java | 34 +++++++++++++++---- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index ba8710106188..bc9ad8e05d4b 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -44,7 +44,12 @@ JUnit repository on GitHub. [[release-notes-5.12.0-M1-junit-jupiter-deprecations-and-breaking-changes]] ==== Deprecations and Breaking Changes -* ❓ +* When injecting `TestReporter` into test class constructors the published report entries + are now associated with the test method rather than the test class unless the test + instance lifecycle is set to `PER_CLASS` (in which case they will continue to be + associated with the test class). If you want to publish report entries for the test + class, you can implement a class-level lifecycle method (e.g., `@BeforeAll`) and inject + `TestReporter` into that method. [[release-notes-5.12.0-M1-junit-jupiter-new-features-and-improvements]] ==== New Features and Improvements diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TestReporterParameterResolver.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TestReporterParameterResolver.java index 57e402da37e8..c06536d448dc 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TestReporterParameterResolver.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TestReporterParameterResolver.java @@ -22,6 +22,11 @@ */ class TestReporterParameterResolver implements ParameterResolver { + @Override + public ExtensionContextScope getTestInstantiationExtensionContextScope(ExtensionContext rootContext) { + return ExtensionContextScope.TEST_METHOD; + } + @Override public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) { return (parameterContext.getParameter().getType() == TestReporter.class); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java index 534cb625f481..19176dd10003 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java @@ -12,6 +12,9 @@ import static java.util.Collections.emptyMap; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.engine.Constants.DEFAULT_TEST_INSTANCE_LIFECYCLE_PROPERTY_NAME; +import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; +import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; import java.util.HashMap; import java.util.Map; @@ -19,7 +22,10 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance.Lifecycle; import org.junit.jupiter.api.TestReporter; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; import org.junit.platform.commons.PreconditionViolationException; /** @@ -27,18 +33,32 @@ */ class ReportingTests extends AbstractJupiterTestEngineTests { - @Test - void reportEntriesArePublished() { - executeTestsForClass(MyReportingTestCase.class).testEvents().assertStatistics(stats -> stats // - .started(2) // - .succeeded(2) // - .failed(0) // - .reportingEntryPublished(7)); + @ParameterizedTest + @CsvSource(textBlock = """ + PER_CLASS, 7 + PER_METHOD, 9 + """) + void reportEntriesArePublished(Lifecycle lifecycle, int expectedReportEntryCount) { + var request = request() // + .selectors(selectClass(MyReportingTestCase.class)) // + .configurationParameter(DEFAULT_TEST_INSTANCE_LIFECYCLE_PROPERTY_NAME, lifecycle.name()); + executeTests(request) // + .testEvents() // + .assertStatistics(stats -> stats // + .started(2) // + .succeeded(2) // + .failed(0) // + .reportingEntryPublished(expectedReportEntryCount)); } @SuppressWarnings("JUnitMalformedDeclaration") static class MyReportingTestCase { + public MyReportingTestCase(TestReporter reporter) { + // Reported on class-level for PER_CLASS lifecycle and on method-level for PER_METHOD lifecycle + reporter.publishEntry("Constructor"); + } + @BeforeEach void beforeEach(TestReporter reporter) { reporter.publishEntry("@BeforeEach"); From b08368670027eb0b593b22ca695ddc32e99fd03b Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 10 Oct 2024 13:16:02 +0200 Subject: [PATCH 173/611] Use new scope in TestInfoParameterResolver When injecting `TestInfo` into test class constructors it now contains data of the test method the test class instance is being created for unless the test instance lifecycle is set to `PER_CLASS` (in which case it continues to contain the data of the test class). --- .../asciidoc/release-notes/release-notes-5.12.0-M1.adoc | 5 +++++ .../src/docs/asciidoc/user-guide/writing-tests.adoc | 4 ++-- documentation/src/test/java/example/TestInfoDemo.java | 9 ++++++++- .../engine/extension/TestInfoParameterResolver.java | 5 +++++ .../engine/extension/TestInfoParameterResolverTests.java | 9 +++++++-- .../params/ParameterizedTestIntegrationTests.java | 8 ++++---- 6 files changed, 31 insertions(+), 9 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index bc9ad8e05d4b..0d0100dcf0df 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -44,6 +44,11 @@ JUnit repository on GitHub. [[release-notes-5.12.0-M1-junit-jupiter-deprecations-and-breaking-changes]] ==== Deprecations and Breaking Changes +* When injecting `TestInfo` into test class constructors it now contains data of the test + method the test class instance is being created for unless the test instance lifecycle + is set to `PER_CLASS` (in which case it continues to contain the data of the test + class). If you require the `TestInfo` of the test class, you can implement a class-level + lifecycle method (e.g., `@BeforeAll`) and inject `TestInfo` into that method. * When injecting `TestReporter` into test class constructors the published report entries are now associated with the test method rather than the test class unless the test instance lifecycle is set to `PER_CLASS` (in which case they will continue to be diff --git a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc index ccb0f5344588..8df05f70c3ba 100644 --- a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc +++ b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc @@ -1058,8 +1058,8 @@ There are currently three built-in resolvers that are registered automatically. method, or a custom name configured via `@DisplayName`. + `{TestInfo}` acts as a drop-in replacement for the `TestName` rule from JUnit 4. The -following demonstrates how to have `TestInfo` injected into a test constructor, -`@BeforeEach` method, and `@Test` method. +following demonstrates how to have `TestInfo` injected into a `@BeforeAll` method, test +class constructor, `@BeforeEach` method, and `@Test` method. [source,java,indent=0] ---- diff --git a/documentation/src/test/java/example/TestInfoDemo.java b/documentation/src/test/java/example/TestInfoDemo.java index eae99ae63afc..a77cfb48b52a 100644 --- a/documentation/src/test/java/example/TestInfoDemo.java +++ b/documentation/src/test/java/example/TestInfoDemo.java @@ -14,6 +14,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Tag; @@ -23,10 +24,16 @@ @DisplayName("TestInfo Demo") class TestInfoDemo { - TestInfoDemo(TestInfo testInfo) { + @BeforeAll + static void beforeAll(TestInfo testInfo) { assertEquals("TestInfo Demo", testInfo.getDisplayName()); } + TestInfoDemo(TestInfo testInfo) { + String displayName = testInfo.getDisplayName(); + assertTrue(displayName.equals("TEST 1") || displayName.equals("test2()")); + } + @BeforeEach void init(TestInfo testInfo) { String displayName = testInfo.getDisplayName(); diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TestInfoParameterResolver.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TestInfoParameterResolver.java index 6805daece4a1..96b7a617db4b 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TestInfoParameterResolver.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TestInfoParameterResolver.java @@ -28,6 +28,11 @@ */ class TestInfoParameterResolver implements ParameterResolver { + @Override + public ExtensionContextScope getTestInstantiationExtensionContextScope(ExtensionContext rootContext) { + return ExtensionContextScope.TEST_METHOD; + } + @Override public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) { return (parameterContext.getParameter().getType() == TestInfo.class); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInfoParameterResolverTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInfoParameterResolverTests.java index 2a66c6f4ae2a..63a6cf8b985c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInfoParameterResolverTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInfoParameterResolverTests.java @@ -35,8 +35,13 @@ @Tag("class-tag") class TestInfoParameterResolverTests { - private static List allDisplayNames = Arrays.asList("defaultDisplayName(TestInfo)", "custom display name", - "getTags(TestInfo)", "customDisplayNameThatIsEmpty(TestInfo)"); + private static final List allDisplayNames = Arrays.asList("defaultDisplayName(TestInfo)", + "custom display name", "getTags(TestInfo)", "customDisplayNameThatIsEmpty(TestInfo)"); + + public TestInfoParameterResolverTests(TestInfo testInfo) { + assertThat(testInfo.getTestClass()).contains(TestInfoParameterResolverTests.class); + assertThat(testInfo.getTestMethod()).isPresent(); + } @Test void defaultDisplayName(TestInfo testInfo) { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java index 9e5c5a8e6910..c95e28b2dd63 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java @@ -404,20 +404,20 @@ void executesLifecycleMethods() { assertThat(LifecycleTestCase.lifecycleEvents).containsExactly( "beforeAll:ParameterizedTestIntegrationTests$LifecycleTestCase", "providerMethod", - "constructor:ParameterizedTestIntegrationTests$LifecycleTestCase", + "constructor:[1] argument=foo", "beforeEach:[1] argument=foo", testMethods.get(0) + ":[1] argument=foo", "afterEach:[1] argument=foo", - "constructor:ParameterizedTestIntegrationTests$LifecycleTestCase", + "constructor:[2] argument=bar", "beforeEach:[2] argument=bar", testMethods.get(0) + ":[2] argument=bar", "afterEach:[2] argument=bar", "providerMethod", - "constructor:ParameterizedTestIntegrationTests$LifecycleTestCase", + "constructor:[1] argument=foo", "beforeEach:[1] argument=foo", testMethods.get(1) + ":[1] argument=foo", "afterEach:[1] argument=foo", - "constructor:ParameterizedTestIntegrationTests$LifecycleTestCase", + "constructor:[2] argument=bar", "beforeEach:[2] argument=bar", testMethods.get(1) + ":[2] argument=bar", "afterEach:[2] argument=bar", From a6230dfc66555224e76bc54eacc6e138c55c1d72 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 10 Oct 2024 16:13:59 +0200 Subject: [PATCH 174/611] Add tests for extension context scope supplied to InvocationInterceptor --- .../extension/InvocationInterceptorTests.java | 102 +++++++++++++++--- 1 file changed, 85 insertions(+), 17 deletions(-) diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/InvocationInterceptorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/InvocationInterceptorTests.java index 2557a8173236..4f9b6391f5fb 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/InvocationInterceptorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/InvocationInterceptorTests.java @@ -10,6 +10,8 @@ package org.junit.jupiter.engine.extension; +import static java.util.function.Function.identity; +import static java.util.function.Predicate.isEqual; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; @@ -22,7 +24,10 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Method; -import java.util.EnumSet; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.function.UnaryOperator; import java.util.stream.Stream; import org.junit.jupiter.api.AfterAll; @@ -30,9 +35,12 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DynamicTest; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; import org.junit.jupiter.api.RepeatedTest; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestFactory; +import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.TestReporter; import org.junit.jupiter.api.extension.DynamicTestInvocationContext; import org.junit.jupiter.api.extension.ExtendWith; @@ -42,8 +50,6 @@ import org.junit.jupiter.api.extension.ReflectiveInvocationContext; import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.engine.AbstractJupiterTestEngineTests; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; import org.junit.platform.commons.JUnitException; import org.junit.platform.engine.reporting.ReportEntry; import org.junit.platform.testkit.engine.EngineExecutionResults; @@ -130,28 +136,76 @@ void test() { } } - @ParameterizedTest(name = "{0}") - @EnumSource(InvocationType.class) - void callsInterceptors(InvocationType invocationType) { + @TestFactory + Stream callsInterceptors() { var results = executeTestsForClass(TestCaseWithThreeInterceptors.class); results.testEvents().assertStatistics(stats -> stats.failed(0).succeeded(3)); - assertThat(getEvents(results, EnumSet.of(invocationType)).distinct()) // - .containsExactly("before:foo", "before:bar", "before:baz", "test", "after:baz", "after:bar", - "after:foo"); + return Arrays.stream(InvocationType.values()) // + .map(it -> dynamicTest(it.name(), () -> verifyEvents(results, it))); } - private Stream getEvents(EngineExecutionResults results, EnumSet types) { - return results.allEvents().reportingEntryPublished() // - .map(event -> event.getPayload(ReportEntry.class).orElseThrow()) // - .map(ReportEntry::getKeyValuePairs) // - .filter(map -> map.keySet().stream().map(InvocationType::valueOf).anyMatch(types::contains)) // - .flatMap(map -> map.values().stream()); + private void verifyEvents(EngineExecutionResults results, InvocationType invocationType) { + var beforeEvents = List.of("before:foo", "before:bar", "before:baz"); + var testEvent = List.of("test"); + var afterEvents = List.of("after:baz", "after:bar", "after:foo"); + var allEvents = Stream.of(beforeEvents, testEvent, afterEvents).flatMap(Collection::stream).toList(); + String testClassName = TestCaseWithThreeInterceptors.class.getName(); + + var expectedElements = switch (invocationType) { + case BEFORE_ALL, AFTER_ALL -> prefixed(allEvents, testClassName); + case CONSTRUCTOR -> concatStreams( + prefixed(allEvents, it -> it.endsWith(":bar") ? testClassName : "test(TestReporter)"), + prefixed(allEvents, it -> it.endsWith(":bar") ? testClassName : "testTemplate(TestReporter)[1]"), + prefixed(allEvents, it -> it.endsWith(":bar") ? testClassName : "testFactory(TestReporter)")); + case BEFORE_EACH, AFTER_EACH -> concatStreams(prefixed(allEvents, "test(TestReporter)"), + prefixed(allEvents, "testTemplate(TestReporter)[1]"), prefixed(allEvents, "testFactory(TestReporter)")); + case TEST_METHOD -> prefixed(allEvents, "test(TestReporter)"); + case TEST_TEMPLATE_METHOD -> prefixed(allEvents, "testTemplate(TestReporter)[1]"); + case TEST_FACTORY_METHOD -> prefixed(allEvents, "testFactory(TestReporter)"); + case DYNAMIC_TEST -> concatStreams(prefixed(beforeEvents, "testFactory(TestReporter)[1]"), + prefixed(testEvent, "testFactory(TestReporter)"), + prefixed(afterEvents, "testFactory(TestReporter)[1]")); + }; + + assertThat(getEvents(results, invocationType)) // + .containsExactlyElementsOf(expectedElements.toList()); + } + + @SafeVarargs + @SuppressWarnings("varargs") + private static Stream concatStreams(Stream... items) { + return Stream.of(items).flatMap(identity()); + } + + private static Stream prefixed(List values, String prefix) { + return prefixed(values, __ -> prefix); + } + + private static Stream prefixed(List values, UnaryOperator prefixGenerator) { + return values.stream() // + .map(it -> "[%s] %s".formatted(prefixGenerator.apply(it), it)); + } + + private Stream getEvents(EngineExecutionResults results, InvocationType invocationType) { + return results.allEvents().reportingEntryPublished().stream() // + .flatMap(event -> { + var reportEntry = event.getPayload(ReportEntry.class).orElseThrow(); + var keyValuePairs = reportEntry.getKeyValuePairs(); + if (keyValuePairs.keySet().stream() // + .map(InvocationType::valueOf) // + .anyMatch(isEqual(invocationType))) { + return keyValuePairs.values().stream() // + .map(it -> "[%s] %s".formatted(event.getTestDescriptor().getLegacyReportingName(), it)); + } + return Stream.empty(); + }); } @SuppressWarnings("JUnitMalformedDeclaration") @ExtendWith({ FooInvocationInterceptor.class, BarInvocationInterceptor.class, BazInvocationInterceptor.class }) + @TestMethodOrder(MethodOrderer.OrderAnnotation.class) static class TestCaseWithThreeInterceptors { public TestCaseWithThreeInterceptors(TestReporter reporter) { @@ -169,16 +223,19 @@ void beforeEach(TestReporter reporter) { publish(reporter, InvocationType.BEFORE_EACH); } + @Order(1) @Test void test(TestReporter reporter) { publish(reporter, InvocationType.TEST_METHOD); } + @Order(2) @RepeatedTest(1) void testTemplate(TestReporter reporter) { publish(reporter, InvocationType.TEST_TEMPLATE_METHOD); } + @Order(3) @TestFactory DynamicTest testFactory(TestReporter reporter) { publish(reporter, InvocationType.TEST_FACTORY_METHOD); @@ -224,6 +281,11 @@ abstract static class ReportingInvocationInterceptor implements InvocationInterc this.name = name; } + @Override + public ExtensionContextScope getTestInstantiationExtensionContextScope(ExtensionContext rootContext) { + return ExtensionContextScope.TEST_METHOD; + } + @Override public void interceptBeforeAllMethod(Invocation invocation, ReflectiveInvocationContext invocationContext, ExtensionContext extensionContext) @@ -299,8 +361,8 @@ public void interceptDynamicTest(Invocation invocation, DynamicTestInvocat assertThat(invocationContext.getExecutable()).isNotNull(); assertThat(extensionContext.getUniqueId()).isNotBlank(); assertThat(extensionContext.getElement()).isEmpty(); - assertThat(extensionContext.getParent().flatMap(ExtensionContext::getTestMethod)).contains( - testClass.getDeclaredMethod("testFactory", TestReporter.class)); + assertThat(extensionContext.getParent().flatMap(ExtensionContext::getTestMethod)) // + .contains(testClass.getDeclaredMethod("testFactory", TestReporter.class)); reportAndProceed(invocation, extensionContext, InvocationType.DYNAMIC_TEST); } @@ -350,6 +412,12 @@ static class BarInvocationInterceptor extends ReportingInvocationInterceptor { BarInvocationInterceptor() { super("bar"); } + + @SuppressWarnings("deprecation") + @Override + public ExtensionContextScope getTestInstantiationExtensionContextScope(ExtensionContext rootContext) { + return ExtensionContextScope.DEFAULT; + } } static class BazInvocationInterceptor extends ReportingInvocationInterceptor { From 5d62d9a5d468e5f31ed3c42a21789cd812093e6e Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 14 Oct 2024 09:43:26 +0200 Subject: [PATCH 175/611] Polish documentation for test-scoped extension context opt-in --- .../docs/asciidoc/user-guide/extensions.adoc | 27 ++++++++++++------- .../api/extension/InvocationInterceptor.java | 15 +++++++---- .../api/extension/ParameterResolver.java | 18 +++++++------ .../api/extension/TestInstanceFactory.java | 15 +++++++---- .../extension/TestInstancePostProcessor.java | 15 +++++++---- .../TestInstancePreConstructCallback.java | 15 +++++++---- 6 files changed, 67 insertions(+), 38 deletions(-) diff --git a/documentation/src/docs/asciidoc/user-guide/extensions.adoc b/documentation/src/docs/asciidoc/user-guide/extensions.adoc index b651f4506ae5..3e8c551415dc 100644 --- a/documentation/src/docs/asciidoc/user-guide/extensions.adoc +++ b/documentation/src/docs/asciidoc/user-guide/extensions.adoc @@ -382,10 +382,11 @@ in combination with other extensions to prepare constructor parameters or keepin instances and their lifecycle. [NOTE] +.Accessing the test-scoped `ExtensionContext` ==== You may override the `getTestInstantiationExtensionContextScope(...)` method to return -`TEST_SCOPED` for revised handling of `CloseableResource` and to make test-specific data -available to your implementation. +`TEST_METHOD` to make test-specific data available to your extension implementation or if +you want to <> on the test method level. ==== [[extensions-test-instance-factories]] @@ -415,10 +416,11 @@ registered for any specific test class. ==== [NOTE] +.Accessing the test-scoped `ExtensionContext` ==== You may override the `getTestInstantiationExtensionContextScope(...)` method to return -`TEST_SCOPED` for revised handling of `CloseableResource` and to make test-specific data -available to your implementation. +`TEST_METHOD` to make test-specific data available to your extension implementation or if +you want to <> on the test method level. ==== [[extensions-test-instance-post-processing]] @@ -434,10 +436,11 @@ For a concrete example, consult the source code for the `{MockitoExtension}` and `{SpringExtension}`. [NOTE] +.Accessing the test-scoped `ExtensionContext` ==== You may override the `getTestInstantiationExtensionContextScope(...)` method to return -`TEST_SCOPED` for revised handling of `CloseableResource` and to make test-specific data -available to your implementation. +`TEST_METHOD` to make test-specific data available to your extension implementation or if +you want to <> on the test method level. ==== [[extensions-test-instance-pre-destroy-callback]] @@ -487,15 +490,17 @@ those provided in `java.lang.reflect.Parameter` in order to avoid this bug in th ==== [NOTE] +.Accessing the test-scoped `ExtensionContext` ==== You may override the `getTestInstantiationExtensionContextScope(...)` method to return -`TEST_SCOPED` to support injecting test specific data into constructor parameters of the +`TEST_METHOD` to support injecting test specific data into constructor parameters of the test class instance. Doing so causes a test-specific `{ExtensionContext}` to be used while resolving constructor parameters, unless the <> is set to `PER_CLASS`. ==== -[NOTE] +[TIP] +.Parameter resolution for methods called from extensions ==== Other extensions can also leverage registered `ParameterResolvers` for method and constructor invocations, using the `{ExecutableInvoker}` available via the @@ -726,10 +731,12 @@ include::{testDir}/example/interceptor/SwingEdtInterceptor.java[tags=user_guide] ---- [NOTE] +.Accessing the test-scoped `ExtensionContext` ==== You may override the `getTestInstantiationExtensionContextScope(...)` method to return -`TEST_SCOPED` to make test-specific data available to your implementation of -`interceptTestClassConstructor` and for a revised scope of the provided `Store` instance. +`TEST_METHOD` to make test-specific data available to your extension implementation of +`interceptTestClassConstructor` or if you want to <> +on the test method level. ==== [[extensions-test-templates]] diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java index 58aa743cd27a..ed4dfb37df57 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java @@ -24,8 +24,8 @@ import org.junit.jupiter.api.DynamicTest; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestFactory; +import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.TestTemplate; -import org.junit.jupiter.api.extension.ExtensionContext.Store; /** * {@code InvocationInterceptor} defines the API for {@link Extension @@ -59,10 +59,15 @@ public interface InvocationInterceptor extends TestInstantiationAwareExtension { *

    Note that the test class may not have been initialized * (static initialization) when this method is invoked. * - *

    Extensions may override - * {@link #getTestInstantiationExtensionContextScope} to - * make test-specific data available to the implementation of this method - * and for a revised scope of the provided {@link Store Store} instance. + *

    By default, the supplied {@link ExtensionContext} represents the test + * class that's about to be constructed. Extensions may override + * {@link #getTestInstantiationExtensionContextScope} to return + * {@link ExtensionContextScope#TEST_METHOD TEST_METHOD} in order to change + * the scope of the {@code ExtensionContext} to the test method, unless the + * {@link TestInstance.Lifecycle#PER_CLASS PER_CLASS} lifecycle is used. + * Changing the scope makes test-specific data available to the + * implementation of this method and allows keeping state on the test level + * by using the provided {@link ExtensionContext.Store Store} instance. * * @param invocation the invocation that is being intercepted; never * {@code null} diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java index a0274c8558ab..8e405b32d16f 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java @@ -31,14 +31,16 @@ * an argument for the parameter must be resolved at runtime by a * {@code ParameterResolver}. * - *

    Extensions may override - * {@link #getTestInstantiationExtensionContextScope} to - * support injecting test specific data into constructor parameters of the test - * class instance. Returning - * {@link ExtensionContextScope#TEST_METHOD TEST_SCOPED} from this method, - * causes a test-specific {@link ExtensionContext} to be used while resolving - * constructor parameters, unless the lifecycle is set to - * {@link TestInstance.Lifecycle#PER_CLASS PER_CLASS}. + *

    By default, when the methods in this interface are called for a test class + * constructor, the supplied {@link ExtensionContext} represents the test + * class that's about to be instantiated. Extensions may override + * {@link #getTestInstantiationExtensionContextScope} to return + * {@link ExtensionContextScope#TEST_METHOD TEST_METHOD} in order to change + * the scope of the {@code ExtensionContext} to the test method, unless the + * {@link TestInstance.Lifecycle#PER_CLASS PER_CLASS} lifecycle is used. + * Changing the scope makes test-specific data available to the + * implementation of this method and allows keeping state on the test level + * by using the provided {@link ExtensionContext.Store Store} instance. * *

    Constructor Requirements

    * diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java index 4b9880dc79ba..1ed3c7b8e63d 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java @@ -13,7 +13,7 @@ import static org.apiguardian.api.API.Status.STABLE; import org.apiguardian.api.API; -import org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource; +import org.junit.jupiter.api.TestInstance; /** * {@code TestInstanceFactory} defines the API for {@link Extension @@ -57,10 +57,15 @@ public interface TestInstanceFactory extends TestInstantiationAwareExtension { /** * Callback for creating a test instance for the supplied context. * - *

    Extensions may override - * {@link #getTestInstantiationExtensionContextScope} for - * revised handling of {@link CloseableResource CloseableResource} and to - * make test-specific data available to your implementation. + *

    By default, the supplied {@link ExtensionContext} represents the test + * class that's about to be instantiated. Extensions may override + * {@link #getTestInstantiationExtensionContextScope} to return + * {@link ExtensionContextScope#TEST_METHOD TEST_METHOD} in order to change + * the scope of the {@code ExtensionContext} to the test method, unless the + * {@link TestInstance.Lifecycle#PER_CLASS PER_CLASS} lifecycle is used. + * Changing the scope makes test-specific data available to the + * implementation of this method and allows keeping state on the test level + * by using the provided {@link ExtensionContext.Store Store} instance. * *

    Note: the {@code ExtensionContext} supplied to a * {@code TestInstanceFactory} will always return an empty diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java index 9e80175cffb4..a136caf07a98 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java @@ -13,7 +13,7 @@ import static org.apiguardian.api.API.Status.STABLE; import org.apiguardian.api.API; -import org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource; +import org.junit.jupiter.api.TestInstance; /** * {@code TestInstancePostProcessor} defines the API for {@link Extension @@ -46,10 +46,15 @@ public interface TestInstancePostProcessor extends TestInstantiationAwareExtensi /** * Callback for post-processing the supplied test instance. * - *

    Extensions may override - * {@link #getTestInstantiationExtensionContextScope} for - * revised handling of {@link CloseableResource CloseableResource} and to - * make test-specific data available to your implementation. + *

    By default, the supplied {@link ExtensionContext} represents the test + * class that's being post-processed. Extensions may override + * {@link #getTestInstantiationExtensionContextScope} to return + * {@link ExtensionContextScope#TEST_METHOD TEST_METHOD} in order to change + * the scope of the {@code ExtensionContext} to the test method, unless the + * {@link TestInstance.Lifecycle#PER_CLASS PER_CLASS} lifecycle is used. + * Changing the scope makes test-specific data available to the + * implementation of this method and allows keeping state on the test level + * by using the provided {@link ExtensionContext.Store Store} instance. * *

    Note: the {@code ExtensionContext} supplied to a * {@code TestInstancePostProcessor} will always return an empty diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java index 774b9a375a09..a0a85eab4c2a 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java @@ -13,6 +13,7 @@ import static org.apiguardian.api.API.Status.STABLE; import org.apiguardian.api.API; +import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.TestInstance.Lifecycle; /** @@ -49,11 +50,15 @@ public interface TestInstancePreConstructCallback extends TestInstantiationAware /** * Callback invoked prior to test instances being constructed. * - *

    Extensions may override - * {@link #getTestInstantiationExtensionContextScope} to - * make test-specific data available to the implementation of this method - * and for a revised scope of the provided - * {@link ExtensionContext.Store Store} instance. + *

    By default, the supplied {@link ExtensionContext} represents the test + * class that's about to be constructed. Extensions may override + * {@link #getTestInstantiationExtensionContextScope} to return + * {@link ExtensionContextScope#TEST_METHOD TEST_METHOD} in order to change + * the scope of the {@code ExtensionContext} to the test method, unless the + * {@link TestInstance.Lifecycle#PER_CLASS PER_CLASS} lifecycle is used. + * Changing the scope makes test-specific data available to the + * implementation of this method and allows keeping state on the test level + * by using the provided {@link ExtensionContext.Store Store} instance. * * @param factoryContext the context for the test instance about to be instantiated; * never {@code null} From 8af0a77798ad40643a5e77bf2075978433e6554f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 21:10:52 +0000 Subject: [PATCH 176/611] Update github/codeql-action digest to f779452 --- .github/workflows/codeql-analysis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index f54d0da6f735..923e144c477e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -32,7 +32,7 @@ jobs: - name: Check out repository uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 - name: Initialize CodeQL - uses: github/codeql-action/init@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3 + uses: github/codeql-action/init@f779452ac5af1c261dce0346a8f964149f49322b # v3 with: languages: ${{ matrix.language }} tools: linked @@ -44,4 +44,4 @@ jobs: -Dscan.tag.CodeQL \ allMainClasses - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3 + uses: github/codeql-action/analyze@f779452ac5af1c261dce0346a8f964149f49322b # v3 From 9ec844bd946f41297b75869ce0f7b2dc49ff09da Mon Sep 17 00:00:00 2001 From: Nikita Skvortsov <539027+nskvortsov@users.noreply.github.com> Date: Wed, 17 Jul 2024 18:54:48 +0200 Subject: [PATCH 177/611] Introduce zero invocations in test templates and parameterized tests Add a flag to ParameterizedTest to control arguments requirement. This allows users to explicitly opt out from validation of arguments set count and silently skip a test if no arguments are provided In general, support TestTemplateInvocationContextProvider returning zero invocation contexts. Such providers must override new interface method to indicate that the framework should expect "no context returned" Resolves #1477 --- ...TestTemplateInvocationContextProvider.java | 19 ++++++ .../TestTemplateTestDescriptor.java | 18 ++--- .../jupiter/params/ParameterizedTest.java | 13 ++++ .../params/ParameterizedTestExtension.java | 12 +++- .../engine/TestTemplateInvocationTests.java | 65 ++++++++++++++++++- .../ParameterizedTestExtensionTests.java | 19 ++++++ .../ParameterizedTestIntegrationTests.java | 38 +++++++++++ 7 files changed, 168 insertions(+), 16 deletions(-) diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java index 851da77e7cd7..5fae0f7463a9 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java @@ -10,6 +10,7 @@ package org.junit.jupiter.api.extension; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.STABLE; import java.util.stream.Stream; @@ -86,4 +87,22 @@ public interface TestTemplateInvocationContextProvider extends Extension { */ Stream provideTestTemplateInvocationContexts(ExtensionContext context); + /** + * Signals that in the supplied {@linkplain ExtensionContext context} the provider may return zero + * {@linkplain TestTemplateInvocationContext invocation contexts}. + * + *

    If provider returns empty stream from {@link #provideTestTemplateInvocationContexts(ExtensionContext)} + * this will be considered an execution error. Override this method to ignore the absence of invocation contexts. + * + * @param context the extension context for the test template method about + * to be invoked; never {@code null} + * @return {@code true} to allow zero contexts, {@code false} (default) to fail execution in case of zero contexts. + * + * @since 5.12 + */ + @API(status = EXPERIMENTAL, since = "5.12") + default boolean mayReturnZeroInvocationContexts(ExtensionContext context) { + return false; + } + } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java index e6d78207d055..7952e2b3eefe 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java @@ -10,7 +10,6 @@ package org.junit.jupiter.engine.descriptor; -import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toList; import static org.apiguardian.api.API.Status.INTERNAL; import static org.junit.jupiter.engine.descriptor.ExtensionUtils.populateNewExtensionRegistryFromExtendWithAnnotation; @@ -102,13 +101,17 @@ public JupiterEngineExecutionContext execute(JupiterEngineExecutionContext conte context.getExtensionRegistry()); AtomicInteger invocationIndex = new AtomicInteger(); for (TestTemplateInvocationContextProvider provider : providers) { + int initialValue = invocationIndex.get(); try (Stream stream = invocationContexts(provider, extensionContext)) { stream.forEach( invocationContext -> toTestDescriptor(invocationContext, invocationIndex.incrementAndGet()) // .ifPresent(testDescriptor -> execute(dynamicTestExecutor, testDescriptor))); } + Preconditions.condition( + invocationIndex.get() != initialValue || provider.mayReturnZeroInvocationContexts(extensionContext), + "Provider [" + provider.getClass().getSimpleName() // + + "] did not provide invocation contexts, but is expected to do so"); } - validateWasAtLeastInvokedOnce(invocationIndex.get(), providers); return context; } @@ -144,15 +147,4 @@ private void execute(DynamicTestExecutor dynamicTestExecutor, TestDescriptor tes testDescriptor.setParent(this); dynamicTestExecutor.execute(testDescriptor); } - - private void validateWasAtLeastInvokedOnce(int invocationIndex, - List providers) { - - Preconditions.condition(invocationIndex > 0, - () -> "None of the supporting " + TestTemplateInvocationContextProvider.class.getSimpleName() + "s " - + providers.stream().map(provider -> provider.getClass().getSimpleName()).collect( - joining(", ", "[", "]")) - + " provided a non-empty stream"); - } - } diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java index bf45c87fd71b..f605d13a8bbb 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java @@ -291,4 +291,17 @@ @API(status = STABLE, since = "5.10") boolean autoCloseArguments() default true; + /** + * Configure whether a test requires at least one set of arguments. + * Override this value if the absence of arguments is expected in some cases and + * should not cause the test framework errors. + * + *

    Defaults to {@code true}. + * + *

    + * @since 5.12 + */ + @API(status = EXPERIMENTAL, since = "5.12") + boolean requireArguments() default true; + } diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java index aefbba1f2adc..aad7190e6460 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java @@ -77,6 +77,8 @@ public Stream provideTestTemplateInvocationContex ParameterizedTestNameFormatter formatter = createNameFormatter(extensionContext, templateMethod, methodContext, displayName, argumentMaxLength); AtomicLong invocationCount = new AtomicLong(0); + ParameterizedTest parameterizedTest = findAnnotation(templateMethod, ParameterizedTest.class).get(); + boolean ignoreZeroInvocations = !parameterizedTest.requireArguments(); // @formatter:off return findRepeatableAnnotations(templateMethod, ArgumentsSource.class) @@ -90,11 +92,19 @@ public Stream provideTestTemplateInvocationContex return createInvocationContext(formatter, methodContext, arguments, invocationCount.intValue()); }) .onClose(() -> - Preconditions.condition(invocationCount.get() > 0, + Preconditions.condition(invocationCount.get() > 0 || ignoreZeroInvocations, "Configuration error: You must configure at least one set of arguments for this @ParameterizedTest")); // @formatter:on } + @Override + public boolean mayReturnZeroInvocationContexts(ExtensionContext extensionContext) { + Method templateMethod = extensionContext.getRequiredTestMethod(); + return findAnnotation(templateMethod, ParameterizedTest.class) // + .map(parameterizedTest -> !parameterizedTest.requireArguments()) // + .orElse(false); + } + private ExtensionContext.Store getStore(ExtensionContext context) { return context.getStore(Namespace.create(ParameterizedTestExtension.class, context.getRequiredTestMethod())); } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestTemplateInvocationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestTemplateInvocationTests.java index 84ad9e49c65d..6f2754cb09e6 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestTemplateInvocationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestTemplateInvocationTests.java @@ -353,9 +353,38 @@ void templateWithSupportingProviderButNoInvocationsReportsFailure() { wrappedInContainerEvents(MyTestTemplateTestCase.class, // event(container("templateWithSupportingProviderButNoInvocations"), started()), // event(container("templateWithSupportingProviderButNoInvocations"), - finishedWithFailure(message("None of the supporting TestTemplateInvocationContextProviders [" + finishedWithFailure(message("Provider [" + InvocationContextProviderThatSupportsEverythingButProvidesNothing.class.getSimpleName() - + "] provided a non-empty stream"))))); + + "] did not provide invocation contexts, but is expected to do so"))))); + } + + @Test + void templateWithSupportingProviderAllowingNoInvocationsDoesNotFail() { + LauncherDiscoveryRequest request = request().selectors( + selectMethod(MyTestTemplateTestCase.class, "templateWithSupportingProviderAllowingNoInvocations")).build(); + + EngineExecutionResults executionResults = executeTests(request); + + executionResults.allEvents().assertEventsMatchExactly( // + wrappedInContainerEvents(MyTestTemplateTestCase.class, + event(container("templateWithSupportingProviderAllowingNoInvocations"), started()), + event(container("templateWithSupportingProviderAllowingNoInvocations"), finishedSuccessfully()))); + } + + @Test + void templateWithMixedProvidersNoInvocationReportsFailure() { + LauncherDiscoveryRequest request = request().selectors(selectMethod(MyTestTemplateTestCase.class, + "templateWithMultipleProvidersAllowingAndRestrictingToProvideNothing")).build(); + + EngineExecutionResults executionResults = executeTests(request); + + executionResults.allEvents().assertEventsMatchExactly( // + wrappedInContainerEvents(MyTestTemplateTestCase.class, // + event(container("templateWithMultipleProvidersAllowingAndRestrictingToProvideNothing"), started()), // + event(container("templateWithMultipleProvidersAllowingAndRestrictingToProvideNothing"), + finishedWithFailure(message("Provider [" + + InvocationContextProviderThatSupportsEverythingButProvidesNothing.class.getSimpleName() + + "] did not provide invocation contexts, but is expected to do so"))))); } @Test @@ -470,6 +499,19 @@ void templateWithSupportingProviderButNoInvocations() { fail("never called"); } + @ExtendWith(InvocationContextProviderThatSupportsEverythingAllowsProvideNothing.class) + @TestTemplate + void templateWithSupportingProviderAllowingNoInvocations() { + fail("never called"); + } + + @ExtendWith(InvocationContextProviderThatSupportsEverythingButProvidesNothing.class) + @ExtendWith(InvocationContextProviderThatSupportsEverythingAllowsProvideNothing.class) + @TestTemplate + void templateWithMultipleProvidersAllowingAndRestrictingToProvideNothing() { + fail("never called"); + } + @ExtendWith(InvocationContextProviderWithCloseableStream.class) @TestTemplate void templateWithCloseableStream() { @@ -769,6 +811,25 @@ public Stream provideTestTemplateInvocationContex } } + private static class InvocationContextProviderThatSupportsEverythingAllowsProvideNothing + implements TestTemplateInvocationContextProvider { + + @Override + public boolean supportsTestTemplate(ExtensionContext context) { + return true; + } + + @Override + public Stream provideTestTemplateInvocationContexts(ExtensionContext context) { + return Stream.empty(); + } + + @Override + public boolean mayReturnZeroInvocationContexts(ExtensionContext extensionContext) { + return true; + } + } + private static class InvocationContextProviderWithCloseableStream implements TestTemplateInvocationContextProvider { private static AtomicBoolean streamClosed = new AtomicBoolean(false); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java index 01dbe93e407c..7c3fcdf2cb8a 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java @@ -142,6 +142,18 @@ void throwsExceptionWhenParameterizedTestIsNotInvokedAtLeastOnce() { "Configuration error: You must configure at least one set of arguments for this @ParameterizedTest"); } + @Test + void doesNotThrowExceptionWhenParametrizedTestDoesNotRequireArguments() { + var extensionContextWithAnnotatedTestMethod = getExtensionContextReturningSingleMethod( + new TestCaseAllowNoArgumentsMethod()); + + var stream = this.parameterizedTestExtension.provideTestTemplateInvocationContexts( + extensionContextWithAnnotatedTestMethod); + // cause the stream to be evaluated + stream.toArray(); + stream.close(); + } + @Test void throwsExceptionWhenArgumentsProviderIsNotStatic() { var extensionContextWithAnnotatedTestMethod = getExtensionContextReturningSingleMethod( @@ -310,6 +322,13 @@ void method() { } } + static class TestCaseAllowNoArgumentsMethod { + + @ParameterizedTest(requireArguments = false) + void method() { + } + } + static class ArgumentsProviderWithCloseHandlerTestCase { @ParameterizedTest diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java index c95e28b2dd63..c80708edfae5 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java @@ -31,6 +31,7 @@ import static org.junit.platform.testkit.engine.EventConditions.abortedWithReason; import static org.junit.platform.testkit.engine.EventConditions.container; import static org.junit.platform.testkit.engine.EventConditions.displayName; +import static org.junit.platform.testkit.engine.EventConditions.engine; import static org.junit.platform.testkit.engine.EventConditions.event; import static org.junit.platform.testkit.engine.EventConditions.finishedSuccessfully; import static org.junit.platform.testkit.engine.EventConditions.finishedWithFailure; @@ -447,6 +448,24 @@ void displayNamePatternFromConfiguration() { .haveExactly(1, event(displayName("2"), started())); } + @Test + void failsWhenArgumentsRequiredButNoneProvided() { + var result = execute(ZeroArgumentsTestCase.class, "testThatRequiresArguments", String.class); + result.containerEvents().assertThatEvents().haveExactly(1, event(finishedWithFailure(message( + "Configuration error: You must configure at least one set of arguments for this @ParameterizedTest")))); + } + + @Test + void failsWhenArgumentsAreNotRequiredAndNoneProvided() { + var result = execute(ZeroArgumentsTestCase.class, "testThatDoesNotRequireArguments", String.class); + result.allEvents().assertEventsMatchExactly( // + event(engine(), started()), event(container(ZeroArgumentsTestCase.class), started()), + event(container("testThatDoesNotRequireArguments"), started()), + event(container("testThatDoesNotRequireArguments"), finishedSuccessfully()), + event(container(ZeroArgumentsTestCase.class), finishedSuccessfully()), + event(engine(), finishedSuccessfully())); + } + private EngineExecutionResults execute(DiscoverySelector... selectors) { return EngineTestKit.engine(new JupiterTestEngine()).selectors(selectors).execute(); } @@ -2309,6 +2328,25 @@ public Object aggregateArguments(ArgumentsAccessor accessor, ParameterContext co } } + static class ZeroArgumentsTestCase { + + @ParameterizedTest + @MethodSource("zeroArgumentsProvider") + void testThatRequiresArguments(String argument) { + fail("This test should not be executed, because no arguments are provided."); + } + + @ParameterizedTest(requireArguments = false) + @MethodSource("zeroArgumentsProvider") + void testThatDoesNotRequireArguments(String argument) { + fail("This test should not be executed, because no arguments are provided."); + } + + public static Stream zeroArgumentsProvider() { + return Stream.empty(); + } + } + private static class TwoSingleStringArgumentsProvider implements ArgumentsProvider { @Override From 75526ec4a3e703f6de7fa210a4698b16cb62a736 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 15 Oct 2024 10:11:56 +0200 Subject: [PATCH 178/611] Polish Javadoc --- .../TestTemplateInvocationContextProvider.java | 12 ++++++++---- .../org/junit/jupiter/params/ParameterizedTest.java | 9 +++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java index 5fae0f7463a9..cd56bc8f312a 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java @@ -88,15 +88,19 @@ public interface TestTemplateInvocationContextProvider extends Extension { Stream provideTestTemplateInvocationContexts(ExtensionContext context); /** - * Signals that in the supplied {@linkplain ExtensionContext context} the provider may return zero + * Signal that in the supplied {@linkplain ExtensionContext context} the + * provider may return zero * {@linkplain TestTemplateInvocationContext invocation contexts}. * - *

    If provider returns empty stream from {@link #provideTestTemplateInvocationContexts(ExtensionContext)} - * this will be considered an execution error. Override this method to ignore the absence of invocation contexts. + *

    If this method returns {@code false} and the provider returns an empty + * stream from {@link #provideTestTemplateInvocationContexts}, this will be + * considered an execution error. Override this method to ignore the absence + * of invocation contexts for this provider. * * @param context the extension context for the test template method about * to be invoked; never {@code null} - * @return {@code true} to allow zero contexts, {@code false} (default) to fail execution in case of zero contexts. + * @return {@code true} to allow zero contexts, {@code false} (default) to + * fail execution in case of zero contexts. * * @since 5.12 */ diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java index f605d13a8bbb..67296b5a4158 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java @@ -292,13 +292,14 @@ boolean autoCloseArguments() default true; /** - * Configure whether a test requires at least one set of arguments. - * Override this value if the absence of arguments is expected in some cases and - * should not cause the test framework errors. + * Configure whether at least one set of arguments is required for this + * parameterized test. + * + *

    Set this attribute to {@code false} if the absence of arguments is + * expected in some cases and should not cause a test failure. * *

    Defaults to {@code true}. * - *

    * @since 5.12 */ @API(status = EXPERIMENTAL, since = "5.12") From 89a46dfa10c6447ef010fbff7903bfcb3c18975a Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 15 Oct 2024 10:12:24 +0200 Subject: [PATCH 179/611] Polish implementation and messaging of TestTemplateTestDescriptor --- ...TestTemplateInvocationContextProvider.java | 2 +- .../TestTemplateTestDescriptor.java | 30 ++++++++++++------- .../params/ParameterizedTestExtension.java | 2 +- .../engine/TestTemplateInvocationTests.java | 16 +++++----- 4 files changed, 31 insertions(+), 19 deletions(-) diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java index cd56bc8f312a..0419bfe5ff27 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java @@ -105,7 +105,7 @@ public interface TestTemplateInvocationContextProvider extends Extension { * @since 5.12 */ @API(status = EXPERIMENTAL, since = "5.12") - default boolean mayReturnZeroInvocationContexts(ExtensionContext context) { + default boolean mayReturnZeroTestTemplateInvocationContexts(ExtensionContext context) { return false; } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java index 7952e2b3eefe..fee7c3906d15 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java @@ -101,20 +101,30 @@ public JupiterEngineExecutionContext execute(JupiterEngineExecutionContext conte context.getExtensionRegistry()); AtomicInteger invocationIndex = new AtomicInteger(); for (TestTemplateInvocationContextProvider provider : providers) { - int initialValue = invocationIndex.get(); - try (Stream stream = invocationContexts(provider, extensionContext)) { - stream.forEach( - invocationContext -> toTestDescriptor(invocationContext, invocationIndex.incrementAndGet()) // - .ifPresent(testDescriptor -> execute(dynamicTestExecutor, testDescriptor))); - } - Preconditions.condition( - invocationIndex.get() != initialValue || provider.mayReturnZeroInvocationContexts(extensionContext), - "Provider [" + provider.getClass().getSimpleName() // - + "] did not provide invocation contexts, but is expected to do so"); + executeForProvider(provider, invocationIndex, dynamicTestExecutor, extensionContext); } return context; } + private void executeForProvider(TestTemplateInvocationContextProvider provider, AtomicInteger invocationIndex, + DynamicTestExecutor dynamicTestExecutor, ExtensionContext extensionContext) { + + int initialValue = invocationIndex.get(); + + try (Stream stream = invocationContexts(provider, extensionContext)) { + stream.forEach(invocationContext -> toTestDescriptor(invocationContext, invocationIndex.incrementAndGet()) // + .ifPresent(testDescriptor -> execute(dynamicTestExecutor, testDescriptor))); + } + + Preconditions.condition( + invocationIndex.get() != initialValue + || provider.mayReturnZeroTestTemplateInvocationContexts(extensionContext), + String.format( + "Provider [%s] did not provide any invocation contexts, but was expected to do so. " + + "You may override mayReturnZeroTestTemplateInvocationContexts() to allow this.", + provider.getClass().getSimpleName())); + } + private static Stream invocationContexts( TestTemplateInvocationContextProvider provider, ExtensionContext extensionContext) { return provider.provideTestTemplateInvocationContexts(extensionContext); diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java index aad7190e6460..669dfb9af347 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java @@ -98,7 +98,7 @@ public Stream provideTestTemplateInvocationContex } @Override - public boolean mayReturnZeroInvocationContexts(ExtensionContext extensionContext) { + public boolean mayReturnZeroTestTemplateInvocationContexts(ExtensionContext extensionContext) { Method templateMethod = extensionContext.getRequiredTestMethod(); return findAnnotation(templateMethod, ParameterizedTest.class) // .map(parameterizedTest -> !parameterizedTest.requireArguments()) // diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestTemplateInvocationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestTemplateInvocationTests.java index 6f2754cb09e6..921ec12060b1 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestTemplateInvocationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestTemplateInvocationTests.java @@ -353,9 +353,10 @@ void templateWithSupportingProviderButNoInvocationsReportsFailure() { wrappedInContainerEvents(MyTestTemplateTestCase.class, // event(container("templateWithSupportingProviderButNoInvocations"), started()), // event(container("templateWithSupportingProviderButNoInvocations"), - finishedWithFailure(message("Provider [" - + InvocationContextProviderThatSupportsEverythingButProvidesNothing.class.getSimpleName() - + "] did not provide invocation contexts, but is expected to do so"))))); + finishedWithFailure(message( + "Provider [%s] did not provide any invocation contexts, but was expected to do so. ".formatted( + InvocationContextProviderThatSupportsEverythingButProvidesNothing.class.getSimpleName()) + + "You may override mayReturnZeroTestTemplateInvocationContexts() to allow this."))))); } @Test @@ -382,9 +383,10 @@ void templateWithMixedProvidersNoInvocationReportsFailure() { wrappedInContainerEvents(MyTestTemplateTestCase.class, // event(container("templateWithMultipleProvidersAllowingAndRestrictingToProvideNothing"), started()), // event(container("templateWithMultipleProvidersAllowingAndRestrictingToProvideNothing"), - finishedWithFailure(message("Provider [" - + InvocationContextProviderThatSupportsEverythingButProvidesNothing.class.getSimpleName() - + "] did not provide invocation contexts, but is expected to do so"))))); + finishedWithFailure(message( + "Provider [%s] did not provide any invocation contexts, but was expected to do so. ".formatted( + InvocationContextProviderThatSupportsEverythingButProvidesNothing.class.getSimpleName()) + + "You may override mayReturnZeroTestTemplateInvocationContexts() to allow this."))))); } @Test @@ -825,7 +827,7 @@ public Stream provideTestTemplateInvocationContex } @Override - public boolean mayReturnZeroInvocationContexts(ExtensionContext extensionContext) { + public boolean mayReturnZeroTestTemplateInvocationContexts(ExtensionContext extensionContext) { return true; } } From 12bccfd63ba2cf8d9f593f90c1343835dd56add3 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 15 Oct 2024 10:12:38 +0200 Subject: [PATCH 180/611] Avoid repeated annotation lookups in ParameterizedTestExtension --- ...ameterizedTestNameFormatterBenchmarks.java | 6 +- .../params/ParameterizedTestExtension.java | 66 ++++++++++--------- .../ParameterizedTestMethodContext.java | 19 ++++-- .../ParameterizedTestParameterResolver.java | 3 +- .../ParameterizedTestExtensionTests.java | 17 ++--- .../ParameterizedTestMethodContextTests.java | 66 ++++++++++--------- .../ParameterizedTestNameFormatterTests.java | 8 ++- 7 files changed, 103 insertions(+), 82 deletions(-) diff --git a/junit-jupiter-params/src/jmh/java/org/junit/jupiter/params/ParameterizedTestNameFormatterBenchmarks.java b/junit-jupiter-params/src/jmh/java/org/junit/jupiter/params/ParameterizedTestNameFormatterBenchmarks.java index e3e7df3c58c2..8c6605490ab8 100644 --- a/junit-jupiter-params/src/jmh/java/org/junit/jupiter/params/ParameterizedTestNameFormatterBenchmarks.java +++ b/junit-jupiter-params/src/jmh/java/org/junit/jupiter/params/ParameterizedTestNameFormatterBenchmarks.java @@ -44,10 +44,10 @@ public void setUp() { @Benchmark public void formatTestNames(Blackhole blackhole) throws Exception { + var method = TestCase.class.getDeclaredMethod("parameterizedTest", int.class); var formatter = new ParameterizedTestNameFormatter( ParameterizedTest.DISPLAY_NAME_PLACEHOLDER + " " + ParameterizedTest.DEFAULT_DISPLAY_NAME + " ({0})", - "displayName", - new ParameterizedTestMethodContext(TestCase.class.getDeclaredMethod("parameterizedTest", int.class), null), + "displayName", new ParameterizedTestMethodContext(method, method.getAnnotation(ParameterizedTest.class)), 512); for (int i = 0; i < argumentsList.size(); i++) { Arguments arguments = argumentsList.get(i); @@ -55,8 +55,10 @@ public void formatTestNames(Blackhole blackhole) throws Exception { } } + @SuppressWarnings("JUnitMalformedDeclaration") static class TestCase { @SuppressWarnings("unused") + @ParameterizedTest void parameterizedTest(int param) { } } diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java index 669dfb9af347..74ff653e15cc 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java @@ -12,9 +12,9 @@ import static org.junit.platform.commons.support.AnnotationSupport.findAnnotation; import static org.junit.platform.commons.support.AnnotationSupport.findRepeatableAnnotations; -import static org.junit.platform.commons.support.AnnotationSupport.isAnnotated; import java.lang.reflect.Method; +import java.util.Optional; import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Stream; @@ -34,7 +34,7 @@ */ class ParameterizedTestExtension implements TestTemplateInvocationContextProvider { - private static final String METHOD_CONTEXT_KEY = "context"; + static final String METHOD_CONTEXT_KEY = "context"; static final String ARGUMENT_MAX_LENGTH_KEY = "junit.jupiter.params.displayname.argument.maxlength"; static final String DEFAULT_DISPLAY_NAME = "{default_display_name}"; static final String DISPLAY_NAME_PATTERN_KEY = "junit.jupiter.params.displayname.default"; @@ -45,19 +45,21 @@ public boolean supportsTestTemplate(ExtensionContext context) { return false; } - Method testMethod = context.getTestMethod().get(); - if (!isAnnotated(testMethod, ParameterizedTest.class)) { + Method templateMethod = context.getTestMethod().get(); + Optional annotation = findAnnotation(templateMethod, ParameterizedTest.class); + if (!annotation.isPresent()) { return false; } - ParameterizedTestMethodContext methodContext = new ParameterizedTestMethodContext(testMethod, context); + ParameterizedTestMethodContext methodContext = new ParameterizedTestMethodContext(templateMethod, + annotation.get()); Preconditions.condition(methodContext.hasPotentiallyValidSignature(), () -> String.format( "@ParameterizedTest method [%s] declares formal parameters in an invalid order: " + "argument aggregators must be declared after any indexed arguments " + "and before any arguments resolved by another ParameterResolver.", - testMethod.toGenericString())); + templateMethod.toGenericString())); getStore(context).put(METHOD_CONTEXT_KEY, methodContext); @@ -68,41 +70,36 @@ public boolean supportsTestTemplate(ExtensionContext context) { public Stream provideTestTemplateInvocationContexts( ExtensionContext extensionContext) { - Method templateMethod = extensionContext.getRequiredTestMethod(); - String displayName = extensionContext.getDisplayName(); - ParameterizedTestMethodContext methodContext = getStore(extensionContext)// - .get(METHOD_CONTEXT_KEY, ParameterizedTestMethodContext.class); - int argumentMaxLength = extensionContext.getConfigurationParameter(ARGUMENT_MAX_LENGTH_KEY, - Integer::parseInt).orElse(512); - ParameterizedTestNameFormatter formatter = createNameFormatter(extensionContext, templateMethod, methodContext, - displayName, argumentMaxLength); + ParameterizedTestMethodContext methodContext = getMethodContext(extensionContext); + ParameterizedTestNameFormatter formatter = createNameFormatter(extensionContext, methodContext); AtomicLong invocationCount = new AtomicLong(0); - ParameterizedTest parameterizedTest = findAnnotation(templateMethod, ParameterizedTest.class).get(); - boolean ignoreZeroInvocations = !parameterizedTest.requireArguments(); // @formatter:off - return findRepeatableAnnotations(templateMethod, ArgumentsSource.class) + return findRepeatableAnnotations(methodContext.method, ArgumentsSource.class) .stream() .map(ArgumentsSource::value) .map(clazz -> ParameterizedTestSpiInstantiator.instantiate(ArgumentsProvider.class, clazz, extensionContext)) - .map(provider -> AnnotationConsumerInitializer.initialize(templateMethod, provider)) + .map(provider -> AnnotationConsumerInitializer.initialize(methodContext.method, provider)) .flatMap(provider -> arguments(provider, extensionContext)) .map(arguments -> { invocationCount.incrementAndGet(); return createInvocationContext(formatter, methodContext, arguments, invocationCount.intValue()); }) .onClose(() -> - Preconditions.condition(invocationCount.get() > 0 || ignoreZeroInvocations, + Preconditions.condition(invocationCount.get() > 0 || !methodContext.annotation.requireArguments(), "Configuration error: You must configure at least one set of arguments for this @ParameterizedTest")); // @formatter:on } @Override public boolean mayReturnZeroTestTemplateInvocationContexts(ExtensionContext extensionContext) { - Method templateMethod = extensionContext.getRequiredTestMethod(); - return findAnnotation(templateMethod, ParameterizedTest.class) // - .map(parameterizedTest -> !parameterizedTest.requireArguments()) // - .orElse(false); + ParameterizedTestMethodContext methodContext = getMethodContext(extensionContext); + return !methodContext.annotation.requireArguments(); + } + + private ParameterizedTestMethodContext getMethodContext(ExtensionContext extensionContext) { + return getStore(extensionContext)// + .get(METHOD_CONTEXT_KEY, ParameterizedTestMethodContext.class); } private ExtensionContext.Store getStore(ExtensionContext context) { @@ -115,19 +112,24 @@ private TestTemplateInvocationContext createInvocationContext(ParameterizedTestN return new ParameterizedTestInvocationContext(formatter, methodContext, arguments, invocationIndex); } - private ParameterizedTestNameFormatter createNameFormatter(ExtensionContext extensionContext, Method templateMethod, - ParameterizedTestMethodContext methodContext, String displayName, int argumentMaxLength) { + private ParameterizedTestNameFormatter createNameFormatter(ExtensionContext extensionContext, + ParameterizedTestMethodContext methodContext) { - ParameterizedTest parameterizedTest = findAnnotation(templateMethod, ParameterizedTest.class).get(); - String pattern = parameterizedTest.name().equals(DEFAULT_DISPLAY_NAME) - ? extensionContext.getConfigurationParameter(DISPLAY_NAME_PATTERN_KEY).orElse( - ParameterizedTest.DEFAULT_DISPLAY_NAME) - : parameterizedTest.name(); + String name = methodContext.annotation.name(); + String pattern = name.equals(DEFAULT_DISPLAY_NAME) + ? extensionContext.getConfigurationParameter(DISPLAY_NAME_PATTERN_KEY) // + .orElse(ParameterizedTest.DEFAULT_DISPLAY_NAME) + : name; pattern = Preconditions.notBlank(pattern.trim(), () -> String.format( "Configuration error: @ParameterizedTest on method [%s] must be declared with a non-empty name.", - templateMethod)); - return new ParameterizedTestNameFormatter(pattern, displayName, methodContext, argumentMaxLength); + methodContext.method)); + + int argumentMaxLength = extensionContext.getConfigurationParameter(ARGUMENT_MAX_LENGTH_KEY, Integer::parseInt) // + .orElse(512); + + return new ParameterizedTestNameFormatter(pattern, extensionContext.getDisplayName(), methodContext, + argumentMaxLength); } protected static Stream arguments(ArgumentsProvider provider, ExtensionContext context) { diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java index a7469d4f4003..4c07e01f81ca 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java @@ -32,6 +32,7 @@ import org.junit.jupiter.params.converter.DefaultArgumentConverter; import org.junit.jupiter.params.support.AnnotationConsumerInitializer; import org.junit.platform.commons.support.AnnotationSupport; +import org.junit.platform.commons.util.Preconditions; import org.junit.platform.commons.util.StringUtils; /** @@ -42,19 +43,22 @@ */ class ParameterizedTestMethodContext { + final Method method; + final ParameterizedTest annotation; + private final Parameter[] parameters; - private final ExtensionContext extensionContext; private final Resolver[] resolvers; private final List resolverTypes; - ParameterizedTestMethodContext(Method testMethod, ExtensionContext extensionContext) { - this.parameters = testMethod.getParameters(); + ParameterizedTestMethodContext(Method method, ParameterizedTest annotation) { + this.method = Preconditions.notNull(method, "method must not be null"); + this.annotation = Preconditions.notNull(annotation, "annotation must not be null"); + this.parameters = method.getParameters(); this.resolvers = new Resolver[this.parameters.length]; this.resolverTypes = new ArrayList<>(this.parameters.length); for (Parameter parameter : this.parameters) { this.resolverTypes.add(isAggregator(parameter) ? AGGREGATOR : CONVERTER); } - this.extensionContext = extensionContext; } /** @@ -162,11 +166,12 @@ int indexOfFirstAggregator() { * Resolve the parameter for the supplied context using the supplied * arguments. */ - Object resolve(ParameterContext parameterContext, Object[] arguments, int invocationIndex) { - return getResolver(parameterContext).resolve(parameterContext, arguments, invocationIndex); + Object resolve(ParameterContext parameterContext, ExtensionContext extensionContext, Object[] arguments, + int invocationIndex) { + return getResolver(parameterContext, extensionContext).resolve(parameterContext, arguments, invocationIndex); } - private Resolver getResolver(ParameterContext parameterContext) { + private Resolver getResolver(ParameterContext parameterContext, ExtensionContext extensionContext) { int index = parameterContext.getIndex(); if (resolvers[index] == null) { resolvers[index] = resolverTypes.get(index).createResolver(parameterContext, extensionContext); diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestParameterResolver.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestParameterResolver.java index 10e0085c1a73..a0216cf548a7 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestParameterResolver.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestParameterResolver.java @@ -78,7 +78,8 @@ public boolean supportsParameter(ParameterContext parameterContext, ExtensionCon @Override public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { - return this.methodContext.resolve(parameterContext, extractPayloads(this.arguments), this.invocationIndex); + return this.methodContext.resolve(parameterContext, extensionContext, extractPayloads(this.arguments), + this.invocationIndex); } /** diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java index 7c3fcdf2cb8a..f8d6dee01831 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java @@ -15,13 +15,13 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.params.ParameterizedTestExtension.METHOD_CONTEXT_KEY; import static org.junit.jupiter.params.ParameterizedTestExtension.arguments; import java.io.FileNotFoundException; import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Constructor; import java.lang.reflect.Method; -import java.util.Arrays; import java.util.Map; import java.util.Optional; import java.util.Set; @@ -194,11 +194,8 @@ private ExtensionContext getExtensionContextReturningSingleMethod(Object testCas private ExtensionContext getExtensionContextReturningSingleMethod(Object testCase, Function> configurationSupplier) { - // @formatter:off - var optional = Arrays.stream(testCase.getClass().getDeclaredMethods()) - .filter(method -> method.getName().equals("method")) - .findFirst(); - // @formatter:on + var method = ReflectionUtils.findMethods(testCase.getClass(), + it -> "method".equals(it.getName())).stream().findFirst(); return new ExtensionContext() { @@ -206,7 +203,7 @@ private ExtensionContext getExtensionContextReturningSingleMethod(Object testCas @Override public Optional getTestMethod() { - return optional; + return method; } @Override @@ -280,7 +277,11 @@ public void publishReportEntry(Map map) { @Override public Store getStore(Namespace namespace) { - return new NamespaceAwareStore(store, namespace); + var store = new NamespaceAwareStore(this.store, namespace); + method // + .map(it -> new ParameterizedTestMethodContext(it, it.getAnnotation(ParameterizedTest.class))) // + .ifPresent(ctx -> store.put(METHOD_CONTEXT_KEY, ctx)); + return store; } @Override diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestMethodContextTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestMethodContextTests.java index fd9e1d702c64..e2ce097ca4c5 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestMethodContextTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestMethodContextTests.java @@ -12,16 +12,13 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.mockito.Mockito.mock; - -import java.lang.reflect.Method; -import java.util.Arrays; import org.junit.jupiter.api.TestInfo; import org.junit.jupiter.params.aggregator.AggregatorIntegrationTests.CsvToPerson; import org.junit.jupiter.params.aggregator.AggregatorIntegrationTests.Person; import org.junit.jupiter.params.aggregator.ArgumentsAccessor; import org.junit.jupiter.params.provider.ValueSource; +import org.junit.platform.commons.util.ReflectionUtils; /** * Unit tests for {@link ParameterizedTestMethodContext}. @@ -33,49 +30,58 @@ class ParameterizedTestMethodContextTests { @ParameterizedTest @ValueSource(strings = { "onePrimitive", "twoPrimitives", "twoAggregators", "twoAggregatorsWithTestInfoAtTheEnd", "mixedMode" }) - void validSignatures(String name) { - assertTrue(new ParameterizedTestMethodContext(method(name), mock()).hasPotentiallyValidSignature()); + void validSignatures(String methodName) { + assertTrue(createMethodContext(ValidTestCase.class, methodName).hasPotentiallyValidSignature()); } @ParameterizedTest @ValueSource(strings = { "twoAggregatorsWithPrimitiveInTheMiddle", "twoAggregatorsWithTestInfoInTheMiddle" }) - void invalidSignatures(String name) { - assertFalse(new ParameterizedTestMethodContext(method(name), mock()).hasPotentiallyValidSignature()); + void invalidSignatures(String methodName) { + assertFalse(createMethodContext(InvalidTestCase.class, methodName).hasPotentiallyValidSignature()); } - private Method method(String name) { - return Arrays.stream(getClass().getDeclaredMethods()) // - .filter(m -> m.getName().equals(name)) // - .findFirst() // - .orElseThrow(); + private ParameterizedTestMethodContext createMethodContext(Class testClass, String methodName) { + var method = ReflectionUtils.findMethods(testClass, m -> m.getName().equals(methodName)).getFirst(); + return new ParameterizedTestMethodContext(method, method.getAnnotation(ParameterizedTest.class)); } - // --- VALID --------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") + static class ValidTestCase { - void onePrimitive(int num) { - } + @ParameterizedTest + void onePrimitive(int num) { + } - void twoPrimitives(int num1, int num2) { - } + @ParameterizedTest + void twoPrimitives(int num1, int num2) { + } - void twoAggregators(@CsvToPerson Person person, ArgumentsAccessor arguments) { - } + @ParameterizedTest + void twoAggregators(@CsvToPerson Person person, ArgumentsAccessor arguments) { + } - void twoAggregatorsWithTestInfoAtTheEnd(@CsvToPerson Person person1, @CsvToPerson Person person2, - TestInfo testInfo) { - } + @ParameterizedTest + void twoAggregatorsWithTestInfoAtTheEnd(@CsvToPerson Person person1, @CsvToPerson Person person2, + TestInfo testInfo) { + } - void mixedMode(int num1, int num2, ArgumentsAccessor arguments1, ArgumentsAccessor arguments2, - @CsvToPerson Person person1, @CsvToPerson Person person2, TestInfo testInfo1, TestInfo testInfo2) { + @ParameterizedTest + void mixedMode(int num1, int num2, ArgumentsAccessor arguments1, ArgumentsAccessor arguments2, + @CsvToPerson Person person1, @CsvToPerson Person person2, TestInfo testInfo1, TestInfo testInfo2) { + } } - // --- INVALID ------------------------------------------------------------- + @SuppressWarnings("JUnitMalformedDeclaration") + static class InvalidTestCase { - void twoAggregatorsWithPrimitiveInTheMiddle(@CsvToPerson Person person1, int num, @CsvToPerson Person person2) { - } + @ParameterizedTest + void twoAggregatorsWithPrimitiveInTheMiddle(@CsvToPerson Person person1, int num, @CsvToPerson Person person2) { + } - void twoAggregatorsWithTestInfoInTheMiddle(@CsvToPerson Person person1, TestInfo testInfo, - @CsvToPerson Person person2) { + @ParameterizedTest + void twoAggregatorsWithTestInfoInTheMiddle(@CsvToPerson Person person1, TestInfo testInfo, + @CsvToPerson Person person2) { + } } } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestNameFormatterTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestNameFormatterTests.java index 9bd77fb62b74..c95332c171bb 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestNameFormatterTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestNameFormatterTests.java @@ -52,6 +52,7 @@ /** * @since 5.0 */ +@SuppressWarnings("ALL") class ParameterizedTestNameFormatterTests { private final Locale originalLocale = Locale.getDefault(); @@ -330,8 +331,8 @@ private static ParameterizedTestNameFormatter formatter(String pattern, String d } private static ParameterizedTestNameFormatter formatter(String pattern, String displayName, Method method) { - return new ParameterizedTestNameFormatter(pattern, displayName, - new ParameterizedTestMethodContext(method, mock()), 512); + var context = new ParameterizedTestMethodContext(method, method.getAnnotation(ParameterizedTest.class)); + return new ParameterizedTestNameFormatter(pattern, displayName, context, 512); } private static String format(ParameterizedTestNameFormatter formatter, int invocationIndex, Arguments arguments) { @@ -361,15 +362,18 @@ static Method getMethod(String methodName, Class... parameterTypes) { } @SuppressWarnings("unused") + @ParameterizedTest void parameterizedTest(int someNumber, String someString, Object[] someArray) { } @SuppressWarnings("unused") + @ParameterizedTest void parameterizedTestWithAggregator(int someNumber, @AggregateWith(CustomAggregator.class) String someAggregatedString) { } @SuppressWarnings("unused") + @ParameterizedTest void processFruits(String fruit1, String fruit2) { } From cbbe6824e0c00dd100445e3fd5b1cd588b04f5db Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 15 Oct 2024 10:55:00 +0200 Subject: [PATCH 181/611] Fix ExtensionComposabilityTests --- .../junit/jupiter/api/extension/KitchenSinkExtension.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java index 762c0414c3e3..03106324eec7 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java @@ -168,6 +168,11 @@ public Stream provideTestTemplateInvocationContex return null; } + @Override + public boolean mayReturnZeroTestTemplateInvocationContexts(ExtensionContext context) { + return false; + } + // --- TestWatcher --------------------------------------------------------- @Override From ddcf99be6940fb00dded601bb206281a70782d7e Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 15 Oct 2024 11:01:41 +0200 Subject: [PATCH 182/611] Add to release notes --- .../docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 0d0100dcf0df..0e6785e9f512 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -66,6 +66,11 @@ JUnit repository on GitHub. `@ConvertWith`), and `ArgumentsAggregator` (declared via `@AggregateWith`) implementations can now use constructor injection from registered `ParameterResolver` extensions. +* Extensions based on `TestTemplateInvocationContextProvider` can now allow returning zero + invocation contexts by overriding the new `mayReturnZeroTestTemplateInvocationContexts` + method. +* The new `@ParameterizedTest(requireArguments = false)` attribute allows to specify that + the absence of arguments is expected in some cases and should not cause a test failure. * Allow determining "shared resources" at runtime via the new `@ResourceLock#providers` attribute that accepts implementations of `ResourceLocksProvider`. * Extensions that implement `TestInstancePreConstructCallback`, `TestInstanceFactory`, From 4717594b80235ee81be329959083d0e11e640d1a Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 15 Oct 2024 11:58:28 +0200 Subject: [PATCH 183/611] Further polish Javadoc of TestTemplateInvocationContextProvider --- ...TestTemplateInvocationContextProvider.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java index 0419bfe5ff27..191b98465084 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java @@ -28,7 +28,7 @@ * preparing the test class instance differently, or multiple times without * modifying the context. * - *

    This interface defines two methods: {@link #supportsTestTemplate} and + *

    This interface defines two main methods: {@link #supportsTestTemplate} and * {@link #provideTestTemplateInvocationContexts}. The former is called by the * framework to determine whether this extension wants to act on a test template * that is about to be executed. If so, the latter is called and must return a @@ -42,6 +42,10 @@ * the test template method will be invoked using the contexts of all active * providers. * + *

    An active provider may return zero invocation contexts from its + * {@link #provideTestTemplateInvocationContexts} method if it overrides + * {@link #mayReturnZeroTestTemplateInvocationContexts} to return {@code true}. + * *

    Constructor Requirements

    * *

    Consult the documentation in {@link Extension} for details on @@ -88,19 +92,20 @@ public interface TestTemplateInvocationContextProvider extends Extension { Stream provideTestTemplateInvocationContexts(ExtensionContext context); /** - * Signal that in the supplied {@linkplain ExtensionContext context} the - * provider may return zero - * {@linkplain TestTemplateInvocationContext invocation contexts}. + * Signal that this provider may provide zero + * {@linkplain TestTemplateInvocationContext invocation contexts} in the + * supplied {@code context}. * - *

    If this method returns {@code false} and the provider returns an empty - * stream from {@link #provideTestTemplateInvocationContexts}, this will be - * considered an execution error. Override this method to ignore the absence - * of invocation contexts for this provider. + *

    If this method returns {@code false} (which is the default) and the + * provider returns an empty stream from + * {@link #provideTestTemplateInvocationContexts}, this will be considered + * an execution error. Override this method to ignore the absence of + * invocation contexts for this provider. * * @param context the extension context for the test template method about * to be invoked; never {@code null} - * @return {@code true} to allow zero contexts, {@code false} (default) to - * fail execution in case of zero contexts. + * @return {@code true} to allow zero contexts, {@code false} to fail + * execution in case of zero contexts. * * @since 5.12 */ From 72d643c66db90b6e85a0de0c4cacdf0c24b21f35 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 15 Oct 2024 13:31:31 +0000 Subject: [PATCH 184/611] Update graalvm/setup-graalvm digest to 6f32709 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3dee8c1cf8e2..5c4cfa1e15f5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,7 +21,7 @@ jobs: with: fetch-depth: 1 - name: Install GraalVM - uses: graalvm/setup-graalvm@22cc13fe88ef133134b3798e128fb208df55e1f5 # v1 + uses: graalvm/setup-graalvm@6f327093bb6a42fe5eac053d21b168c46aa46f22 # v1 with: distribution: graalvm-community version: 'latest' From eda257e87ed4d76fb698b9c58fbfa4bdfc489eb0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:45:17 +0000 Subject: [PATCH 185/611] Update dependency org.mockito:mockito-junit-jupiter to v5.14.2 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4ddf318717fb..244f60af32e2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -53,7 +53,7 @@ log4j-jul = { module = "org.apache.logging.log4j:log4j-jul", version.ref = "log4 maven = { module = "org.apache.maven:apache-maven", version = "3.9.9" } mavenSurefirePlugin = { module = "org.apache.maven.plugins:maven-surefire-plugin", version.ref = "surefire" } memoryfilesystem = { module = "com.github.marschall:memoryfilesystem", version = "2.8.1" } -mockito = { module = "org.mockito:mockito-junit-jupiter", version = "5.14.1" } +mockito = { module = "org.mockito:mockito-junit-jupiter", version = "5.14.2" } nohttp-checkstyle = { module = "io.spring.nohttp:nohttp-checkstyle", version = "0.0.11" } opentest4j = { module = "org.opentest4j:opentest4j", version.ref = "opentest4j" } openTestReporting-events = { module = "org.opentest4j.reporting:open-test-reporting-events", version.ref = "openTestReporting" } From 4ca21c33e85a5c27007c6880ec27cefb5d07450e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 15 Oct 2024 20:48:08 +0000 Subject: [PATCH 186/611] Update plugin spotless to v7.0.0.BETA3 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 244f60af32e2..4b606686be39 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -92,5 +92,5 @@ jmh = { id = "me.champeau.jmh", version = "0.7.2" } nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" } plantuml = { id = "io.freefair.plantuml", version = "8.10.2" } shadow = { id = "com.gradleup.shadow", version = "8.3.3" } -spotless = { id = "com.diffplug.spotless", version = "7.0.0.BETA2" } +spotless = { id = "com.diffplug.spotless", version = "7.0.0.BETA3" } versions = { id = "com.github.ben-manes.versions", version = "0.51.0" } From 1da62c7a782e37e206f1a085cede8638c71314b2 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 16 Oct 2024 09:07:38 +0200 Subject: [PATCH 187/611] Make config parameter lower-case to follow convention --- .../jupiter/api/extension/TestInstantiationAwareExtension.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstantiationAwareExtension.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstantiationAwareExtension.java index 5308f65cb516..35565040f37a 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstantiationAwareExtension.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstantiationAwareExtension.java @@ -138,7 +138,7 @@ enum ExtensionContextScope { * * @see #DEFAULT */ - public static final String DEFAULT_SCOPE_PROPERTY_NAME = "junit.jupiter.extensions.testInstantiation.extensionContextScope.default"; + public static final String DEFAULT_SCOPE_PROPERTY_NAME = "junit.jupiter.extensions.testinstantiation.extensioncontextscope.default"; } } From 0de9d1033da1880dc61c72b02840941cfcc2d10e Mon Sep 17 00:00:00 2001 From: "Y.H. Kuo" Date: Wed, 16 Oct 2024 16:31:40 +0800 Subject: [PATCH 188/611] Introduce method filter support in the ConsoleLauncher (#3169) The new `--exclude-methodname` and `--include-methodname` options added of the `ConsoleLauncher` allow include or exclude methods based on fully qualified method names without parameters. For example, `--exclude-methodname=^org\.example\..+#methodname` will exclude all methods called `methodName` in the `org.example` package or any of its subpackages. Resolves #3107. --- .../release-notes-5.12.0-M1.adoc | 4 + .../console/options/TestDiscoveryOptions.java | 18 ++ .../options/TestDiscoveryOptionsMixin.java | 12 ++ .../tasks/DiscoveryRequestCreator.java | 10 + .../launcher/AbstractMethodFilter.java | 64 +++++++ .../launcher/ExcludeMethodFilter.java | 58 ++++++ .../launcher/IncludeMethodFilter.java | 58 ++++++ .../junit/platform/launcher/MethodFilter.java | 107 +++++++++++ .../ConsoleLauncherIntegrationTests.java | 13 ++ .../CommandLineOptionsParsingTests.java | 42 +++++ .../tasks/DiscoveryRequestCreatorTests.java | 12 ++ .../platform/launcher/MethodFilterTests.java | 172 ++++++++++++++++++ 12 files changed, 570 insertions(+) create mode 100644 junit-platform-launcher/src/main/java/org/junit/platform/launcher/AbstractMethodFilter.java create mode 100644 junit-platform-launcher/src/main/java/org/junit/platform/launcher/ExcludeMethodFilter.java create mode 100644 junit-platform-launcher/src/main/java/org/junit/platform/launcher/IncludeMethodFilter.java create mode 100644 junit-platform-launcher/src/main/java/org/junit/platform/launcher/MethodFilter.java create mode 100644 platform-tests/src/test/java/org/junit/platform/launcher/MethodFilterTests.java diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 0e6785e9f512..5f8f864a4a6b 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -59,6 +59,10 @@ JUnit repository on GitHub. [[release-notes-5.12.0-M1-junit-jupiter-new-features-and-improvements]] ==== New Features and Improvements +* New `--exclude-methodname` and `--include-methodname` options added to the + `ConsoleLauncher` to include or exclude methods based on fully qualified method names + without parameters. For example, `--exclude-methodname=^org\.example\..+#methodname` + will exclude all methods called `methodName` under package `org.example`. * In a `@ParameterizedTest` method, a `null` value can now be supplied for Java Date/Time types such as `LocalDate` if the new `nullable` attribute in `@JavaTimeConversionPattern` is set to `true`. diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptions.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptions.java index 64dd75973922..ab9fe3027dd7 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptions.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptions.java @@ -64,6 +64,8 @@ public class TestDiscoveryOptions { private List excludedClassNamePatterns = emptyList(); private List includedPackages = emptyList(); private List excludedPackages = emptyList(); + private List includedMethodNamePatterns = emptyList(); + private List excludedMethodNamePatterns = emptyList(); private List includedEngines = emptyList(); private List excludedEngines = emptyList(); private List includedTagExpressions = emptyList(); @@ -235,6 +237,22 @@ public void setExcludedPackages(List excludedPackages) { this.excludedPackages = excludedPackages; } + public List getIncludedMethodNamePatterns() { + return includedMethodNamePatterns; + } + + public void setIncludedMethodNamePatterns(List includedMethodNamePatterns) { + this.includedMethodNamePatterns = includedMethodNamePatterns; + } + + public List getExcludedMethodNamePatterns() { + return excludedMethodNamePatterns; + } + + public void setExcludedMethodNamePatterns(List excludedMethodNamePatterns) { + this.excludedMethodNamePatterns = excludedMethodNamePatterns; + } + public List getIncludedEngines() { return this.includedEngines; } diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptionsMixin.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptionsMixin.java index a5fce585dd26..d71b1f0a6e2f 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptionsMixin.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptionsMixin.java @@ -202,6 +202,16 @@ static class FilterOptions { @Option(names = { "-exclude-package" }, arity = "1", hidden = true) private final List excludePackages2 = new ArrayList<>(); + @Option(names = { + "--include-methodname" }, paramLabel = "PATTERN", arity = "1", description = "Provide a regular expression to include only methods whose fully qualified names without parameters match. " // + + "When this option is repeated, all patterns will be combined using OR semantics.") + private List includeMethodNamePatterns = new ArrayList<>(); + + @Option(names = { + "--exclude-methodname" }, paramLabel = "PATTERN", arity = "1", description = "Provide a regular expression to exclude those methods whose fully qualified names without parameters match. " // + + "When this option is repeated, all patterns will be combined using OR semantics.") + private List excludeMethodNamePatterns = new ArrayList<>(); + @Option(names = { "-t", "--include-tag" }, paramLabel = "TAG", arity = "1", description = "Provide a tag or tag expression to include only tests whose tags match. " + // @@ -239,6 +249,8 @@ private void applyTo(TestDiscoveryOptions result) { result.setExcludedClassNamePatterns(merge(this.excludeClassNamePatterns, this.excludeClassNamePatterns2)); result.setIncludedPackages(merge(this.includePackages, this.includePackages2)); result.setExcludedPackages(merge(this.excludePackages, this.excludePackages2)); + result.setIncludedMethodNamePatterns(new ArrayList<>(this.includeMethodNamePatterns)); + result.setExcludedMethodNamePatterns(new ArrayList<>(this.excludeMethodNamePatterns)); result.setIncludedTagExpressions(merge(this.includedTags, this.includedTags2)); result.setExcludedTagExpressions(merge(this.excludedTags, this.excludedTags2)); result.setIncludedEngines(merge(this.includedEngines, this.includedEngines2)); diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/DiscoveryRequestCreator.java b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/DiscoveryRequestCreator.java index 32a4090bc4e2..6cbbfa039d6b 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/DiscoveryRequestCreator.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/DiscoveryRequestCreator.java @@ -18,6 +18,8 @@ import static org.junit.platform.engine.discovery.PackageNameFilter.includePackageNames; import static org.junit.platform.launcher.EngineFilter.excludeEngines; import static org.junit.platform.launcher.EngineFilter.includeEngines; +import static org.junit.platform.launcher.MethodFilter.excludeMethodNamePatterns; +import static org.junit.platform.launcher.MethodFilter.includeMethodNamePatterns; import static org.junit.platform.launcher.TagFilter.excludeTags; import static org.junit.platform.launcher.TagFilter.includeTags; import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; @@ -106,6 +108,14 @@ private void addFilters(LauncherDiscoveryRequestBuilder requestBuilder, TestDisc requestBuilder.filters(excludePackageNames(options.getExcludedPackages())); } + if (!options.getIncludedMethodNamePatterns().isEmpty()) { + requestBuilder.filters(includeMethodNamePatterns(options.getIncludedMethodNamePatterns())); + } + + if (!options.getExcludedMethodNamePatterns().isEmpty()) { + requestBuilder.filters(excludeMethodNamePatterns(options.getExcludedMethodNamePatterns())); + } + if (!options.getIncludedTagExpressions().isEmpty()) { requestBuilder.filters(includeTags(options.getIncludedTagExpressions())); } diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/AbstractMethodFilter.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/AbstractMethodFilter.java new file mode 100644 index 000000000000..1f8759693fdb --- /dev/null +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/AbstractMethodFilter.java @@ -0,0 +1,64 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.launcher; + +import static java.util.stream.Collectors.joining; +import static java.util.stream.Collectors.toList; + +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import java.util.regex.Pattern; + +import org.junit.platform.commons.util.Preconditions; +import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.engine.TestDescriptor; +import org.junit.platform.engine.support.descriptor.MethodSource; + +/** + * Abstract {@link MethodFilter} that servers as a superclass + * for filters including or excluding fully qualified method names + * without parameters based on pattern-matching. + * + * @since 1.12 + */ +abstract class AbstractMethodFilter implements MethodFilter { + + protected final List patterns; + protected final String patternDescription; + + AbstractMethodFilter(String... patterns) { + Preconditions.notEmpty(patterns, "patterns array must not be null or empty"); + Preconditions.containsNoNullElements(patterns, "patterns array must not contain null elements"); + this.patterns = Arrays.stream(patterns).map(Pattern::compile).collect(toList()); + this.patternDescription = Arrays.stream(patterns).collect(joining("' OR '", "'", "'")); + } + + protected Optional findMatchingPattern(String methodName) { + if (methodName == null) { + return Optional.empty(); + } + return this.patterns.stream().filter(pattern -> pattern.matcher(methodName).matches()).findAny(); + } + + protected String getFullyQualifiedMethodNameFromDescriptor(TestDescriptor descriptor) { + return descriptor.getSource() // + .filter(source -> source instanceof MethodSource) // + .map(methodSource -> getFullyQualifiedMethodNameWithoutParameters(((MethodSource) methodSource))) // + .orElse(null); + } + + private String getFullyQualifiedMethodNameWithoutParameters(MethodSource methodSource) { + String methodNameWithParentheses = ReflectionUtils.getFullyQualifiedMethodName(methodSource.getJavaClass(), + methodSource.getMethodName(), (Class[]) null); + return methodNameWithParentheses.substring(0, methodNameWithParentheses.length() - 2); + } +} diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/ExcludeMethodFilter.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/ExcludeMethodFilter.java new file mode 100644 index 000000000000..e1522163adf2 --- /dev/null +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/ExcludeMethodFilter.java @@ -0,0 +1,58 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.launcher; + +import static org.junit.platform.engine.FilterResult.excluded; +import static org.junit.platform.engine.FilterResult.included; + +import java.util.regex.Pattern; + +import org.junit.platform.engine.FilterResult; +import org.junit.platform.engine.TestDescriptor; + +/** + * {@link MethodFilter} that matches fully qualified method names against + * patterns in the form of regular expressions. + * + *

    If the fully qualified name of a method matches against at least one + * pattern, the class will be excluded. + * + * @since 1.12 + */ +class ExcludeMethodFilter extends AbstractMethodFilter { + + ExcludeMethodFilter(String... patterns) { + super(patterns); + } + + @Override + public FilterResult apply(TestDescriptor descriptor) { + String methodName = getFullyQualifiedMethodNameFromDescriptor(descriptor); + return findMatchingPattern(methodName) // + .map(pattern -> excluded(formatExclusionReason(methodName, pattern))) // + .orElseGet(() -> included(formatInclusionReason(methodName))); + } + + private String formatInclusionReason(String methodName) { + return String.format("Method name [%s] does not match any excluded pattern: %s", methodName, + patternDescription); + } + + private String formatExclusionReason(String methodName, Pattern pattern) { + return String.format("Method name [%s] matches excluded pattern: '%s'", methodName, pattern); + } + + @Override + public String toString() { + return String.format("%s that excludes method names that match one of the following regular expressions: %s", + getClass().getSimpleName(), patternDescription); + } +} diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/IncludeMethodFilter.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/IncludeMethodFilter.java new file mode 100644 index 000000000000..d9242940e2d5 --- /dev/null +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/IncludeMethodFilter.java @@ -0,0 +1,58 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.launcher; + +import static org.junit.platform.engine.FilterResult.excluded; +import static org.junit.platform.engine.FilterResult.included; + +import java.util.regex.Pattern; + +import org.junit.platform.engine.FilterResult; +import org.junit.platform.engine.TestDescriptor; + +/** + * {@link MethodFilter} that matches fully qualified method names against + * patterns in the form of regular expressions. + * + *

    If the fully qualified name of a method matches against at least one + * pattern, the method will be included. + * + * @since 1.12 + */ +class IncludeMethodFilter extends AbstractMethodFilter { + + IncludeMethodFilter(String... patterns) { + super(patterns); + } + + @Override + public FilterResult apply(TestDescriptor descriptor) { + String methodName = getFullyQualifiedMethodNameFromDescriptor(descriptor); + return findMatchingPattern(methodName) // + .map(pattern -> included(formatInclusionReason(methodName, pattern))) // + .orElseGet(() -> excluded(formatExclusionReason(methodName))); + } + + private String formatInclusionReason(String methodName, Pattern pattern) { + return String.format("Method name [%s] matches included pattern: '%s'", methodName, pattern); + } + + private String formatExclusionReason(String methodName) { + return String.format("Method name [%s] does not match any included pattern: %s", methodName, + patternDescription); + } + + @Override + public String toString() { + return String.format("%s that includes method names that match one of the following regular expressions: %s", + getClass().getSimpleName(), patternDescription); + } +} diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/MethodFilter.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/MethodFilter.java new file mode 100644 index 000000000000..e7f4f99b1a32 --- /dev/null +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/MethodFilter.java @@ -0,0 +1,107 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.launcher; + +import static org.apiguardian.api.API.Status.EXPERIMENTAL; + +import java.lang.reflect.Method; +import java.util.List; + +import org.apiguardian.api.API; + +/** + * {@link PostDiscoveryFilter} that is applied to the fully qualified + * {@link Method} name without parameters. + * + * @since 1.12 + * @see #includeMethodNamePatterns(String...) + * @see #excludeMethodNamePatterns(String...) + */ +@API(status = EXPERIMENTAL, since = "1.12") +public interface MethodFilter extends PostDiscoveryFilter { + + /** + * Create a new include {@link MethodFilter} based on the + * supplied patterns. + * + *

    The patterns are combined using OR semantics, i.e. if the fully + * qualified name of a method matches against at least one of the patterns, + * the method will be included in the result set. + * + * @param patterns regular expressions to match against fully qualified + * method names; never {@code null}, empty, or containing {@code null} + * @see Class#getName() + * @see Method#getName() + * @see #includeMethodNamePatterns(List) + * @see #excludeMethodNamePatterns(String...) + */ + static MethodFilter includeMethodNamePatterns(String... patterns) { + return new IncludeMethodFilter(patterns); + } + + /** + * Create a new include {@link MethodFilter} based on the + * supplied patterns. + * + *

    The patterns are combined using OR semantics, i.e. if the fully + * qualified name of a method matches against at least one of the patterns, + * the method will be included in the result set. + * + * @param patterns regular expressions to match against fully qualified + * method names; never {@code null}, empty, or containing {@code null} + * @see Class#getName() + * @see Method#getName() + * @see #includeMethodNamePatterns(String...) + * @see #excludeMethodNamePatterns(String...) + */ + static MethodFilter includeMethodNamePatterns(List patterns) { + return includeMethodNamePatterns(patterns.toArray(new String[0])); + } + + /** + * Create a new exclude {@link MethodFilter} based on the + * supplied patterns. + * + *

    The patterns are combined using OR semantics, i.e. if the fully + * qualified name of a method matches against at least one of the patterns, + * the method will be excluded from the result set. + * + * @param patterns regular expressions to match against fully qualified + * method names; never {@code null}, empty, or containing {@code null} + * @see Class#getName() + * @see Method#getName() + * @see #excludeMethodNamePatterns(List) + * @see #includeMethodNamePatterns(String...) + */ + static MethodFilter excludeMethodNamePatterns(String... patterns) { + return new ExcludeMethodFilter(patterns); + } + + /** + * Create a new exclude {@link MethodFilter} based on the + * supplied patterns. + * + *

    The patterns are combined using OR semantics, i.e. if the fully + * qualified name of a method matches against at least one of the patterns, + * the method will be excluded from the result set. + * + * @param patterns regular expressions to match against fully qualified + * method names; never {@code null}, empty, or containing {@code null} + * @see Class#getName() + * @see Method#getName() + * @see #excludeMethodNamePatterns(String...) + * @see #includeMethodNamePatterns(String...) + */ + static MethodFilter excludeMethodNamePatterns(List patterns) { + return excludeMethodNamePatterns(patterns.toArray(new String[0])); + } + +} diff --git a/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherIntegrationTests.java index c3338dfe6753..c06186886bdf 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherIntegrationTests.java @@ -62,6 +62,19 @@ void executeWithExcludeClassnameOptionExcludesClasses(final String line) { ); } + @Test + void executeWithExcludeMethodNameOptionExcludesMethods() { + var line = "execute -e junit-jupiter -p org.junit.platform.console.subpackage --exclude-methodname" + + " ^org\\.junit\\.platform\\.console\\.subpackage\\..+#test"; + var args = line.split(" "); + var result = new ConsoleLauncherWrapper().execute(args); + assertAll("all subpackage test methods are excluded by the method name filter", // + () -> assertArrayEquals(args, result.args), // + () -> assertEquals(0, result.code), // + () -> assertEquals(0, result.getTestsFoundCount()) // + ); + } + @ParameterizedTest @ValueSource(strings = { // "-e junit-jupiter -o java.base", "-e junit-jupiter --select-module java.base", // diff --git a/platform-tests/src/test/java/org/junit/platform/console/options/CommandLineOptionsParsingTests.java b/platform-tests/src/test/java/org/junit/platform/console/options/CommandLineOptionsParsingTests.java index d34740b1b0d6..3b9b10935c9f 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/options/CommandLineOptionsParsingTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/options/CommandLineOptionsParsingTests.java @@ -64,6 +64,8 @@ void parseNoArguments() { () -> assertEquals(List.of(), options.discovery.getExcludedClassNamePatterns()), () -> assertEquals(List.of(), options.discovery.getIncludedPackages()), () -> assertEquals(List.of(), options.discovery.getExcludedPackages()), + () -> assertEquals(List.of(), options.discovery.getIncludedMethodNamePatterns()), + () -> assertEquals(List.of(), options.discovery.getExcludedMethodNamePatterns()), () -> assertEquals(List.of(), options.discovery.getIncludedTagExpressions()), () -> assertEquals(List.of(), options.discovery.getExcludedTagExpressions()), () -> assertEquals(List.of(), options.discovery.getAdditionalClasspathEntries()), @@ -198,6 +200,46 @@ void parseValidExcludedPackages(ArgsType type) { // @formatter:on } + @ParameterizedTest + @EnumSource + void parseValidIncludeMethodNamePatterns(ArgsType type) { + // @formatter:off + assertAll( + () -> assertEquals(List.of(".+#method.*"), + type.parseArgLine("--include-methodname .+#method.*").discovery.getIncludedMethodNamePatterns()), + () -> assertEquals(List.of(".+#methodA.*", ".+#methodB.*"), + type.parseArgLine("--include-methodname .+#methodA.* --include-methodname .+#methodB.*").discovery.getIncludedMethodNamePatterns()), + () -> assertEquals(List.of(".+#method.*"), + type.parseArgLine("--include-methodname=.+#method.*").discovery.getIncludedMethodNamePatterns()) + ); + // @formatter:on + } + + @ParameterizedTest + @EnumSource + void parseValidExcludeMethodNamePatterns(ArgsType type) { + // @formatter:off + assertAll( + () -> assertEquals(List.of(".+#method.*"), + type.parseArgLine("--exclude-methodname .+#method.*").discovery.getExcludedMethodNamePatterns()), + () -> assertEquals(List.of(".+#methodA.*", ".+#methodB.*"), + type.parseArgLine("--exclude-methodname .+#methodA.* --exclude-methodname .+#methodB.*").discovery.getExcludedMethodNamePatterns()), + () -> assertEquals(List.of(".+#method.*"), + type.parseArgLine("--exclude-methodname=.+#method.*").discovery.getExcludedMethodNamePatterns()) + ); + // @formatter:on + } + + @Test + void parseInvalidIncludeMethodNamePatterns() { + assertOptionWithMissingRequiredArgumentThrowsException("--include-methodname"); + } + + @Test + void parseInvalidExcludeMethodNamePatterns() { + assertOptionWithMissingRequiredArgumentThrowsException("--exclude-methodname"); + } + @ParameterizedTest @EnumSource void parseValidIncludedTags(ArgsType type) { diff --git a/platform-tests/src/test/java/org/junit/platform/console/tasks/DiscoveryRequestCreatorTests.java b/platform-tests/src/test/java/org/junit/platform/console/tasks/DiscoveryRequestCreatorTests.java index b8eea36cfd1e..95e7123423bc 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/tasks/DiscoveryRequestCreatorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/tasks/DiscoveryRequestCreatorTests.java @@ -178,6 +178,18 @@ void convertsPackageOptions() { assertExcludes(packageNameFilters.get(1), "org.junit.excluded1"); } + @Test + void convertsMethodNamePatternOptions() { + options.setScanClasspath(true); + options.setIncludedMethodNamePatterns(List.of(".+#foo.*Bar", ".+#toString", ".+#method.*")); + options.setExcludedMethodNamePatterns(List.of(".+#bar.*Foo")); + var request = convert(); + var methodNameFilters = request.getPostDiscoveryFilters(); + assertThat(methodNameFilters).hasSize(2); + assertThat(methodNameFilters.get(0).toString()).contains(".+#foo.*Bar", ".+#toString", ".+#method.*"); + assertThat(methodNameFilters.get(1).toString()).contains(".+#bar.*Foo"); + } + @Test void convertsTagOptions() { options.setScanClasspath(true); diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/MethodFilterTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/MethodFilterTests.java new file mode 100644 index 000000000000..a7622264f1ff --- /dev/null +++ b/platform-tests/src/test/java/org/junit/platform/launcher/MethodFilterTests.java @@ -0,0 +1,172 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.launcher; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.platform.launcher.MethodFilter.excludeMethodNamePatterns; +import static org.junit.platform.launcher.MethodFilter.includeMethodNamePatterns; + +import org.junit.jupiter.api.Test; +import org.junit.platform.commons.PreconditionViolationException; +import org.junit.platform.commons.util.ReflectionUtils; +import org.junit.platform.engine.FilterResult; +import org.junit.platform.engine.TestDescriptor; +import org.junit.platform.engine.UniqueId; +import org.junit.platform.engine.support.descriptor.DemoMethodTestDescriptor; + +/** + * Unit tests for {@link MethodFilter}. + * + * @since 1.12 + */ +class MethodFilterTests { + private static final String CLASS1_TEST1_NAME = "org.junit.platform.launcher.MethodFilterTests$Class1#test1"; + private static final String CLASS1_TEST2_NAME = "org.junit.platform.launcher.MethodFilterTests$Class1#test2"; + private static final String CLASS2_TEST1_NAME = "org.junit.platform.launcher.MethodFilterTests$Class2#test1"; + private static final String CLASS2_TEST2_NAME = "org.junit.platform.launcher.MethodFilterTests$Class2#test2"; + private static final TestDescriptor CLASS1_TEST1 = methodTestDescriptor("class1", Class1.class, "test1"); + private static final TestDescriptor CLASS1_TEST2 = methodTestDescriptor("class1", Class1.class, "test2"); + private static final TestDescriptor CLASS2_TEST1 = methodTestDescriptor("class2", Class2.class, "test1"); + private static final TestDescriptor CLASS2_TEST2 = methodTestDescriptor("class2", Class2.class, "test2"); + + @Test + void includeMethodNamePatternsChecksPreconditions() { + assertThatThrownBy(() -> includeMethodNamePatterns((String[]) null)) // + .isInstanceOf(PreconditionViolationException.class) // + .hasMessage("patterns array must not be null or empty"); + assertThatThrownBy(() -> includeMethodNamePatterns(new String[0])) // + .isInstanceOf(PreconditionViolationException.class) // + .hasMessage("patterns array must not be null or empty"); + assertThatThrownBy(() -> includeMethodNamePatterns(new String[] { null })) // + .isInstanceOf(PreconditionViolationException.class) // + .hasMessage("patterns array must not contain null elements"); + } + + @Test + void includeSingleMethodNamePattern() { + var regex = "^org\\.junit\\.platform\\.launcher\\.MethodFilterTests\\$Class1#test.*"; + var filter = includeMethodNamePatterns(regex); + + assertIncluded(filter.apply(CLASS1_TEST1), + String.format("Method name [%s] matches included pattern: '%s'", CLASS1_TEST1_NAME, regex)); + assertIncluded(filter.apply(CLASS1_TEST2), + String.format("Method name [%s] matches included pattern: '%s'", CLASS1_TEST2_NAME, regex)); + + assertExcluded(filter.apply(CLASS2_TEST1), + String.format("Method name [%s] does not match any included pattern: '%s'", CLASS2_TEST1_NAME, regex)); + assertExcluded(filter.apply(CLASS2_TEST2), + String.format("Method name [%s] does not match any included pattern: '%s'", CLASS2_TEST2_NAME, regex)); + } + + @Test + void includeMultipleMethodNamePatterns() { + var firstRegex = "^org\\.junit\\.platform\\.launcher\\.MethodFilterTests\\$Class1#test.*"; + var secondRegex = ".+Class.+#test1"; + var filter = includeMethodNamePatterns(firstRegex, secondRegex); + + assertIncluded(filter.apply(CLASS1_TEST1), + String.format("Method name [%s] matches included pattern: '%s'", CLASS1_TEST1_NAME, firstRegex)); + assertIncluded(filter.apply(CLASS1_TEST2), + String.format("Method name [%s] matches included pattern: '%s'", CLASS1_TEST2_NAME, firstRegex)); + assertIncluded(filter.apply(CLASS2_TEST1), + String.format("Method name [%s] matches included pattern: '%s'", CLASS2_TEST1_NAME, secondRegex)); + + assertExcluded(filter.apply(CLASS2_TEST2), + String.format("Method name [%s] does not match any included pattern: '%s' OR '%s'", CLASS2_TEST2_NAME, + firstRegex, secondRegex)); + } + + @Test + void excludeMethodNamePatternsChecksPreconditions() { + assertThatThrownBy(() -> excludeMethodNamePatterns((String[]) null)) // + .isInstanceOf(PreconditionViolationException.class) // + .hasMessage("patterns array must not be null or empty"); + assertThatThrownBy(() -> excludeMethodNamePatterns(new String[0])) // + .isInstanceOf(PreconditionViolationException.class) // + .hasMessage("patterns array must not be null or empty"); + assertThatThrownBy(() -> excludeMethodNamePatterns(new String[] { null })) // + .isInstanceOf(PreconditionViolationException.class) // + .hasMessage("patterns array must not contain null elements"); + } + + @Test + void excludeSingleMethodNamePattern() { + var regex = "^org\\.junit\\.platform\\.launcher\\.MethodFilterTests\\$Class1#test.*"; + var filter = excludeMethodNamePatterns(regex); + + assertExcluded(filter.apply(CLASS1_TEST1), + String.format("Method name [%s] matches excluded pattern: '%s'", CLASS1_TEST1_NAME, regex)); + assertExcluded(filter.apply(CLASS1_TEST2), + String.format("Method name [%s] matches excluded pattern: '%s'", CLASS1_TEST2_NAME, regex)); + + assertIncluded(filter.apply(CLASS2_TEST1), + String.format("Method name [%s] does not match any excluded pattern: '%s'", CLASS2_TEST1_NAME, regex)); + assertIncluded(filter.apply(CLASS2_TEST2), + String.format("Method name [%s] does not match any excluded pattern: '%s'", CLASS2_TEST2_NAME, regex)); + } + + @Test + void excludeMultipleMethodNamePatterns() { + var firstRegex = "^org\\.junit\\.platform\\.launcher\\.MethodFilterTests\\$Class1#test.*"; + var secondRegex = ".+Class.+#test1"; + var filter = excludeMethodNamePatterns(firstRegex, secondRegex); + + assertExcluded(filter.apply(CLASS1_TEST1), + String.format("Method name [%s] matches excluded pattern: '%s'", CLASS1_TEST1_NAME, firstRegex)); + assertExcluded(filter.apply(CLASS1_TEST2), + String.format("Method name [%s] matches excluded pattern: '%s'", CLASS1_TEST2_NAME, firstRegex)); + assertExcluded(filter.apply(CLASS2_TEST1), + String.format("Method name [%s] matches excluded pattern: '%s'", CLASS2_TEST1_NAME, secondRegex)); + + assertIncluded(filter.apply(CLASS2_TEST2), + String.format("Method name [%s] does not match any excluded pattern: '%s' OR '%s'", CLASS2_TEST2_NAME, + firstRegex, secondRegex)); + } + + private void assertIncluded(FilterResult filterResult, String expectedReason) { + assertTrue(filterResult.included()); + assertThat(filterResult.getReason()).isPresent().contains(expectedReason); + } + + private void assertExcluded(FilterResult filterResult, String excludedPattern) { + assertTrue(filterResult.excluded()); + assertThat(filterResult.getReason()).isPresent().contains(excludedPattern); + } + + private static TestDescriptor methodTestDescriptor(String uniqueId, Class testClass, String methodName) { + var method = ReflectionUtils.findMethod(testClass, methodName, new Class[0]).orElseThrow(); + return new DemoMethodTestDescriptor(UniqueId.root("method", uniqueId), testClass, method); + } + + // ------------------------------------------------------------------------- + + private static class Class1 { + @Test + void test1() { + } + + @Test + void test2() { + } + } + + private static class Class2 { + @Test + void test1() { + } + + @Test + void test2() { + } + } +} From 91924ec1f18066f8c36890882a9c321cf7a50841 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 17 Oct 2024 08:34:04 +0200 Subject: [PATCH 189/611] Remove unused import --- platform-tooling-support-tests/projects/vintage/build.gradle.kts | 1 - 1 file changed, 1 deletion(-) diff --git a/platform-tooling-support-tests/projects/vintage/build.gradle.kts b/platform-tooling-support-tests/projects/vintage/build.gradle.kts index 4d691459831f..b06aca00e221 100644 --- a/platform-tooling-support-tests/projects/vintage/build.gradle.kts +++ b/platform-tooling-support-tests/projects/vintage/build.gradle.kts @@ -1,4 +1,3 @@ -import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.gradle.api.tasks.testing.logging.TestLogEvent plugins { From bade1a664570595b3199451b34996adbbc660467 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 17 Oct 2024 09:22:22 +0200 Subject: [PATCH 190/611] Add type to issue templates where applicable --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 8d847d251231..1f18cfbe3284 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,7 +1,7 @@ --- name: Bug report about: Create a report to help us improve - +type: Bug --- diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 24e26904931e..90bc57749d3d 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,7 +1,7 @@ --- name: Feature request about: Suggest an idea for this project - +type: Feature --- From 1615c51848c0b445eb68ed20e4dbc1228bf67fd0 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 17 Oct 2024 09:25:29 +0200 Subject: [PATCH 191/611] Add links to GitHub Discussions and Stack Overflow --- .github/ISSUE_TEMPLATE/config.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/config.yml diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000000..c3afd6b84a82 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: true +contact_links: + - name: GitHub Discussions + url: https://github.com/junit-team/junit5/discussions + about: Please ask and answer questions here. + - name: Stack Overflow ("junit5" tag) + url: https://stackoverflow.com/questions/tagged/junit5 + about: Alternatively, ask questions here. From 9130f7f9a8216f548f9a6535a339967cb87f59c5 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 17 Oct 2024 09:28:36 +0200 Subject: [PATCH 192/611] Replace question template with links --- .github/ISSUE_TEMPLATE/config.yml | 6 +++--- .github/ISSUE_TEMPLATE/question.md | 11 ----------- 2 files changed, 3 insertions(+), 14 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/question.md diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index c3afd6b84a82..631b15a650fc 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,8 +1,8 @@ blank_issues_enabled: true contact_links: - - name: GitHub Discussions - url: https://github.com/junit-team/junit5/discussions + - name: Question (GitHub Discussions) + url: https://github.com/junit-team/junit5/discussions/categories/q-a about: Please ask and answer questions here. - - name: Stack Overflow ("junit5" tag) + - name: Question (Stack Overflow) url: https://stackoverflow.com/questions/tagged/junit5 about: Alternatively, ask questions here. diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md deleted file mode 100644 index 23c796b2d20d..000000000000 --- a/.github/ISSUE_TEMPLATE/question.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Question -about: Please first ask on Gitter or StackOverflow before creating an issue ---- - -This issue tracker is not the place for questions. -If you want to ask how to do something, or to understand why -something isn't working the way you expect it to, please use Gitter [1] or Stack Overflow [2]. - -[1] https://gitter.im/junit-team/junit5 -[2] https://stackoverflow.com/questions/tagged/junit5 From 47293b34db30b61b23e921458c46b1d07543d59f Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 17 Oct 2024 09:31:43 +0200 Subject: [PATCH 193/611] Add task template --- .github/ISSUE_TEMPLATE/task.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/task.md diff --git a/.github/ISSUE_TEMPLATE/task.md b/.github/ISSUE_TEMPLATE/task.md new file mode 100644 index 000000000000..00fd3cfa145a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/task.md @@ -0,0 +1,11 @@ +--- +name: Task +about: Create a task for a specific piece of work +type: Task +--- + + + +## Deliverables + +- [ ] ... From 702491b0477769f24711b68024a07c283e250586 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 17 Oct 2024 09:32:00 +0200 Subject: [PATCH 194/611] Disable creating blank issues --- .github/ISSUE_TEMPLATE/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 631b15a650fc..c70dddb3f512 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,4 +1,4 @@ -blank_issues_enabled: true +blank_issues_enabled: false contact_links: - name: Question (GitHub Discussions) url: https://github.com/junit-team/junit5/discussions/categories/q-a From f9f0b6bf0bec2106b05de02bf3b9bff512994c43 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 17 Oct 2024 09:38:31 +0200 Subject: [PATCH 195/611] Add labels to issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 1 + .github/ISSUE_TEMPLATE/feature_request.md | 1 + .github/ISSUE_TEMPLATE/task.md | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 1f18cfbe3284..1a3c9c032e0d 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -2,6 +2,7 @@ name: Bug report about: Create a report to help us improve type: Bug +labels: ["type: bug"] --- diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 90bc57749d3d..bcae1d871a49 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -2,6 +2,7 @@ name: Feature request about: Suggest an idea for this project type: Feature +labels: ["type: new feature"] --- diff --git a/.github/ISSUE_TEMPLATE/task.md b/.github/ISSUE_TEMPLATE/task.md index 00fd3cfa145a..354532f2cc14 100644 --- a/.github/ISSUE_TEMPLATE/task.md +++ b/.github/ISSUE_TEMPLATE/task.md @@ -2,6 +2,7 @@ name: Task about: Create a task for a specific piece of work type: Task +labels: ["type: task"] --- From 53648b272f81a050d303e277f1b7ad21bdde7da9 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 17 Oct 2024 09:39:29 +0200 Subject: [PATCH 196/611] Make issue template names consist with ones generated by GitHub --- .github/ISSUE_TEMPLATE/bug_report.md | 4 ++-- .github/ISSUE_TEMPLATE/config.yml | 4 ++-- .github/ISSUE_TEMPLATE/feature_request.md | 2 +- .github/ISSUE_TEMPLATE/task.md | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 1a3c9c032e0d..57a6f10876d6 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,11 +1,11 @@ --- -name: Bug report +name: Report a bug or regression about: Create a report to help us improve type: Bug labels: ["type: bug"] --- - + ## Steps to reproduce diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index c70dddb3f512..2e5cdef3129d 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,8 +1,8 @@ blank_issues_enabled: false contact_links: - - name: Question (GitHub Discussions) + - name: Ask a question url: https://github.com/junit-team/junit5/discussions/categories/q-a about: Please ask and answer questions here. - - name: Question (Stack Overflow) + - name: Ask a question (Stack Overflow) url: https://stackoverflow.com/questions/tagged/junit5 about: Alternatively, ask questions here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index bcae1d871a49..6b6b28087cbb 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,5 +1,5 @@ --- -name: Feature request +name: Request a feature or enhancement about: Suggest an idea for this project type: Feature labels: ["type: new feature"] diff --git a/.github/ISSUE_TEMPLATE/task.md b/.github/ISSUE_TEMPLATE/task.md index 354532f2cc14..fa7b782ac41b 100644 --- a/.github/ISSUE_TEMPLATE/task.md +++ b/.github/ISSUE_TEMPLATE/task.md @@ -1,5 +1,5 @@ --- -name: Task +name: Create a task about: Create a task for a specific piece of work type: Task labels: ["type: task"] From 061fb41c98b329a88fef547e97518739c7c1c6ac Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 17 Oct 2024 09:42:08 +0200 Subject: [PATCH 197/611] Remove periods for consistency --- .github/ISSUE_TEMPLATE/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 2e5cdef3129d..93fa0b266326 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -2,7 +2,7 @@ blank_issues_enabled: false contact_links: - name: Ask a question url: https://github.com/junit-team/junit5/discussions/categories/q-a - about: Please ask and answer questions here. + about: Please ask and answer questions here - name: Ask a question (Stack Overflow) url: https://stackoverflow.com/questions/tagged/junit5 - about: Alternatively, ask questions here. + about: Alternatively, ask questions here From 35d3dd71662beda795e3ce3c428b9a1215d8c9e4 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 17 Oct 2024 11:49:09 +0200 Subject: [PATCH 198/611] Fix package name comparison on Java 8 (#4077) `Class.getPackage()` returns `null` for the default package on Java 8. This is now handled by inspecting the fully qualified class name rather than throwing a `NullPointerException`. Fixes #4076. --- .../release-notes/release-notes-5.11.3.adoc | 3 +- .../junit-platform-commons.gradle.kts | 1 + .../commons/util/PackageNameUtils.java | 38 +++++++++++++++++++ .../commons/util/ReflectionUtils.java | 3 +- .../commons/util/PackageNameUtils.java | 30 +++++++++++++++ .../src/test/java/DefaultPackageTest.java | 22 +++++++++++ .../java/com/example/vintage/VintageTest.java | 3 ++ 7 files changed, 98 insertions(+), 2 deletions(-) create mode 100644 junit-platform-commons/src/main/java/org/junit/platform/commons/util/PackageNameUtils.java create mode 100644 junit-platform-commons/src/main/java9/org/junit/platform/commons/util/PackageNameUtils.java create mode 100644 platform-tooling-support-tests/projects/vintage/src/test/java/DefaultPackageTest.java diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc index c8ed02a67ceb..55fcc69e76fd 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc @@ -16,7 +16,8 @@ on GitHub. [[release-notes-5.11.3-junit-platform-bug-fixes]] ==== Bug Fixes -* ❓ +* Fixed a regression in method search algorithms introduced in 5.11.0 when classes reside + in the default package and using a Java 8 runtime. [[release-notes-5.11.3-junit-platform-deprecations-and-breaking-changes]] ==== Deprecations and Breaking Changes diff --git a/junit-platform-commons/junit-platform-commons.gradle.kts b/junit-platform-commons/junit-platform-commons.gradle.kts index c0d1404a6f60..ef52ce77ab56 100644 --- a/junit-platform-commons/junit-platform-commons.gradle.kts +++ b/junit-platform-commons/junit-platform-commons.gradle.kts @@ -29,6 +29,7 @@ tasks.jar { tasks.codeCoverageClassesJar { exclude("org/junit/platform/commons/util/ModuleUtils.class") + exclude("org/junit/platform/commons/util/PackageNameUtils.class") } eclipse { diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/PackageNameUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/PackageNameUtils.java new file mode 100644 index 000000000000..9a018363a4a1 --- /dev/null +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/PackageNameUtils.java @@ -0,0 +1,38 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.commons.util; + +import static org.junit.platform.commons.util.PackageUtils.DEFAULT_PACKAGE_NAME; + +/** + * Collection of utilities for working with package names. + * + *

    DISCLAIMER

    + * + *

    These utilities are intended solely for usage within the JUnit framework + * itself. Any usage by external parties is not supported. + * Use at your own risk! + * + * @since 1.11.3 + */ +class PackageNameUtils { + + static String getPackageName(Class clazz) { + Package p = clazz.getPackage(); + if (p != null) { + return p.getName(); + } + String className = clazz.getName(); + int index = className.lastIndexOf('.'); + return index == -1 ? DEFAULT_PACKAGE_NAME : className.substring(0, index); + } + +} diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java index 26bd8e1698cf..77e270376854 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java @@ -19,6 +19,7 @@ import static org.apiguardian.api.API.Status.INTERNAL; import static org.apiguardian.api.API.Status.STABLE; import static org.junit.platform.commons.util.CollectionUtils.toUnmodifiableList; +import static org.junit.platform.commons.util.PackageNameUtils.getPackageName; import static org.junit.platform.commons.util.ReflectionUtils.HierarchyTraversalMode.BOTTOM_UP; import static org.junit.platform.commons.util.ReflectionUtils.HierarchyTraversalMode.TOP_DOWN; @@ -1903,7 +1904,7 @@ private static boolean isPackagePrivate(Member member) { } private static boolean declaredInSamePackage(Method m1, Method m2) { - return m1.getDeclaringClass().getPackage().getName().equals(m2.getDeclaringClass().getPackage().getName()); + return getPackageName(m1.getDeclaringClass()).equals(getPackageName(m2.getDeclaringClass())); } /** diff --git a/junit-platform-commons/src/main/java9/org/junit/platform/commons/util/PackageNameUtils.java b/junit-platform-commons/src/main/java9/org/junit/platform/commons/util/PackageNameUtils.java new file mode 100644 index 000000000000..84afaf736290 --- /dev/null +++ b/junit-platform-commons/src/main/java9/org/junit/platform/commons/util/PackageNameUtils.java @@ -0,0 +1,30 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.commons.util; + +/** + * Collection of utilities for working with package names. + * + *

    DISCLAIMER

    + * + *

    These utilities are intended solely for usage within the JUnit framework + * itself. Any usage by external parties is not supported. + * Use at your own risk! + * + * @since 1.11.3 + */ +class PackageNameUtils { + + static String getPackageName(Class clazz) { + return clazz.getPackageName(); + } + +} diff --git a/platform-tooling-support-tests/projects/vintage/src/test/java/DefaultPackageTest.java b/platform-tooling-support-tests/projects/vintage/src/test/java/DefaultPackageTest.java new file mode 100644 index 000000000000..beebfdd5fd54 --- /dev/null +++ b/platform-tooling-support-tests/projects/vintage/src/test/java/DefaultPackageTest.java @@ -0,0 +1,22 @@ + +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ +import com.example.vintage.VintageTest; + +import org.junit.Ignore; + +/** + * Reproducer for https://github.com/junit-team/junit5/issues/4076 + */ +@Ignore +public class DefaultPackageTest extends VintageTest { + void packagePrivateMethod() { + } +} diff --git a/platform-tooling-support-tests/projects/vintage/src/test/java/com/example/vintage/VintageTest.java b/platform-tooling-support-tests/projects/vintage/src/test/java/com/example/vintage/VintageTest.java index 1632b1e3537b..a6efb8990791 100644 --- a/platform-tooling-support-tests/projects/vintage/src/test/java/com/example/vintage/VintageTest.java +++ b/platform-tooling-support-tests/projects/vintage/src/test/java/com/example/vintage/VintageTest.java @@ -15,6 +15,9 @@ import org.junit.Test; public class VintageTest { + void packagePrivateMethod() { + } + @Test public void success() { // pass From d3ec0feca095624281dc0994f69a3ef63b9cb7d6 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Sun, 20 Oct 2024 16:11:19 +0200 Subject: [PATCH 199/611] Disable TimeoutInvocationFactoryTests in Eclipse IDE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The default Mockito MockMaker (inline mock maker) fails to create a spy for NamespaceAwareStore when running within Eclipse IDE. - org.mockito.exceptions.base.MockitoException: Unable to initialize @⁠Spy annotated field 'store'. - Mockito cannot mock this class: class org.junit.jupiter.engine.execution.NamespaceAwareStore. - You are seeing this disclaimer because Mockito is configured to create inlined mocks. - Byte Buddy could not instrument all classes within the mock's type hierarchy. To address that, this commit disables TimeoutInvocationFactoryTests when running in Eclipse IDE. --- .../TimeoutInvocationFactoryTests.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactoryTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactoryTests.java index ba4536af5594..01b20579b1d8 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactoryTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactoryTests.java @@ -18,6 +18,7 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout.ThreadMode; +import org.junit.jupiter.api.condition.DisabledIf; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ExtensionContext.Store; @@ -30,6 +31,11 @@ import org.mockito.Spy; import org.mockito.junit.jupiter.MockitoExtension; +// org.mockito.exceptions.base.MockitoException: Unable to initialize @Spy annotated field 'store'. +// Mockito cannot mock this class: class org.junit.jupiter.engine.execution.NamespaceAwareStore. +// You are seeing this disclaimer because Mockito is configured to create inlined mocks. +// Byte Buddy could not instrument all classes within the mock's type hierarchy. +@DisabledIf(value = "runningInEclipse", disabledReason = "Mockito cannot create a spy for NamespaceAwareStore using the inline MockMaker in Eclipse IDE") @DisplayName("TimeoutInvocationFactory") @ExtendWith(MockitoExtension.class) class TimeoutInvocationFactoryTests { @@ -37,11 +43,15 @@ class TimeoutInvocationFactoryTests { @Spy private final Store store = new NamespaceAwareStore(new NamespacedHierarchicalStore<>(null), ExtensionContext.Namespace.create(TimeoutInvocationFactoryTests.class)); + @Mock private Invocation invocation; + @Mock private TimeoutDuration timeoutDuration; + private TimeoutInvocationFactory timeoutInvocationFactory; + private TimeoutInvocationParameters parameters; @BeforeEach @@ -86,4 +96,13 @@ void shouldCreateTimeoutInvocationForSeparateThreadTimeoutThreadMode() { assertThat(invocation).isInstanceOf(SeparateThreadTimeoutInvocation.class); } + /** + * Determine if the current code is running in the Eclipse IDE. + *

    Copied from {@code org.springframework.core.testfixture.ide.IdeUtils}. + */ + static boolean runningInEclipse() { + return StackWalker.getInstance().walk( + stream -> stream.anyMatch(stackFrame -> stackFrame.getClassName().startsWith("org.eclipse.jdt"))); + } + } From 14b2799f362aff71264a7a1581f3dabed191c68b Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Sun, 20 Oct 2024 16:22:36 +0200 Subject: [PATCH 200/611] Suppress deprecation and resource warnings --- .../org/junit/platform/commons/support/ReflectionSupport.java | 1 + .../src/main/java/org/junit/platform/runner/JUnitPlatform.java | 1 + .../junit/jupiter/engine/descriptor/ExtensionContextTests.java | 3 +++ .../org/junit/jupiter/engine/extension/AutoCloseTests.java | 1 + 4 files changed, 6 insertions(+) diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ReflectionSupport.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ReflectionSupport.java index af578f1ff4ff..2081eb20eb4e 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ReflectionSupport.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ReflectionSupport.java @@ -67,6 +67,7 @@ private ReflectionSupport() { */ @API(status = DEPRECATED, since = "1.4") @Deprecated + @SuppressWarnings("deprecation") public static Optional> loadClass(String name) { return ReflectionUtils.loadClass(name); } diff --git a/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatform.java b/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatform.java index 8b8c26f098b1..ee0b3bb15afe 100644 --- a/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatform.java +++ b/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatform.java @@ -160,6 +160,7 @@ private JUnitPlatformTestTree generateTestTree(LauncherDiscoveryRequest discover return new JUnitPlatformTestTree(testPlan, this.testClass); } + @SuppressWarnings("deprecation") private LauncherDiscoveryRequest createDiscoveryRequest() { SuiteLauncherDiscoveryRequestBuilder requestBuilder = request(); // Allows @RunWith(JUnitPlatform.class) to be added to any test case diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java index 532f2679a0b3..d8c6014eadd7 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java @@ -96,6 +96,7 @@ void fromJupiterEngineDescriptor() { } @Test + @SuppressWarnings("resource") void fromClassTestDescriptor() { NestedClassTestDescriptor nestedClassDescriptor = nestedClassDescriptor(); ClassTestDescriptor outerClassDescriptor = outerClassDescriptor(nestedClassDescriptor); @@ -124,6 +125,7 @@ void fromClassTestDescriptor() { } @Test + @SuppressWarnings("resource") void tagsCanBeRetrievedInExtensionContext() { NestedClassTestDescriptor nestedClassDescriptor = nestedClassDescriptor(); ClassTestDescriptor outerClassDescriptor = outerClassDescriptor(nestedClassDescriptor); @@ -149,6 +151,7 @@ void tagsCanBeRetrievedInExtensionContext() { } @Test + @SuppressWarnings("resource") void fromMethodTestDescriptor() { TestMethodTestDescriptor methodTestDescriptor = methodDescriptor(); ClassTestDescriptor classTestDescriptor = outerClassDescriptor(methodTestDescriptor); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/AutoCloseTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/AutoCloseTests.java index 1b4c4c5bf17c..7677923d6122 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/AutoCloseTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/AutoCloseTests.java @@ -109,6 +109,7 @@ void noShutdownMethod() { */ @Test void spyPermitsOnlyASingleAction() { + @SuppressWarnings("resource") AutoCloseSpy spy = new AutoCloseSpy("preconditions"); spy.close(); From 2ee1fcb36bd7093f40c85d721191d8ab453d9496 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Sun, 20 Oct 2024 16:23:39 +0200 Subject: [PATCH 201/611] Work around Eclipse compiler error regarding type inference in Stream APIs --- .../launcher/core/LauncherDiscoveryRequestBuilderTests.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilderTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilderTests.java index fcd7345b227f..1e7da55eecc9 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilderTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilderTests.java @@ -92,8 +92,9 @@ void classesAreStoredInDiscoveryRequest() { .build(); // @formatter:on - List> classes = discoveryRequest.getSelectorsByType(ClassSelector.class).stream().map( - ClassSelector::getJavaClass).toList(); + @SuppressWarnings("rawtypes") + List classes = discoveryRequest.getSelectorsByType(ClassSelector.class).stream()// + .map(ClassSelector::getJavaClass).map(Class.class::cast).toList(); assertThat(classes).contains(SampleTestClass.class, LauncherDiscoveryRequestBuilderTests.class); } From c38e707bca35bdc186ee9c5bc7bffa568fee85e9 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 21 Oct 2024 09:19:20 +0200 Subject: [PATCH 202/611] Enable PTS' remaining tests mode and code coverage merging on CI --- .github/actions/run-gradle/action.yml | 3 ++- gradle/plugins/build-parameters/build.gradle.kts | 5 +++++ .../main/kotlin/junitbuild.testing-conventions.gradle.kts | 7 +++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/actions/run-gradle/action.yml b/.github/actions/run-gradle/action.yml index eb62935c74aa..c372e545c648 100644 --- a/.github/actions/run-gradle/action.yml +++ b/.github/actions/run-gradle/action.yml @@ -21,7 +21,8 @@ runs: run: | ./gradlew \ -Porg.gradle.java.installations.auto-download=false \ - -Pjunit.develocity.predictiveTestSelection.enabled=${{ github.event_name == 'pull_request' }} \ + -Pjunit.develocity.predictiveTestSelection.enabled=true \ + -Pjunit.develocity.predictiveTestSelection.selectRemainingTests=${{ github.event_name != 'pull_request' }} \ "-Dscan.value.GitHub job=${{ github.job }}" \ javaToolchains \ ${{ inputs.arguments }} diff --git a/gradle/plugins/build-parameters/build.gradle.kts b/gradle/plugins/build-parameters/build.gradle.kts index c9c2fa31ff0a..98b793a794d4 100644 --- a/gradle/plugins/build-parameters/build.gradle.kts +++ b/gradle/plugins/build-parameters/build.gradle.kts @@ -41,6 +41,11 @@ buildParameters { description = "Whether or not to use Predictive Test Selection for selecting tests to execute" defaultValue = true } + bool("selectRemainingTests") { + // see https://docs.gradle.com/develocity/predictive-test-selection/#gradle-selection-mode + description = "Whether or not to use PTS' 'remaining tests' selection mode" + defaultValue = false + } } group("testDistribution") { bool("enabled") { diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts index 23a24ae2c5ee..0048f12f7b21 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts @@ -1,4 +1,5 @@ import com.gradle.develocity.agent.gradle.internal.test.PredictiveTestSelectionConfigurationInternal +import com.gradle.develocity.agent.gradle.test.PredictiveTestSelectionMode import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL import org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED import org.gradle.internal.os.OperatingSystem @@ -36,9 +37,15 @@ tasks.withType().configureEach { predictiveTestSelection { enabled = buildParameters.junit.develocity.predictiveTestSelection.enabled + if (buildParameters.junit.develocity.predictiveTestSelection.selectRemainingTests) { + mode = PredictiveTestSelectionMode.REMAINING_TESTS + } + // Ensure PTS works when publishing Build Scans to scans.gradle.com this as PredictiveTestSelectionConfigurationInternal server = uri("https://ge.junit.org") + + mergeCodeCoverage = true } } systemProperty("java.util.logging.manager", "org.apache.logging.log4j.jul.LogManager") From bd46bf8045e7df97e241611329842e8190d1fbda Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 21 Oct 2024 07:20:26 +0000 Subject: [PATCH 203/611] Update dependency org.asciidoctor:asciidoctorj-pdf to v2.3.19 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4b606686be39..fac8a25c44d1 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] ant = "1.10.15" apiguardian = "1.1.2" -asciidoctorj-pdf = "2.3.18" +asciidoctorj-pdf = "2.3.19" asciidoctor-plugins = "4.0.3" # Check if workaround in documentation.gradle.kts can be removed when upgrading assertj = "3.26.3" bnd = "7.0.0" From a4f4f1e5924715f102937a47bb9adcbf69ff1def Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 21 Oct 2024 14:55:54 +0200 Subject: [PATCH 204/611] Allow repeating `ExtendWith` annotation on fields and parameters Fixes #4059. --- .../release-notes/release-notes-5.11.3.adoc | 3 +- .../jupiter/api/extension/Extensions.java | 2 +- ...gistrationViaParametersAndFieldsTests.java | 41 ++++++++++++++++--- .../tooling/support/tests/ArchUnitTests.java | 3 -- 4 files changed, 39 insertions(+), 10 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc index 55fcc69e76fd..d364b73b4739 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc @@ -38,10 +38,11 @@ on GitHub. * Extensions can once again be registered via multiple `@ExtendWith` meta-annotations on the same composed annotation on a field within a test class. +* `@ExtendWith` annotations can now also be repeated when used directly on fields and + parameters. * All `@...Source` annotations of parameterized tests can now also be repeated when used as meta annotations. - [[release-notes-5.11.3-junit-jupiter-deprecations-and-breaking-changes]] ==== Deprecations and Breaking Changes diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extensions.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extensions.java index 652c606d63cb..3607def6d0aa 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extensions.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extensions.java @@ -33,7 +33,7 @@ * @see ExtendWith * @see java.lang.annotation.Repeatable */ -@Target({ ElementType.TYPE, ElementType.METHOD }) +@Target({ ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER }) @Retention(RetentionPolicy.RUNTIME) @Documented @Inherited diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistrationViaParametersAndFieldsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistrationViaParametersAndFieldsTests.java index 9e934c3a9875..a9f04addddd6 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistrationViaParametersAndFieldsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistrationViaParametersAndFieldsTests.java @@ -132,6 +132,12 @@ void testTemplateMethodParameter() { assertTestsSucceeded(TestTemplateMethodParameterTestCase.class, 2); } + @Test + void multipleRegistrationsViaParameter(@TrackLogRecords LogRecordListener listener) { + assertOneTestSucceeded(MultipleRegistrationsViaParameterTestCase.class); + assertThat(getRegisteredLocalExtensions(listener)).containsExactly("LongParameterResolver", "DummyExtension"); + } + @Test void staticField() { assertOneTestSucceeded(StaticFieldTestCase.class); @@ -147,9 +153,11 @@ void fieldsWithTestInstancePerClass() { assertOneTestSucceeded(TestInstancePerClassFieldTestCase.class); } - @Test - void multipleRegistrationsViaField(@TrackLogRecords LogRecordListener listener) { - assertOneTestSucceeded(MultipleRegistrationsViaFieldTestCase.class); + @ParameterizedTest + @ValueSource(classes = { MultipleMixedRegistrationsViaFieldTestCase.class, + MultipleExtendWithRegistrationsViaFieldTestCase.class }) + void multipleRegistrationsViaField(Class testClass, @TrackLogRecords LogRecordListener listener) { + assertOneTestSucceeded(testClass); assertThat(getRegisteredLocalExtensions(listener)).containsExactly("LongParameterResolver", "DummyExtension"); } @@ -567,14 +575,37 @@ private static TestTemplateInvocationContext emptyTestTemplateInvocationContext( } } - static class MultipleRegistrationsViaFieldTestCase { + @ExtendWith(LongParameterResolver.class) + static class MultipleRegistrationsViaParameterTestCase { + + @Test + void test(@ExtendWith(DummyExtension.class) @ExtendWith(LongParameterResolver.class) Long number) { + assertThat(number).isEqualTo(42L); + } + } + + static class MultipleMixedRegistrationsViaFieldTestCase { @ExtendWith(LongParameterResolver.class) @RegisterExtension DummyExtension dummy = new DummyExtension(); @Test - void test() { + void test(Long number) { + assertThat(number).isEqualTo(42L); + } + } + + static class MultipleExtendWithRegistrationsViaFieldTestCase { + + @SuppressWarnings("unused") + @ExtendWith(LongParameterResolver.class) + @ExtendWith(DummyExtension.class) + Object field; + + @Test + void test(Long number) { + assertThat(number).isEqualTo(42L); } } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java index 3091293004dd..1ecbc4764582 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java @@ -17,7 +17,6 @@ import static com.tngtech.archunit.core.domain.JavaClass.Predicates.resideInAPackage; import static com.tngtech.archunit.core.domain.JavaClass.Predicates.resideInAnyPackage; import static com.tngtech.archunit.core.domain.JavaClass.Predicates.simpleName; -import static com.tngtech.archunit.core.domain.JavaClass.Predicates.type; import static com.tngtech.archunit.core.domain.JavaModifier.PUBLIC; import static com.tngtech.archunit.core.domain.properties.HasModifiers.Predicates.modifier; import static com.tngtech.archunit.core.domain.properties.HasName.Predicates.name; @@ -51,7 +50,6 @@ import com.tngtech.archunit.library.GeneralCodingRules; import org.apiguardian.api.API; -import org.junit.jupiter.api.extension.ExtendWith; @AnalyzeClasses(locations = ArchUnitTests.AllJars.class) class ArchUnitTests { @@ -72,7 +70,6 @@ class ArchUnitTests { .that(nameStartingWith("org.junit.")) // .and().areAnnotations() // .and().areAnnotatedWith(Repeatable.class) // - .and(are(not(type(ExtendWith.class)))) // to be resolved in https://github.com/junit-team/junit5/issues/4059 .should(haveContainerAnnotationWithSameRetentionPolicy()) // .andShould(haveContainerAnnotationWithSameTargetTypes()); From b6546cd9943c20cdf366dc915207c7134b0edf93 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 21 Oct 2024 15:34:51 +0200 Subject: [PATCH 205/611] Finalize 5.11.3 release notes --- .../release-notes/release-notes-5.11.3.adoc | 37 +------------------ 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc index d364b73b4739..0588af0f1cc7 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.3.adoc @@ -1,7 +1,7 @@ [[release-notes-5.11.3]] == 5.11.3 -*Date of Release:* ❓ +*Date of Release:* October 21, 2024 *Scope:* Bug fixes and enhancements since 5.11.2 @@ -19,16 +19,6 @@ on GitHub. * Fixed a regression in method search algorithms introduced in 5.11.0 when classes reside in the default package and using a Java 8 runtime. -[[release-notes-5.11.3-junit-platform-deprecations-and-breaking-changes]] -==== Deprecations and Breaking Changes - -* ❓ - -[[release-notes-5.11.3-junit-platform-new-features-and-improvements]] -==== New Features and Improvements - -* ❓ - [[release-notes-5.11.3-junit-jupiter]] === JUnit Jupiter @@ -43,31 +33,8 @@ on GitHub. * All `@...Source` annotations of parameterized tests can now also be repeated when used as meta annotations. -[[release-notes-5.11.3-junit-jupiter-deprecations-and-breaking-changes]] -==== Deprecations and Breaking Changes - -* ❓ - -[[release-notes-5.11.3-junit-jupiter-new-features-and-improvements]] -==== New Features and Improvements - -* ❓ - [[release-notes-5.11.3-junit-vintage]] === JUnit Vintage -[[release-notes-5.11.3-junit-vintage-bug-fixes]] -==== Bug Fixes - -* ❓ - -[[release-notes-5.11.3-junit-vintage-deprecations-and-breaking-changes]] -==== Deprecations and Breaking Changes - -* ❓ - -[[release-notes-5.11.3-junit-vintage-new-features-and-improvements]] -==== New Features and Improvements - -* ❓ +No changes. From 906a73978f16c19f066cd86def127f1c4d8890c7 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 21 Oct 2024 15:47:18 +0200 Subject: [PATCH 206/611] Release 5.11.3 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 114ce9957fc2..42d127a29ca9 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This repository is the home of _JUnit 5_. ## Latest Releases -- General Availability (GA): [JUnit 5.11.2](https://github.com/junit-team/junit5/releases/tag/r5.11.2) (October 4, 2024) +- General Availability (GA): [JUnit 5.11.3](https://github.com/junit-team/junit5/releases/tag/r5.11.3) (October 21, 2024) - Preview (Milestone/Release Candidate): N/A ## Documentation From 9ca7c42e6dfd44293b0b2469635233306c497257 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 22 Oct 2024 15:43:33 +0200 Subject: [PATCH 207/611] Rename license file to the liking of OpenSSF Scorecard check --- LICENSE.md => LICENSE-EPL-2.0.md | 0 .../junitbuild.java-library-conventions.gradle.kts | 9 ++++++++- 2 files changed, 8 insertions(+), 1 deletion(-) rename LICENSE.md => LICENSE-EPL-2.0.md (100%) diff --git a/LICENSE.md b/LICENSE-EPL-2.0.md similarity index 100% rename from LICENSE.md rename to LICENSE-EPL-2.0.md diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts index d3c195c735c1..d544b2e41c94 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts @@ -204,7 +204,14 @@ val compileModule by tasks.registering(JavaCompile::class) { tasks.withType().configureEach { from(rootDir) { - include("LICENSE.md", "LICENSE-notice.md") + include("LICENSE-EPL-2.0.md") + rename { + "LICENSE.md" + } + into("META-INF") + } + from(rootDir) { + include("LICENSE-notice.md") into("META-INF") } val suffix = archiveClassifier.getOrElse("") From a0b97f7a925f5de6a54e0e96f198d2094ab25a08 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 22 Oct 2024 15:53:40 +0200 Subject: [PATCH 208/611] Rename LICENSE-notice.md to avoid confusing OpenSSF Scorecard tool --- .../kotlin/junitbuild.java-library-conventions.gradle.kts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts index d544b2e41c94..7f4b1b5cd2c4 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts @@ -211,7 +211,10 @@ tasks.withType().configureEach { into("META-INF") } from(rootDir) { - include("LICENSE-notice.md") + include("NOTICE.md") + rename { + "LICENSE-notice.md" + } into("META-INF") } val suffix = archiveClassifier.getOrElse("") From 370bc2543cef98e6dd406b1d0b126cf1f7e0fb53 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 22 Oct 2024 15:55:48 +0200 Subject: [PATCH 209/611] Rename to avoid confusing tools --- LICENSE-notice.md => NOTICE.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename LICENSE-notice.md => NOTICE.md (100%) diff --git a/LICENSE-notice.md b/NOTICE.md similarity index 100% rename from LICENSE-notice.md rename to NOTICE.md From 6b847df74c9ae1028cdd21a73347b1121efebd0f Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 22 Oct 2024 15:56:58 +0200 Subject: [PATCH 210/611] Revert "Rename license file to the liking of OpenSSF Scorecard check" This reverts commit 9ca7c42e --- LICENSE-EPL-2.0.md => LICENSE.md | 0 ...tbuild.java-library-conventions.gradle.kts | 25 ++++++++----------- 2 files changed, 11 insertions(+), 14 deletions(-) rename LICENSE-EPL-2.0.md => LICENSE.md (100%) diff --git a/LICENSE-EPL-2.0.md b/LICENSE.md similarity index 100% rename from LICENSE-EPL-2.0.md rename to LICENSE.md diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts index 7f4b1b5cd2c4..0cf91dbc3c75 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts @@ -203,20 +203,17 @@ val compileModule by tasks.registering(JavaCompile::class) { } tasks.withType().configureEach { - from(rootDir) { - include("LICENSE-EPL-2.0.md") - rename { - "LICENSE.md" - } - into("META-INF") - } - from(rootDir) { - include("NOTICE.md") - rename { - "LICENSE-notice.md" - } - into("META-INF") - } + from(rootDir) { + include("LICENSE.md") + into("META-INF") + } + from(rootDir) { + include("NOTICE.md") + rename { + "LICENSE-notice.md" + } + into("META-INF") + } val suffix = archiveClassifier.getOrElse("") if (suffix.isBlank() || this is ShadowJar) { dependsOn(allMainClasses, compileModule) From 298db46e2bdeee6bfcf16c85559871f67011d737 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 22 Oct 2024 16:42:06 +0200 Subject: [PATCH 211/611] Explicitly set top-level permissions to read-all --- .github/workflows/close-inactive-issues.yml | 1 + .github/workflows/codeql-analysis.yml | 2 ++ .github/workflows/cross-version.yml | 2 ++ .github/workflows/gradle-dependency-submission.yml | 5 +++-- .github/workflows/label-opened-issues.yml | 1 + .github/workflows/main.yml | 2 ++ .github/workflows/reproducible-build.yml | 2 ++ .github/workflows/unlabel-closed-issues.yml | 1 + 8 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/close-inactive-issues.yml b/.github/workflows/close-inactive-issues.yml index 687cfcdc4f19..5952a1e8c3aa 100644 --- a/.github/workflows/close-inactive-issues.yml +++ b/.github/workflows/close-inactive-issues.yml @@ -3,6 +3,7 @@ on: schedule: - cron: "30 1 * * *" workflow_dispatch: +permissions: read-all jobs: close-issues: runs-on: ubuntu-latest diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 923e144c477e..c0ff1573222d 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -13,6 +13,8 @@ on: schedule: - cron: '0 19 * * 3' +permissions: read-all + env: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} diff --git a/.github/workflows/cross-version.yml b/.github/workflows/cross-version.yml index 42c53a7c5a58..972c57772104 100644 --- a/.github/workflows/cross-version.yml +++ b/.github/workflows/cross-version.yml @@ -11,6 +11,8 @@ on: branches: - '*' +permissions: read-all + env: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} diff --git a/.github/workflows/gradle-dependency-submission.yml b/.github/workflows/gradle-dependency-submission.yml index 7c4bffef974f..16b65448d8a7 100644 --- a/.github/workflows/gradle-dependency-submission.yml +++ b/.github/workflows/gradle-dependency-submission.yml @@ -5,13 +5,14 @@ on: branches: - main -permissions: - contents: write +permissions: read-all jobs: dependency-submission: if: github.repository == 'junit-team/junit5' runs-on: ubuntu-latest + permissions: + contents: write steps: - name: Check out repository uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 diff --git a/.github/workflows/label-opened-issues.yml b/.github/workflows/label-opened-issues.yml index 855292615813..bbf37c72db6e 100644 --- a/.github/workflows/label-opened-issues.yml +++ b/.github/workflows/label-opened-issues.yml @@ -3,6 +3,7 @@ on: issues: types: - opened +permissions: read-all jobs: label_issues: runs-on: ubuntu-latest diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5c4cfa1e15f5..64bf607bcfbd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,6 +9,8 @@ on: branches: - '*' +permissions: read-all + env: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} diff --git a/.github/workflows/reproducible-build.yml b/.github/workflows/reproducible-build.yml index 0d432f693b6d..f440c20f5f76 100644 --- a/.github/workflows/reproducible-build.yml +++ b/.github/workflows/reproducible-build.yml @@ -9,6 +9,8 @@ on: branches: - '*' +permissions: read-all + env: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} diff --git a/.github/workflows/unlabel-closed-issues.yml b/.github/workflows/unlabel-closed-issues.yml index c48b1db534d5..00a4aa525f9c 100644 --- a/.github/workflows/unlabel-closed-issues.yml +++ b/.github/workflows/unlabel-closed-issues.yml @@ -3,6 +3,7 @@ on: issues: types: - closed +permissions: read-all jobs: label_issues: runs-on: ubuntu-latest From 4684bd40589196ecbf7f8f3eb89c77eb76b262d9 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 22 Oct 2024 16:44:11 +0200 Subject: [PATCH 212/611] Fix formatting --- ...tbuild.java-library-conventions.gradle.kts | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts index 0cf91dbc3c75..1865609af928 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts @@ -203,17 +203,17 @@ val compileModule by tasks.registering(JavaCompile::class) { } tasks.withType().configureEach { - from(rootDir) { - include("LICENSE.md") - into("META-INF") - } - from(rootDir) { - include("NOTICE.md") - rename { - "LICENSE-notice.md" - } - into("META-INF") - } + from(rootDir) { + include("LICENSE.md") + into("META-INF") + } + from(rootDir) { + include("NOTICE.md") + rename { + "LICENSE-notice.md" + } + into("META-INF") + } val suffix = archiveClassifier.getOrElse("") if (suffix.isBlank() || this is ShadowJar) { dependsOn(allMainClasses, compileModule) From d47911716b8106085724cd2d1b117cd5b5d10c1c Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 22 Oct 2024 19:10:25 +0200 Subject: [PATCH 213/611] Add workflow to run OpenSSF scorecard checks --- .github/workflows/ossf-scorecard.yml | 62 ++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/ossf-scorecard.yml diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml new file mode 100644 index 000000000000..92d30d0a0d4e --- /dev/null +++ b/.github/workflows/ossf-scorecard.yml @@ -0,0 +1,62 @@ +name: OpenSSF Scorecard supply-chain security analysis + +on: + branch_protection_rule: + schedule: + - cron: '31 20 * * 6' + push: + branches: [ "main" ] + +permissions: read-all + +jobs: + analysis: + name: Scorecard analysis + runs-on: ubuntu-latest + permissions: + # Needed to upload the results to code-scanning dashboard. + security-events: write + # Needed to publish results and get a badge (see publish_results below). + id-token: write + + steps: + - name: "Checkout code" + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + persist-credentials: false + + - name: "Run analysis" + uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1 + with: + results_file: results.sarif + results_format: sarif + # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: + # - you want to enable the Branch-Protection check on a *public* repository, or + # - you are installing Scorecard on a *private* repository + # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action?tab=readme-ov-file#authentication-with-fine-grained-pat-optional. + # repo_token: ${{ secrets.SCORECARD_TOKEN }} + + # Public repositories: + # - Publish results to OpenSSF REST API for easy access by consumers + # - Allows the repository to include the Scorecard badge. + # - See https://github.com/ossf/scorecard-action#publishing-results. + # For private repositories: + # - `publish_results` will always be set to `false`, regardless + # of the value entered here. + publish_results: true + + # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF + # format to the repository Actions tab. + - name: "Upload artifact" + uses: actions/upload-artifact@97a0fba1372883ab732affbe8f94b823f91727db # v3.pre.node20 + with: + name: SARIF file + path: results.sarif + retention-days: 5 + + # Upload the results to GitHub's code scanning dashboard (optional). + # Commenting out will disable upload of results to your repo's Code Scanning dashboard + - name: "Upload to code-scanning" + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: results.sarif From c8a6b46003a61a1ae78ce0a2d881d7b193efc133 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 22 Oct 2024 17:11:44 +0000 Subject: [PATCH 214/611] Pin github/codeql-action action to 6624720 --- .github/workflows/ossf-scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index 92d30d0a0d4e..8bfe47499489 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard (optional). # Commenting out will disable upload of results to your repo's Code Scanning dashboard - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@v3 + uses: github/codeql-action/upload-sarif@662472033e021d55d94146f66f6058822b0b39fd # v3 with: sarif_file: results.sarif From 33af5e4bd33a45d47ef04fd575caf51fd2aa30c4 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 22 Oct 2024 13:13:24 +0200 Subject: [PATCH 215/611] Document that assertions and exceptions take precedence over assumptions Resolves #4084. --- .../src/main/java/org/junit/jupiter/api/Assumptions.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Assumptions.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Assumptions.java index f1ade0746475..68b0b66ac62f 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Assumptions.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Assumptions.java @@ -27,7 +27,12 @@ * *

    In direct contrast to failed {@linkplain Assertions assertions}, * failed assumptions do not result in a test failure; rather, - * a failed assumption results in a test being aborted. + * a failed assumption results in a test being aborted. However, + * failed assertions and other exceptions thrown by tests take precedence over + * failed assumptions when both are thrown during the execution of a test + * (for example, by different lifecycle methods), regardless of the order they + * are thrown in. In such cases, the test will be reported as failed + * rather than aborted. * *

    Assumptions are typically used whenever it does not make sense to * continue execution of a given test method — for example, if the From b42c5acc8a591a236f0e1e4af1467e5f5fe79157 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 22 Oct 2024 17:19:29 +0000 Subject: [PATCH 216/611] Update github/codeql-action digest to 6624720 --- .github/workflows/codeql-analysis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index c0ff1573222d..344f848c2a9f 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -34,7 +34,7 @@ jobs: - name: Check out repository uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 - name: Initialize CodeQL - uses: github/codeql-action/init@f779452ac5af1c261dce0346a8f964149f49322b # v3 + uses: github/codeql-action/init@662472033e021d55d94146f66f6058822b0b39fd # v3 with: languages: ${{ matrix.language }} tools: linked @@ -46,4 +46,4 @@ jobs: -Dscan.tag.CodeQL \ allMainClasses - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@f779452ac5af1c261dce0346a8f964149f49322b # v3 + uses: github/codeql-action/analyze@662472033e021d55d94146f66f6058822b0b39fd # v3 From b96a5434ae95751a1b940be1455496b06b61679b Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 23 Oct 2024 09:17:41 +0200 Subject: [PATCH 217/611] Add OpenSSF badges --- SECURITY.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SECURITY.md b/SECURITY.md index 0593bdb0acbc..cfc671796fa4 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,5 +1,7 @@ # Security Policy +[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/9607/badge)](https://www.bestpractices.dev/projects/9607) [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/junit-team/junit5/badge)](https://scorecard.dev/viewer/?uri=github.com/{owner}/{repo}) + ## Supported Versions | Version | Supported | From 3f0ce42267988b5b1bf3dfa7684a9c3019d79b84 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 23 Oct 2024 09:18:11 +0200 Subject: [PATCH 218/611] Fix link --- SECURITY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SECURITY.md b/SECURITY.md index cfc671796fa4..495f7c24ee00 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,6 +1,6 @@ # Security Policy -[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/9607/badge)](https://www.bestpractices.dev/projects/9607) [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/junit-team/junit5/badge)](https://scorecard.dev/viewer/?uri=github.com/{owner}/{repo}) +[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/9607/badge)](https://www.bestpractices.dev/projects/9607) [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/junit-team/junit5/badge)](https://scorecard.dev/viewer/?uri=github.com/junit-team/junit5) ## Supported Versions From fe3d61d7fb5b745792ad9ee85212694cbde50705 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 23 Oct 2024 10:07:05 +0200 Subject: [PATCH 219/611] Add reference to OpenPGP key --- SECURITY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SECURITY.md b/SECURITY.md index 495f7c24ee00..566ad1ebb323 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -11,4 +11,4 @@ ## Reporting a Vulnerability -To report a security vulnerability, please send an email to security@junit.org. +To report a security vulnerability, please send an email to security@junit.org. You can use the [published OpenPGP key](https://keys.openpgp.org/search?q=security%40junit.org) with fingerprint `0152DA30EABC7ABADCB09D10D9A6B1329D191D25` to encrypt the message body. From 50a699ffdcc3297810f8ef0e368492ade9ce74ab Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 22 Oct 2024 21:01:33 +0000 Subject: [PATCH 220/611] Update actions/upload-artifact action to v4 --- .github/workflows/ossf-scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index 8bfe47499489..1f814cf458d1 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -48,7 +48,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@97a0fba1372883ab732affbe8f94b823f91727db # v3.pre.node20 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.pre.node20 with: name: SARIF file path: results.sarif From effe50df3b4a16a18de9e19c3ea32d63a857f9da Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 22 Oct 2024 20:03:46 +0000 Subject: [PATCH 221/611] Update actions/checkout action to v4.2.1 --- .github/workflows/ossf-scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index 1f814cf458d1..a7b8ec1e14c8 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -21,7 +21,7 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 with: persist-credentials: false From 750243a7e5795b562ed10840468a3c6feb770fcd Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 22 Oct 2024 21:01:27 +0000 Subject: [PATCH 222/611] Update ossf/scorecard-action action to v2.4.0 --- .github/workflows/ossf-scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index a7b8ec1e14c8..a6e5720f9be4 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -26,7 +26,7 @@ jobs: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1 + uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0 with: results_file: results.sarif results_format: sarif From f37db9243750d10448ff02df314766e0efa9d72f Mon Sep 17 00:00:00 2001 From: Juliette de Rancourt Date: Wed, 23 Oct 2024 16:03:10 +0200 Subject: [PATCH 223/611] Add support for passing line and column number to ConsoleLauncher via `--select-file` and `--select-resource` (#4044) Resolves #3483 --- .../release-notes/release-notes-5.12.0-M1.adoc | 2 ++ .../platform/commons/util}/ResourceUtils.java | 16 ++++++++++------ .../console/options/SelectorConverter.java | 15 +++++++++++++-- .../options/TestDiscoveryOptionsMixin.java | 10 ++++++++-- .../descriptor/ClasspathResourceSource.java | 1 + .../engine/support/descriptor/UriSource.java | 1 + .../options/CommandLineOptionsParsingTests.java | 9 +++++++-- 7 files changed, 42 insertions(+), 12 deletions(-) rename {junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor => junit-platform-commons/src/main/java/org/junit/platform/commons/util}/ResourceUtils.java (74%) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 5f8f864a4a6b..c9a3569af431 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -31,6 +31,8 @@ JUnit repository on GitHub. calling the internal `ReflectionUtils.makeAccessible(Field)` method directly. * Support both the primitive type `void` and the wrapper type `Void` in the internal `ReflectionUtils` to allow `String` to `Class` conversion in parameterized tests. +* Add support for passing line and column number to `ConsoleLauncher` via + `--select-file` and `--select-resource`. [[release-notes-5.12.0-M1-junit-jupiter]] diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/ResourceUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ResourceUtils.java similarity index 74% rename from junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/ResourceUtils.java rename to junit-platform-commons/src/main/java/org/junit/platform/commons/util/ResourceUtils.java index b61598d59b8e..fd6b78e3223e 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/ResourceUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ResourceUtils.java @@ -8,19 +8,21 @@ * https://www.eclipse.org/legal/epl-v20.html */ -package org.junit.platform.engine.support.descriptor; +package org.junit.platform.commons.util; + +import static org.apiguardian.api.API.Status.INTERNAL; import java.net.URI; -import org.junit.platform.commons.util.Preconditions; -import org.junit.platform.commons.util.StringUtils; +import org.apiguardian.api.API; /** * Collection of static utility methods for working with resources. * - * @since 1.3 + * @since 1.3 (originally in org.junit.platform.engine.support.descriptor) */ -final class ResourceUtils { +@API(status = INTERNAL, since = "1.12") +public final class ResourceUtils { private ResourceUtils() { /* no-op */ @@ -33,8 +35,10 @@ private ResourceUtils() { * @param uri the {@code URI} from which to strip the query component * @return a new {@code URI} with the query component removed, or the * original {@code URI} unmodified if it does not have a query component + * + * @since 1.3 */ - static URI stripQueryComponent(URI uri) { + public static URI stripQueryComponent(URI uri) { Preconditions.notNull(uri, "URI must not be null"); if (StringUtils.isBlank(uri.getQuery())) { diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/SelectorConverter.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/SelectorConverter.java index 7c18320eba67..6f1803185706 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/SelectorConverter.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/SelectorConverter.java @@ -19,12 +19,16 @@ import static org.junit.platform.engine.discovery.DiscoverySelectors.selectPackage; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectUri; +import java.net.URI; + import org.junit.platform.commons.PreconditionViolationException; +import org.junit.platform.commons.util.ResourceUtils; import org.junit.platform.engine.DiscoverySelectorIdentifier; import org.junit.platform.engine.discovery.ClassSelector; import org.junit.platform.engine.discovery.ClasspathResourceSelector; import org.junit.platform.engine.discovery.DirectorySelector; import org.junit.platform.engine.discovery.DiscoverySelectors; +import org.junit.platform.engine.discovery.FilePosition; import org.junit.platform.engine.discovery.FileSelector; import org.junit.platform.engine.discovery.IterationSelector; import org.junit.platform.engine.discovery.MethodSelector; @@ -53,8 +57,12 @@ public UriSelector convert(String value) { static class File implements ITypeConverter { @Override public FileSelector convert(String value) { - return selectFile(value); + URI uri = URI.create(value); + String path = ResourceUtils.stripQueryComponent(uri).getPath(); + FilePosition filePosition = FilePosition.fromQuery(uri.getQuery()).orElse(null); + return selectFile(path, filePosition); } + } static class Directory implements ITypeConverter { @@ -88,7 +96,10 @@ public MethodSelector convert(String value) { static class ClasspathResource implements ITypeConverter { @Override public ClasspathResourceSelector convert(String value) { - return selectClasspathResource(value); + URI uri = URI.create(value); + String path = ResourceUtils.stripQueryComponent(uri).getPath(); + FilePosition filePosition = FilePosition.fromQuery(uri.getQuery()).orElse(null); + return selectClasspathResource(path, filePosition); } } diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptionsMixin.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptionsMixin.java index d71b1f0a6e2f..46298abb9d11 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptionsMixin.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptionsMixin.java @@ -76,7 +76,10 @@ static class SelectorOptions { private final List selectedUris2 = new ArrayList<>(); @Option(names = { "-f", - "--select-file" }, paramLabel = "FILE", arity = "1", converter = SelectorConverter.File.class, description = "Select a file for test discovery. This option can be repeated.") + "--select-file" }, paramLabel = "FILE", arity = "1", converter = SelectorConverter.File.class, // + description = "Select a file for test discovery. " + + "The line and column numbers can be provided as URI query parameters (e.g. foo.txt?line=12&column=34). " + + "This option can be repeated.") private final List selectedFiles = new ArrayList<>(); @Option(names = { "--f", "-select-file" }, arity = "1", hidden = true, converter = SelectorConverter.File.class) @@ -123,7 +126,10 @@ static class SelectorOptions { private final List selectedMethods2 = new ArrayList<>(); @Option(names = { "-r", - "--select-resource" }, paramLabel = "RESOURCE", arity = "1", converter = SelectorConverter.ClasspathResource.class, description = "Select a classpath resource for test discovery. This option can be repeated.") + "--select-resource" }, paramLabel = "RESOURCE", arity = "1", converter = SelectorConverter.ClasspathResource.class, // + description = "Select a classpath resource for test discovery. " + + "The line and column numbers can be provided as URI query parameters (e.g. foo.csv?line=12&column=34). " + + "This option can be repeated.") private final List selectedClasspathResources = new ArrayList<>(); @Option(names = { "--r", diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/ClasspathResourceSource.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/ClasspathResourceSource.java index 595dd33cd307..e326a3343a58 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/ClasspathResourceSource.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/ClasspathResourceSource.java @@ -19,6 +19,7 @@ import org.apiguardian.api.API; import org.junit.platform.commons.PreconditionViolationException; import org.junit.platform.commons.util.Preconditions; +import org.junit.platform.commons.util.ResourceUtils; import org.junit.platform.commons.util.ToStringBuilder; import org.junit.platform.engine.TestSource; diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/UriSource.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/UriSource.java index bd97bbe609e1..fef3e61b5db7 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/UriSource.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/UriSource.java @@ -20,6 +20,7 @@ import org.apiguardian.api.API; import org.junit.platform.commons.logging.LoggerFactory; import org.junit.platform.commons.util.Preconditions; +import org.junit.platform.commons.util.ResourceUtils; import org.junit.platform.engine.TestSource; /** diff --git a/platform-tests/src/test/java/org/junit/platform/console/options/CommandLineOptionsParsingTests.java b/platform-tests/src/test/java/org/junit/platform/console/options/CommandLineOptionsParsingTests.java index 3b9b10935c9f..acb491afa48f 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/options/CommandLineOptionsParsingTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/options/CommandLineOptionsParsingTests.java @@ -44,6 +44,7 @@ import org.junit.jupiter.params.provider.EnumSource; import org.junit.platform.engine.DiscoverySelector; import org.junit.platform.engine.discovery.DiscoverySelectors; +import org.junit.platform.engine.discovery.FilePosition; /** * @since 1.10 @@ -382,7 +383,9 @@ void parseValidFileSelectors(ArgsType type) { () -> assertEquals(List.of(selectFile("foo.txt")), type.parseArgLine("-select-file=foo.txt").discovery.getSelectedFiles()), () -> assertEquals(List.of(selectFile("foo.txt")), type.parseArgLine("--select-file foo.txt").discovery.getSelectedFiles()), () -> assertEquals(List.of(selectFile("foo.txt")), type.parseArgLine("--select-file=foo.txt").discovery.getSelectedFiles()), - () -> assertEquals(List.of(selectFile("foo.txt"), selectFile("bar.csv")), type.parseArgLine("-f foo.txt -f bar.csv").discovery.getSelectedFiles()) + () -> assertEquals(List.of(selectFile("foo.txt"), selectFile("bar.csv")), type.parseArgLine("-f foo.txt -f bar.csv").discovery.getSelectedFiles()), + () -> assertEquals(List.of(selectFile("foo.txt", FilePosition.from(5))), type.parseArgLine("-f foo.txt?line=5").discovery.getSelectedFiles()), + () -> assertEquals(List.of(selectFile("foo.txt", FilePosition.from(12, 34))), type.parseArgLine("-f foo.txt?line=12&column=34").discovery.getSelectedFiles()) ); // @formatter:on } @@ -509,7 +512,9 @@ void parseValidClasspathResourceSelectors(ArgsType type) { () -> assertEquals(List.of(selectClasspathResource("/foo.csv")), type.parseArgLine("-select-resource=/foo.csv").discovery.getSelectedClasspathResources()), () -> assertEquals(List.of(selectClasspathResource("/foo.csv")), type.parseArgLine("--select-resource /foo.csv").discovery.getSelectedClasspathResources()), () -> assertEquals(List.of(selectClasspathResource("/foo.csv")), type.parseArgLine("--select-resource=/foo.csv").discovery.getSelectedClasspathResources()), - () -> assertEquals(List.of(selectClasspathResource("/foo.csv"), selectClasspathResource("bar.json")), type.parseArgLine("-r /foo.csv -r bar.json").discovery.getSelectedClasspathResources()) + () -> assertEquals(List.of(selectClasspathResource("/foo.csv"), selectClasspathResource("bar.json")), type.parseArgLine("-r /foo.csv -r bar.json").discovery.getSelectedClasspathResources()), + () -> assertEquals(List.of(selectClasspathResource("/foo.csv", FilePosition.from(5))), type.parseArgLine("-r /foo.csv?line=5").discovery.getSelectedClasspathResources()), + () -> assertEquals(List.of(selectClasspathResource("/foo.csv", FilePosition.from(12, 34))), type.parseArgLine("-r /foo.csv?line=12&column=34").discovery.getSelectedClasspathResources()) ); // @formatter:on } From 35e51264a2fdd1d41fdcdd14232ac811bf6b5cb7 Mon Sep 17 00:00:00 2001 From: Juliette de Rancourt Date: Wed, 23 Oct 2024 16:21:07 +0200 Subject: [PATCH 224/611] Accept multiple values for all `--select` ConsoleLauncher options Resolves #3485. --- .../release-notes-5.12.0-M1.adoc | 1 + .../options/TestDiscoveryOptionsMixin.java | 43 +++++++++---------- .../CommandLineOptionsParsingTests.java | 24 ++++++++--- 3 files changed, 39 insertions(+), 29 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index c9a3569af431..aabaedaf61eb 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -33,6 +33,7 @@ JUnit repository on GitHub. `ReflectionUtils` to allow `String` to `Class` conversion in parameterized tests. * Add support for passing line and column number to `ConsoleLauncher` via `--select-file` and `--select-resource`. +* `ConsoleLauncher` now accepts multiple values for all `--select` options. [[release-notes-5.12.0-M1-junit-jupiter]] diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptionsMixin.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptionsMixin.java index 46298abb9d11..dfeb571875ab 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptionsMixin.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptionsMixin.java @@ -69,85 +69,84 @@ static class SelectorOptions { private boolean scanModulepath2; @Option(names = { "-u", - "--select-uri" }, paramLabel = "URI", arity = "1", converter = SelectorConverter.Uri.class, description = "Select a URI for test discovery. This option can be repeated.") + "--select-uri" }, paramLabel = "URI", arity = "1..*", converter = SelectorConverter.Uri.class, description = "Select a URI for test discovery. This option can be repeated.") private final List selectedUris = new ArrayList<>(); - @Option(names = { "--u", "-select-uri" }, arity = "1", hidden = true, converter = SelectorConverter.Uri.class) + @Option(names = { "--u", + "-select-uri" }, arity = "1..*", hidden = true, converter = SelectorConverter.Uri.class) private final List selectedUris2 = new ArrayList<>(); @Option(names = { "-f", - "--select-file" }, paramLabel = "FILE", arity = "1", converter = SelectorConverter.File.class, // + "--select-file" }, paramLabel = "FILE", arity = "1..*", converter = SelectorConverter.File.class, // description = "Select a file for test discovery. " + "The line and column numbers can be provided as URI query parameters (e.g. foo.txt?line=12&column=34). " + "This option can be repeated.") private final List selectedFiles = new ArrayList<>(); - @Option(names = { "--f", "-select-file" }, arity = "1", hidden = true, converter = SelectorConverter.File.class) + @Option(names = { "--f", + "-select-file" }, arity = "1..*", hidden = true, converter = SelectorConverter.File.class) private final List selectedFiles2 = new ArrayList<>(); @Option(names = { "-d", - "--select-directory" }, paramLabel = "DIR", arity = "1", converter = SelectorConverter.Directory.class, description = "Select a directory for test discovery. This option can be repeated.") + "--select-directory" }, paramLabel = "DIR", arity = "1..*", converter = SelectorConverter.Directory.class, description = "Select a directory for test discovery. This option can be repeated.") private final List selectedDirectories = new ArrayList<>(); @Option(names = { "--d", - "-select-directory" }, arity = "1", hidden = true, converter = SelectorConverter.Directory.class) + "-select-directory" }, arity = "1..*", hidden = true, converter = SelectorConverter.Directory.class) private final List selectedDirectories2 = new ArrayList<>(); @Option(names = { "-o", - "--select-module" }, paramLabel = "NAME", arity = "1", converter = SelectorConverter.Module.class, description = "Select single module for test discovery. This option can be repeated.") + "--select-module" }, paramLabel = "NAME", arity = "1..*", converter = SelectorConverter.Module.class, description = "Select single module for test discovery. This option can be repeated.") private final List selectedModules = new ArrayList<>(); @Option(names = { "--o", - "-select-module" }, arity = "1", converter = SelectorConverter.Module.class, hidden = true) + "-select-module" }, arity = "1..*", converter = SelectorConverter.Module.class, hidden = true) private final List selectedModules2 = new ArrayList<>(); @Option(names = { "-p", - "--select-package" }, paramLabel = "PKG", arity = "1", converter = SelectorConverter.Package.class, description = "Select a package for test discovery. This option can be repeated.") + "--select-package" }, paramLabel = "PKG", arity = "1..*", converter = SelectorConverter.Package.class, description = "Select a package for test discovery. This option can be repeated.") private final List selectedPackages = new ArrayList<>(); @Option(names = { "--p", - "-select-package" }, arity = "1", hidden = true, converter = SelectorConverter.Package.class) + "-select-package" }, arity = "1..*", hidden = true, converter = SelectorConverter.Package.class) private final List selectedPackages2 = new ArrayList<>(); @Option(names = { "-c", - "--select-class" }, paramLabel = "CLASS", arity = "1", converter = SelectorConverter.Class.class, description = "Select a class for test discovery. This option can be repeated.") + "--select-class" }, paramLabel = "CLASS", arity = "1..*", converter = SelectorConverter.Class.class, description = "Select a class for test discovery. This option can be repeated.") private final List selectedClasses = new ArrayList<>(); @Option(names = { "--c", - "-select-class" }, arity = "1", hidden = true, converter = SelectorConverter.Class.class) + "-select-class" }, arity = "1..*", hidden = true, converter = SelectorConverter.Class.class) private final List selectedClasses2 = new ArrayList<>(); @Option(names = { "-m", - "--select-method" }, paramLabel = "NAME", arity = "1", converter = SelectorConverter.Method.class, description = "Select a method for test discovery. This option can be repeated.") + "--select-method" }, paramLabel = "NAME", arity = "1..*", converter = SelectorConverter.Method.class, description = "Select a method for test discovery. This option can be repeated.") private final List selectedMethods = new ArrayList<>(); @Option(names = { "--m", - "-select-method" }, arity = "1", hidden = true, converter = SelectorConverter.Method.class) + "-select-method" }, arity = "1..*", hidden = true, converter = SelectorConverter.Method.class) private final List selectedMethods2 = new ArrayList<>(); @Option(names = { "-r", - "--select-resource" }, paramLabel = "RESOURCE", arity = "1", converter = SelectorConverter.ClasspathResource.class, // - description = "Select a classpath resource for test discovery. " - + "The line and column numbers can be provided as URI query parameters (e.g. foo.csv?line=12&column=34). " - + "This option can be repeated.") + "--select-resource" }, paramLabel = "RESOURCE", arity = "1..*", converter = SelectorConverter.ClasspathResource.class, description = "Select a classpath resource for test discovery. This option can be repeated.") private final List selectedClasspathResources = new ArrayList<>(); @Option(names = { "--r", - "-select-resource" }, arity = "1", hidden = true, converter = SelectorConverter.ClasspathResource.class) + "-select-resource" }, arity = "1..*", hidden = true, converter = SelectorConverter.ClasspathResource.class) private final List selectedClasspathResources2 = new ArrayList<>(); @Option(names = { "-i", - "--select-iteration" }, paramLabel = "PREFIX:VALUE[INDEX(..INDEX)?(,INDEX(..INDEX)?)*]", arity = "1", converter = SelectorConverter.Iteration.class, // + "--select-iteration" }, paramLabel = "PREFIX:VALUE[INDEX(..INDEX)?(,INDEX(..INDEX)?)*]", arity = "1..*", converter = SelectorConverter.Iteration.class, // description = "Select iterations for test discovery via a prefixed identifier and a list of indexes or index ranges " + "(e.g. method:com.acme.Foo#m()[1..2] selects the first and second iteration of the m() method in the com.acme.Foo class). " + "This option can be repeated.") private final List selectedIterations = new ArrayList<>(); @Option(names = { "--i", - "-select-iteration" }, arity = "1", hidden = true, converter = SelectorConverter.Iteration.class) + "-select-iteration" }, arity = "1..*", hidden = true, converter = SelectorConverter.Iteration.class) private final List selectedIterations2 = new ArrayList<>(); - @Option(names = "--select", paramLabel = "PREFIX:VALUE", arity = "1", converter = SelectorConverter.Identifier.class, // + @Option(names = "--select", paramLabel = "PREFIX:VALUE", arity = "1..*", converter = SelectorConverter.Identifier.class, // description = "Select via a prefixed identifier (e.g. method:com.acme.Foo#m selects the m() method in the com.acme.Foo class). " + "This option can be repeated.") private final List selectorIdentifiers = new ArrayList<>(); diff --git a/platform-tests/src/test/java/org/junit/platform/console/options/CommandLineOptionsParsingTests.java b/platform-tests/src/test/java/org/junit/platform/console/options/CommandLineOptionsParsingTests.java index acb491afa48f..15170bdd376a 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/options/CommandLineOptionsParsingTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/options/CommandLineOptionsParsingTests.java @@ -362,7 +362,8 @@ void parseValidUriSelectors(ArgsType type) { () -> assertEquals(List.of(selectUri("file:///foo.txt")), type.parseArgLine("-select-uri=file:///foo.txt").discovery.getSelectedUris()), () -> assertEquals(List.of(selectUri("file:///foo.txt")), type.parseArgLine("--select-uri file:///foo.txt").discovery.getSelectedUris()), () -> assertEquals(List.of(selectUri("file:///foo.txt")), type.parseArgLine("--select-uri=file:///foo.txt").discovery.getSelectedUris()), - () -> assertEquals(List.of(selectUri("file:///foo.txt"), selectUri("https://example")), type.parseArgLine("-u file:///foo.txt -u https://example").discovery.getSelectedUris()) + () -> assertEquals(List.of(selectUri("file:///foo.txt"), selectUri("https://example")), type.parseArgLine("-u file:///foo.txt -u https://example").discovery.getSelectedUris()), + () -> assertEquals(List.of(selectUri("file:///foo.txt"), selectUri("https://example")), type.parseArgLine("-u file:///foo.txt https://example").discovery.getSelectedUris()) ); // @formatter:on } @@ -384,6 +385,7 @@ void parseValidFileSelectors(ArgsType type) { () -> assertEquals(List.of(selectFile("foo.txt")), type.parseArgLine("--select-file foo.txt").discovery.getSelectedFiles()), () -> assertEquals(List.of(selectFile("foo.txt")), type.parseArgLine("--select-file=foo.txt").discovery.getSelectedFiles()), () -> assertEquals(List.of(selectFile("foo.txt"), selectFile("bar.csv")), type.parseArgLine("-f foo.txt -f bar.csv").discovery.getSelectedFiles()), + () -> assertEquals(List.of(selectFile("foo.txt"), selectFile("bar.csv")), type.parseArgLine("-f foo.txt bar.csv").discovery.getSelectedFiles()), () -> assertEquals(List.of(selectFile("foo.txt", FilePosition.from(5))), type.parseArgLine("-f foo.txt?line=5").discovery.getSelectedFiles()), () -> assertEquals(List.of(selectFile("foo.txt", FilePosition.from(12, 34))), type.parseArgLine("-f foo.txt?line=12&column=34").discovery.getSelectedFiles()) ); @@ -406,7 +408,8 @@ void parseValidDirectorySelectors(ArgsType type) { () -> assertEquals(List.of(selectDirectory("foo/bar")), type.parseArgLine("-select-directory=foo/bar").discovery.getSelectedDirectories()), () -> assertEquals(List.of(selectDirectory("foo/bar")), type.parseArgLine("--select-directory foo/bar").discovery.getSelectedDirectories()), () -> assertEquals(List.of(selectDirectory("foo/bar")), type.parseArgLine("--select-directory=foo/bar").discovery.getSelectedDirectories()), - () -> assertEquals(List.of(selectDirectory("foo/bar"), selectDirectory("bar/qux")), type.parseArgLine("-d foo/bar -d bar/qux").discovery.getSelectedDirectories()) + () -> assertEquals(List.of(selectDirectory("foo/bar"), selectDirectory("bar/qux")), type.parseArgLine("-d foo/bar -d bar/qux").discovery.getSelectedDirectories()), + () -> assertEquals(List.of(selectDirectory("foo/bar"), selectDirectory("bar/qux")), type.parseArgLine("-d foo/bar bar/qux").discovery.getSelectedDirectories()) ); // @formatter:on } @@ -427,7 +430,8 @@ void parseValidModuleSelectors(ArgsType type) { () -> assertEquals(List.of(selectModule("com.acme.foo")), type.parseArgLine("-select-module=com.acme.foo").discovery.getSelectedModules()), () -> assertEquals(List.of(selectModule("com.acme.foo")), type.parseArgLine("--select-module com.acme.foo").discovery.getSelectedModules()), () -> assertEquals(List.of(selectModule("com.acme.foo")), type.parseArgLine("--select-module=com.acme.foo").discovery.getSelectedModules()), - () -> assertEquals(List.of(selectModule("com.acme.foo"), selectModule("com.example.bar")), type.parseArgLine("-o com.acme.foo -o com.example.bar").discovery.getSelectedModules()) + () -> assertEquals(List.of(selectModule("com.acme.foo"), selectModule("com.example.bar")), type.parseArgLine("-o com.acme.foo -o com.example.bar").discovery.getSelectedModules()), + () -> assertEquals(List.of(selectModule("com.acme.foo"), selectModule("com.example.bar")), type.parseArgLine("-o com.acme.foo com.example.bar").discovery.getSelectedModules()) ); // @formatter:on } @@ -448,7 +452,8 @@ void parseValidPackageSelectors(ArgsType type) { () -> assertEquals(List.of(selectPackage("com.acme.foo")), type.parseArgLine("-select-package=com.acme.foo").discovery.getSelectedPackages()), () -> assertEquals(List.of(selectPackage("com.acme.foo")), type.parseArgLine("--select-package com.acme.foo").discovery.getSelectedPackages()), () -> assertEquals(List.of(selectPackage("com.acme.foo")), type.parseArgLine("--select-package=com.acme.foo").discovery.getSelectedPackages()), - () -> assertEquals(List.of(selectPackage("com.acme.foo"), selectPackage("com.example.bar")), type.parseArgLine("-p com.acme.foo -p com.example.bar").discovery.getSelectedPackages()) + () -> assertEquals(List.of(selectPackage("com.acme.foo"), selectPackage("com.example.bar")), type.parseArgLine("-p com.acme.foo -p com.example.bar").discovery.getSelectedPackages()), + () -> assertEquals(List.of(selectPackage("com.acme.foo"), selectPackage("com.example.bar")), type.parseArgLine("-p com.acme.foo com.example.bar").discovery.getSelectedPackages()) ); // @formatter:on } @@ -469,7 +474,8 @@ void parseValidClassSelectors(ArgsType type) { () -> assertEquals(List.of(selectClass("com.acme.Foo")), type.parseArgLine("-select-class=com.acme.Foo").discovery.getSelectedClasses()), () -> assertEquals(List.of(selectClass("com.acme.Foo")), type.parseArgLine("--select-class com.acme.Foo").discovery.getSelectedClasses()), () -> assertEquals(List.of(selectClass("com.acme.Foo")), type.parseArgLine("--select-class=com.acme.Foo").discovery.getSelectedClasses()), - () -> assertEquals(List.of(selectClass("com.acme.Foo"), selectClass("com.example.Bar")), type.parseArgLine("-c com.acme.Foo -c com.example.Bar").discovery.getSelectedClasses()) + () -> assertEquals(List.of(selectClass("com.acme.Foo"), selectClass("com.example.Bar")), type.parseArgLine("-c com.acme.Foo -c com.example.Bar").discovery.getSelectedClasses()), + () -> assertEquals(List.of(selectClass("com.acme.Foo"), selectClass("com.example.Bar")), type.parseArgLine("-c com.acme.Foo com.example.Bar").discovery.getSelectedClasses()) ); // @formatter:on } @@ -491,7 +497,9 @@ void parseValidMethodSelectors(ArgsType type) { () -> assertEquals(List.of(selectMethod("com.acme.Foo#m()")), type.parseArgLine("--select-method com.acme.Foo#m()").discovery.getSelectedMethods()), () -> assertEquals(List.of(selectMethod("com.acme.Foo#m()")), type.parseArgLine("--select-method=com.acme.Foo#m()").discovery.getSelectedMethods()), () -> assertEquals(List.of(selectMethod("com.acme.Foo#m()"), selectMethod("com.example.Bar#method(java.lang.Object)")), - type.parseArgLine("-m com.acme.Foo#m() -m com.example.Bar#method(java.lang.Object)").discovery.getSelectedMethods()) + type.parseArgLine("-m com.acme.Foo#m() -m com.example.Bar#method(java.lang.Object)").discovery.getSelectedMethods()), + () -> assertEquals(List.of(selectMethod("com.acme.Foo#m()"), selectMethod("com.example.Bar#method(java.lang.Object)")), + type.parseArgLine("-m com.acme.Foo#m() com.example.Bar#method(java.lang.Object)").discovery.getSelectedMethods()) ); // @formatter:on } @@ -513,6 +521,7 @@ void parseValidClasspathResourceSelectors(ArgsType type) { () -> assertEquals(List.of(selectClasspathResource("/foo.csv")), type.parseArgLine("--select-resource /foo.csv").discovery.getSelectedClasspathResources()), () -> assertEquals(List.of(selectClasspathResource("/foo.csv")), type.parseArgLine("--select-resource=/foo.csv").discovery.getSelectedClasspathResources()), () -> assertEquals(List.of(selectClasspathResource("/foo.csv"), selectClasspathResource("bar.json")), type.parseArgLine("-r /foo.csv -r bar.json").discovery.getSelectedClasspathResources()), + () -> assertEquals(List.of(selectClasspathResource("/foo.csv"), selectClasspathResource("bar.json")), type.parseArgLine("-r /foo.csv bar.json").discovery.getSelectedClasspathResources()), () -> assertEquals(List.of(selectClasspathResource("/foo.csv", FilePosition.from(5))), type.parseArgLine("-r /foo.csv?line=5").discovery.getSelectedClasspathResources()), () -> assertEquals(List.of(selectClasspathResource("/foo.csv", FilePosition.from(12, 34))), type.parseArgLine("-r /foo.csv?line=12&column=34").discovery.getSelectedClasspathResources()) ); @@ -535,7 +544,8 @@ void parseValidIterationSelectors(ArgsType type) { () -> assertEquals(List.of(selectIteration(selectPackage("com.acme.foo"), 3)), type.parseArgLine("-select-iteration=package:com.acme.foo[3]").discovery.getSelectedIterations()), () -> assertEquals(List.of(selectIteration(selectModule("com.acme.foo"), 0, 1, 2, 4, 5, 6)), type.parseArgLine("--select-iteration module:com.acme.foo[0..2,4..6]").discovery.getSelectedIterations()), () -> assertEquals(List.of(selectIteration(selectDirectory("foo/bar"), 1, 5)), type.parseArgLine("--select-iteration=directory:foo/bar[1,5]").discovery.getSelectedIterations()), - () -> assertEquals(List.of(selectIteration(selectFile("foo.txt"), 6), selectIteration(selectUri("file:///foo.txt"), 7)), type.parseArgLine("-i file:foo.txt[6] -i uri:file:///foo.txt[7]").discovery.getSelectedIterations()) + () -> assertEquals(List.of(selectIteration(selectFile("foo.txt"), 6), selectIteration(selectUri("file:///foo.txt"), 7)), type.parseArgLine("-i file:foo.txt[6] -i uri:file:///foo.txt[7]").discovery.getSelectedIterations()), + () -> assertEquals(List.of(selectIteration(selectFile("foo.txt"), 6), selectIteration(selectUri("file:///foo.txt"), 7)), type.parseArgLine("-i file:foo.txt[6] uri:file:///foo.txt[7]").discovery.getSelectedIterations()) ); // @formatter:on } From fc6fae0631be8281f52f92f9f41cb267244f7658 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 23 Oct 2024 16:04:15 +0000 Subject: [PATCH 225/611] Update actions/checkout action to v4.2.2 --- .github/workflows/ossf-scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index a6e5720f9be4..62b96c05a4d8 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -21,7 +21,7 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false From b8cb37d3e69975f74dd8b10eca2d53f1676dbc5a Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 24 Oct 2024 08:16:21 +0200 Subject: [PATCH 226/611] Use v4 of actions/checkout --- .github/workflows/ossf-scorecard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index 62b96c05a4d8..5028c4705f41 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -21,7 +21,7 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: persist-credentials: false From f9461c8d8310fd5253b0cb72f784ca7cd35fbb53 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 24 Oct 2024 06:16:57 +0000 Subject: [PATCH 227/611] Update actions/checkout digest to 11bd719 --- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/cross-version.yml | 4 ++-- .github/workflows/gradle-dependency-submission.yml | 2 +- .github/workflows/main.yml | 10 +++++----- .github/workflows/reproducible-build.yml | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 344f848c2a9f..a61c954088c0 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -32,7 +32,7 @@ jobs: - javascript steps: - name: Check out repository - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Initialize CodeQL uses: github/codeql-action/init@662472033e021d55d94146f66f6058822b0b39fd # v3 with: diff --git a/.github/workflows/cross-version.yml b/.github/workflows/cross-version.yml index 972c57772104..5803be674c0c 100644 --- a/.github/workflows/cross-version.yml +++ b/.github/workflows/cross-version.yml @@ -35,7 +35,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: fetch-depth: 1 - name: Set up Test JDK @@ -74,7 +74,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: fetch-depth: 1 - name: Set up Test JDK diff --git a/.github/workflows/gradle-dependency-submission.yml b/.github/workflows/gradle-dependency-submission.yml index 16b65448d8a7..f5b2539fbbc3 100644 --- a/.github/workflows/gradle-dependency-submission.yml +++ b/.github/workflows/gradle-dependency-submission.yml @@ -15,7 +15,7 @@ jobs: contents: write steps: - name: Check out repository - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: fetch-depth: 1 - name: Setup Java diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 64bf607bcfbd..c6782d3fc550 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: fetch-depth: 1 - name: Install GraalVM @@ -47,7 +47,7 @@ jobs: runs-on: windows-latest steps: - name: Check out repository - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: fetch-depth: 1 - name: Build @@ -57,7 +57,7 @@ jobs: runs-on: macos-latest steps: - name: Check out repository - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: fetch-depth: 1 - name: Build @@ -73,7 +73,7 @@ jobs: if: github.event_name == 'push' && github.repository == 'junit-team/junit5' && (startsWith(github.ref, 'refs/heads/releases/') || github.ref == 'refs/heads/main') steps: - name: Check out repository - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: fetch-depth: 1 - name: Publish @@ -99,7 +99,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: fetch-depth: 1 - name: Install Graphviz diff --git a/.github/workflows/reproducible-build.yml b/.github/workflows/reproducible-build.yml index f440c20f5f76..5216dd8beb12 100644 --- a/.github/workflows/reproducible-build.yml +++ b/.github/workflows/reproducible-build.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out repository - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: fetch-depth: 1 - name: Restore Gradle cache and display toolchains From 5b0d0428c4d67ed1f39d13f5c4e3202fd4609522 Mon Sep 17 00:00:00 2001 From: Juliette de Rancourt Date: Thu, 24 Oct 2024 19:48:03 +0200 Subject: [PATCH 228/611] Add `--select-unique-id` support to ConsoleLauncher (#4093) Resolves #3484 --- .../release-notes-5.12.0-M1.adoc | 1 + .../console/options/SelectorConverter.java | 9 ++++++++ .../console/options/TestDiscoveryOptions.java | 10 +++++++++ .../options/TestDiscoveryOptionsMixin.java | 11 ++++++++-- .../CommandLineOptionsParsingTests.java | 22 ++++++++++++++++++- 5 files changed, 50 insertions(+), 3 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index aabaedaf61eb..520da97eef40 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -34,6 +34,7 @@ JUnit repository on GitHub. * Add support for passing line and column number to `ConsoleLauncher` via `--select-file` and `--select-resource`. * `ConsoleLauncher` now accepts multiple values for all `--select` options. +* Add `--select-unique-id` support to ConsoleLauncher. [[release-notes-5.12.0-M1-junit-jupiter]] diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/SelectorConverter.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/SelectorConverter.java index 6f1803185706..0ef1351722cb 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/SelectorConverter.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/SelectorConverter.java @@ -17,6 +17,7 @@ import static org.junit.platform.engine.discovery.DiscoverySelectors.selectMethod; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectModule; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectPackage; +import static org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectUri; import java.net.URI; @@ -34,6 +35,7 @@ import org.junit.platform.engine.discovery.MethodSelector; import org.junit.platform.engine.discovery.ModuleSelector; import org.junit.platform.engine.discovery.PackageSelector; +import org.junit.platform.engine.discovery.UniqueIdSelector; import org.junit.platform.engine.discovery.UriSelector; import picocli.CommandLine.ITypeConverter; @@ -113,6 +115,13 @@ public IterationSelector convert(String value) { } } + static class UniqueId implements ITypeConverter { + @Override + public UniqueIdSelector convert(String value) { + return selectUniqueId(value); + } + } + static class Identifier implements ITypeConverter { @Override public DiscoverySelectorIdentifier convert(String value) { diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptions.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptions.java index ab9fe3027dd7..cf6388764669 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptions.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptions.java @@ -35,6 +35,7 @@ import org.junit.platform.engine.discovery.MethodSelector; import org.junit.platform.engine.discovery.ModuleSelector; import org.junit.platform.engine.discovery.PackageSelector; +import org.junit.platform.engine.discovery.UniqueIdSelector; import org.junit.platform.engine.discovery.UriSelector; /** @@ -58,6 +59,7 @@ public class TestDiscoveryOptions { private List selectedMethods = emptyList(); private List selectedClasspathResources = emptyList(); private List selectedIterations = emptyList(); + private List selectedUniqueIds = emptyList(); private List selectorIdentifiers = emptyList(); private List includedClassNamePatterns = singletonList(STANDARD_INCLUDE_PATTERN); @@ -182,6 +184,14 @@ public void setSelectedIterations(List selectedIterations) { this.selectedIterations = selectedIterations; } + public List getSelectedUniqueIds() { + return selectedUniqueIds; + } + + public void setSelectedUniqueId(List selectedUniqueIds) { + this.selectedUniqueIds = selectedUniqueIds; + } + public List getSelectorIdentifiers() { return selectorIdentifiers; } diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptionsMixin.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptionsMixin.java index dfeb571875ab..73e0b61e0d67 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptionsMixin.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptionsMixin.java @@ -27,6 +27,7 @@ import org.junit.platform.engine.discovery.MethodSelector; import org.junit.platform.engine.discovery.ModuleSelector; import org.junit.platform.engine.discovery.PackageSelector; +import org.junit.platform.engine.discovery.UniqueIdSelector; import org.junit.platform.engine.discovery.UriSelector; import picocli.CommandLine; @@ -146,6 +147,11 @@ static class SelectorOptions { "-select-iteration" }, arity = "1..*", hidden = true, converter = SelectorConverter.Iteration.class) private final List selectedIterations2 = new ArrayList<>(); + @Option(names = { "--select-unique-id", + "--uid" }, paramLabel = "UNIQUE-ID", arity = "1..*", converter = SelectorConverter.UniqueId.class, // + description = "Select a unique id for test discovery. This option can be repeated.") + private final List selectedUniqueIds = new ArrayList<>(); + @Option(names = "--select", paramLabel = "PREFIX:VALUE", arity = "1..*", converter = SelectorConverter.Identifier.class, // description = "Select via a prefixed identifier (e.g. method:com.acme.Foo#m selects the m() method in the com.acme.Foo class). " + "This option can be repeated.") @@ -168,6 +174,7 @@ private void applyTo(TestDiscoveryOptions result) { result.setSelectedClasspathResources( merge(this.selectedClasspathResources, this.selectedClasspathResources2)); result.setSelectedIterations(merge(this.selectedIterations, this.selectedIterations2)); + result.setSelectedUniqueId(this.selectedUniqueIds); result.setSelectorIdentifiers(this.selectorIdentifiers); } } @@ -210,12 +217,12 @@ static class FilterOptions { @Option(names = { "--include-methodname" }, paramLabel = "PATTERN", arity = "1", description = "Provide a regular expression to include only methods whose fully qualified names without parameters match. " // + "When this option is repeated, all patterns will be combined using OR semantics.") - private List includeMethodNamePatterns = new ArrayList<>(); + private final List includeMethodNamePatterns = new ArrayList<>(); @Option(names = { "--exclude-methodname" }, paramLabel = "PATTERN", arity = "1", description = "Provide a regular expression to exclude those methods whose fully qualified names without parameters match. " // + "When this option is repeated, all patterns will be combined using OR semantics.") - private List excludeMethodNamePatterns = new ArrayList<>(); + private final List excludeMethodNamePatterns = new ArrayList<>(); @Option(names = { "-t", "--include-tag" }, paramLabel = "TAG", arity = "1", description = "Provide a tag or tag expression to include only tests whose tags match. " diff --git a/platform-tests/src/test/java/org/junit/platform/console/options/CommandLineOptionsParsingTests.java b/platform-tests/src/test/java/org/junit/platform/console/options/CommandLineOptionsParsingTests.java index 15170bdd376a..dd5d01a479aa 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/options/CommandLineOptionsParsingTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/options/CommandLineOptionsParsingTests.java @@ -26,6 +26,7 @@ import static org.junit.platform.engine.discovery.DiscoverySelectors.selectMethod; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectModule; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectPackage; +import static org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectUri; import java.io.File; @@ -555,6 +556,24 @@ void parseInvalidIterationSelectors() { assertOptionWithMissingRequiredArgumentThrowsException("-i", "--select-iteration"); } + @ParameterizedTest + @EnumSource + void parseValidUniqueIdSelectors(ArgsType type) { + // @formatter:off + assertAll( + () -> assertEquals(List.of(selectUniqueId("[engine:junit-jupiter]/[class:MyClass]/[method:myMethod]")), type.parseArgLine("--uid [engine:junit-jupiter]/[class:MyClass]/[method:myMethod]").discovery.getSelectedUniqueIds()), + () -> assertEquals(List.of(selectUniqueId("[engine:junit-jupiter]/[class:MyClass]/[method:myMethod]")), type.parseArgLine("--select-unique-id [engine:junit-jupiter]/[class:MyClass]/[method:myMethod]").discovery.getSelectedUniqueIds()), + () -> assertEquals(List.of(selectUniqueId("[engine:junit-jupiter]/[class:MyClass1]"), selectUniqueId("[engine:junit-jupiter]/[class:MyClass2]")), type.parseArgLine("--uid [engine:junit-jupiter]/[class:MyClass1] --uid [engine:junit-jupiter]/[class:MyClass2]").discovery.getSelectedUniqueIds()), + () -> assertEquals(List.of(selectUniqueId("[engine:junit-jupiter]/[class:MyClass1]"), selectUniqueId("[engine:junit-jupiter]/[class:MyClass2]")), type.parseArgLine("--uid [engine:junit-jupiter]/[class:MyClass1] [engine:junit-jupiter]/[class:MyClass2]").discovery.getSelectedUniqueIds()) + ); + // @formatter:on + } + + @Test + void parseInvalidUniqueIdSelectors() { + assertOptionWithMissingRequiredArgumentThrowsException("--uid", "--select-unique-id"); + } + @ParameterizedTest @EnumSource void parseClasspathScanningEntries(ArgsType type) { @@ -637,7 +656,8 @@ void parseValidSelectorIdentifier(ArgsType type) { () -> assertEquals(List.of(selectPackage("com.acme.foo")), parseIdentifiers(type,"--select package:com.acme.foo")), () -> assertEquals(List.of(selectModule("com.acme.foo")), parseIdentifiers(type,"--select module:com.acme.foo")), () -> assertEquals(List.of(selectDirectory("foo/bar")), parseIdentifiers(type,"--select directory:foo/bar")), - () -> assertEquals(List.of(selectFile("foo.txt"), selectUri("file:///foo.txt")), parseIdentifiers(type,"--select file:foo.txt --select uri:file:///foo.txt")) + () -> assertEquals(List.of(selectFile("foo.txt"), selectUri("file:///foo.txt")), parseIdentifiers(type,"--select file:foo.txt --select uri:file:///foo.txt")), + () -> assertEquals(List.of(selectUniqueId("[engine:junit-jupiter]/[class:MyClass]/[method:myMethod]")), parseIdentifiers(type,"--select uid:[engine:junit-jupiter]/[class:MyClass]/[method:myMethod]")) ); // @formatter:on } From aa9098ed161a2c4b0451152d1f7a775fd76eea3f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 24 Oct 2024 17:54:19 +0000 Subject: [PATCH 229/611] Update actions/setup-java digest to 8df1039 --- .github/actions/run-gradle/action.yml | 2 +- .github/actions/setup-test-jdk/action.yml | 2 +- .github/workflows/cross-version.yml | 4 ++-- .github/workflows/gradle-dependency-submission.yml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/actions/run-gradle/action.yml b/.github/actions/run-gradle/action.yml index c372e545c648..c097e93cdeea 100644 --- a/.github/actions/run-gradle/action.yml +++ b/.github/actions/run-gradle/action.yml @@ -8,7 +8,7 @@ inputs: runs: using: "composite" steps: - - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 + - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4 id: setup-gradle-jdk with: distribution: temurin diff --git a/.github/actions/setup-test-jdk/action.yml b/.github/actions/setup-test-jdk/action.yml index 69eeef2cccbc..53560ac0a016 100644 --- a/.github/actions/setup-test-jdk/action.yml +++ b/.github/actions/setup-test-jdk/action.yml @@ -8,7 +8,7 @@ inputs: runs: using: "composite" steps: - - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 + - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4 with: distribution: ${{ inputs.distribution }} java-version: 8 diff --git a/.github/workflows/cross-version.yml b/.github/workflows/cross-version.yml index 5803be674c0c..c04042d59911 100644 --- a/.github/workflows/cross-version.yml +++ b/.github/workflows/cross-version.yml @@ -49,7 +49,7 @@ jobs: version: latest - name: "Set up JDK ${{ matrix.jdk.version }} (${{ matrix.jdk.distribution || 'temurin' }})" if: matrix.jdk.type == 'ga' - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 + uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4 with: distribution: ${{ matrix.jdk.distribution || 'temurin' }} java-version: ${{ matrix.jdk.version }} @@ -82,7 +82,7 @@ jobs: with: distribution: semeru - name: 'Set up JDK ${{ matrix.jdk }}' - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 + uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4 with: distribution: semeru java-version: ${{ matrix.jdk }} diff --git a/.github/workflows/gradle-dependency-submission.yml b/.github/workflows/gradle-dependency-submission.yml index f5b2539fbbc3..9964dbe80360 100644 --- a/.github/workflows/gradle-dependency-submission.yml +++ b/.github/workflows/gradle-dependency-submission.yml @@ -19,7 +19,7 @@ jobs: with: fetch-depth: 1 - name: Setup Java - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4 + uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4 with: distribution: temurin java-version: 21 From 00c45081f1472744a5bf5fd172bcc32b65223da2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 25 Oct 2024 11:54:09 +0000 Subject: [PATCH 230/611] Update plugin spotless to v7.0.0.BETA4 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fac8a25c44d1..2d1a19cf2c01 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -92,5 +92,5 @@ jmh = { id = "me.champeau.jmh", version = "0.7.2" } nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" } plantuml = { id = "io.freefair.plantuml", version = "8.10.2" } shadow = { id = "com.gradleup.shadow", version = "8.3.3" } -spotless = { id = "com.diffplug.spotless", version = "7.0.0.BETA3" } +spotless = { id = "com.diffplug.spotless", version = "7.0.0.BETA4" } versions = { id = "com.github.ben-manes.versions", version = "0.51.0" } From f7b7975418275e17e3f7570445908fbfdad6c14a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 25 Oct 2024 14:07:11 +0000 Subject: [PATCH 231/611] Update dependency com.pinterest.ktlint:ktlint-cli to v1.4.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2d1a19cf2c01..2f448b30feda 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -12,7 +12,7 @@ jacoco = "0.8.12" jmh = "1.37" junit4 = "4.13.2" junit4Min = "4.12" -ktlint = "1.3.1" +ktlint = "1.4.0" log4j = "2.24.1" opentest4j = "1.3.0" openTestReporting = "0.1.0-M2" From 4125c7e8f0d399a4e213b2f47d28bfe9d5b9f256 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 26 Oct 2024 13:51:17 +0000 Subject: [PATCH 232/611] Update dependency com.puppycrawl.tools:checkstyle to v10.19.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2f448b30feda..81d1120157f0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ asciidoctorj-pdf = "2.3.19" asciidoctor-plugins = "4.0.3" # Check if workaround in documentation.gradle.kts can be removed when upgrading assertj = "3.26.3" bnd = "7.0.0" -checkstyle = "10.18.2" +checkstyle = "10.19.0" eclipse = "4.32.0" jackson = "2.18.0" jacoco = "0.8.12" From 8d3c6929390b9986723fed626f96923e5114c772 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 29 Oct 2024 06:21:15 +0000 Subject: [PATCH 233/611] Update plugin shadow to v8.3.4 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 81d1120157f0..e707a0ebe9ae 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -91,6 +91,6 @@ gitPublish = { id = "org.ajoberstar.git-publish", version = "4.2.2" } jmh = { id = "me.champeau.jmh", version = "0.7.2" } nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" } plantuml = { id = "io.freefair.plantuml", version = "8.10.2" } -shadow = { id = "com.gradleup.shadow", version = "8.3.3" } +shadow = { id = "com.gradleup.shadow", version = "8.3.4" } spotless = { id = "com.diffplug.spotless", version = "7.0.0.BETA4" } versions = { id = "com.github.ben-manes.versions", version = "0.51.0" } From 8f71c191e214f5ec0db5b61c412779d4376d0b3b Mon Sep 17 00:00:00 2001 From: "M.P. Korstanje" Date: Tue, 29 Oct 2024 10:18:59 +0100 Subject: [PATCH 234/611] Add resource container selector resolver (#3718) As a follow up for #3630 and #3705 this adds a `addResourceContainerSelectorResolver()` method to `EngineDiscoveryRequestResolver.Builder` analogous to `addClassContainerSelectorResolver()`. Points of note: * As classpath resources can be selected from packages, the package filter should also be applied. To make this possible the base path of a resource is rewritten to a package name prior to being filtered. * The `ClasspathResourceSelector` now has a `getClasspathResources` method. This method will lazily try to load the resources if not already provided when discovering resources in a container. * `selectClasspathResource(Resource)` was added to short circuit the need to resolve resources twice. And to make it possible to use this method as part of the public API, `ReflectionSupport.tryToLoadResource` was also added. --------- Co-authored-by: Marc Philipp --- .../release-notes-5.12.0-M1.adoc | 3 + .../commons/support/ReflectionSupport.java | 55 ++++++- .../commons/util/ReflectionUtils.java | 50 ++++++ .../discovery/ClasspathResourceSelector.java | 52 ++++++- .../engine/discovery/DiscoverySelectors.java | 40 ++++- .../EngineDiscoveryRequestResolver.java | 47 ++++++ .../ResourceContainerSelectorResolver.java | 74 +++++++++ .../support/discovery/ResourceUtils.java | 48 ++++++ .../support/ReflectionSupportTests.java | 26 ++++ .../commons/util/ReflectionUtilsTests.java | 44 ++++++ .../discovery/DiscoverySelectorsTests.java | 51 ++++++- ...ResourceContainerSelectorResolverTest.java | 144 ++++++++++++++++++ 12 files changed, 626 insertions(+), 8 deletions(-) create mode 100644 junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/ResourceContainerSelectorResolver.java create mode 100644 junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/ResourceUtils.java create mode 100644 platform-tests/src/test/java/org/junit/platform/engine/support/discovery/ResourceContainerSelectorResolverTest.java diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 520da97eef40..0a247d5a0256 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -27,6 +27,9 @@ JUnit repository on GitHub. [[release-notes-5.12.0-M1-junit-platform-new-features-and-improvements]] ==== New Features and Improvements +* New `addResourceContainerSelectorResolver()` in `EngineDiscoveryRequestResolver.Builder` to + support the discovery of class path resource based tests, analogous to the + `addClassContainerSelectorResolver()`. * Introduce `ReflectionSupport.makeAccessible(Field)` for third-party use rather than calling the internal `ReflectionUtils.makeAccessible(Field)` method directly. * Support both the primitive type `void` and the wrapper type `Void` in the internal diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ReflectionSupport.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ReflectionSupport.java index 2081eb20eb4e..13ae4a640a37 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ReflectionSupport.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ReflectionSupport.java @@ -19,6 +19,7 @@ import java.net.URI; import java.util.List; import java.util.Optional; +import java.util.Set; import java.util.function.Predicate; import java.util.stream.Stream; @@ -114,6 +115,51 @@ public static Try> tryToLoadClass(String name, ClassLoader classLoader) return ReflectionUtils.tryToLoadClass(name, classLoader); } + /** + * Tries to get the {@linkplain Resource resources} for the supplied classpath + * resource name. + * + *

    The name of a classpath resource must follow the semantics + * for resource paths as defined in {@link ClassLoader#getResource(String)}. + * + *

    If the supplied classpath resource name is prefixed with a slash + * ({@code /}), the slash will be removed. + * + * @param classpathResourceName the name of the resource to load; never + * {@code null} or blank + * @return a successful {@code Try} containing the loaded resources or a failed + * {@code Try} containing the exception if no such resources could be loaded; + * never {@code null} + * @since 1.11 + */ + @API(status = EXPERIMENTAL, since = "1.12") + public static Try> tryToGetResources(String classpathResourceName) { + return ReflectionUtils.tryToGetResources(classpathResourceName); + } + + /** + * Tries to load the {@linkplain Resource resources} for the supplied classpath + * resource name, using the supplied {@link ClassLoader}. + * + *

    The name of a classpath resource must follow the semantics + * for resource paths as defined in {@link ClassLoader#getResource(String)}. + * + *

    If the supplied classpath resource name is prefixed with a slash + * ({@code /}), the slash will be removed. + * + * @param classpathResourceName the name of the resource to load; never + * {@code null} or blank + * @param classLoader the {@code ClassLoader} to use; never {@code null} + * @return a successful {@code Try} containing the loaded resources or a failed + * {@code Try} containing the exception if no such resources could be loaded; + * never {@code null} + * @since 1.11 + */ + @API(status = EXPERIMENTAL, since = "1.12") + public static Try> tryToGetResources(String classpathResourceName, ClassLoader classLoader) { + return ReflectionUtils.tryToGetResources(classpathResourceName, classLoader); + } + /** * Find all {@linkplain Class classes} in the supplied classpath {@code root} * that match the specified {@code classFilter} and {@code classNameFilter} @@ -235,7 +281,8 @@ public static List> findAllClassesInPackage(String basePackageName, Pre * that match the specified {@code resourceFilter} predicate. * *

    The classpath scanning algorithm searches recursively in subpackages - * beginning within the supplied base package. + * beginning within the supplied base package. The resulting list may include + * identically named resources from different classpath roots. * * @param basePackageName the name of the base package in which to start * scanning; must not be {@code null} and must be valid in terms of Java @@ -259,7 +306,8 @@ public static List findAllResourcesInPackage(String basePackageName, P * predicates. * *

    The classpath scanning algorithm searches recursively in subpackages - * beginning within the supplied base package. + * beginning within the supplied base package. The resulting stream may + * include identically named resources from different classpath roots. * * @param basePackageName the name of the base package in which to start * scanning; must not be {@code null} and must be valid in terms of Java @@ -284,7 +332,8 @@ public static Stream> streamAllClassesInPackage(String basePackageName, * that match the specified {@code resourceFilter} predicate. * *

    The classpath scanning algorithm searches recursively in subpackages - * beginning within the supplied base package. + * beginning within the supplied base package. The resulting stream may + * include identically named resources from different classpath roots. * * @param basePackageName the name of the base package in which to start * scanning; must not be {@code null} and must be valid in terms of Java diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java index 77e270376854..2dafd46d5344 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java @@ -36,6 +36,8 @@ import java.lang.reflect.Type; import java.lang.reflect.TypeVariable; import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -894,6 +896,54 @@ public static Try> tryToLoadClass(String name, ClassLoader classLoader) }); } + /** + * Try to get {@linkplain Resource resources} by their name, using the + * {@link ClassLoaderUtils#getDefaultClassLoader()}. + * + *

    See {@link org.junit.platform.commons.support.ReflectionSupport#tryToGetResources(String)} + * for details. + * + * @param classpathResourceName the name of the resources to load; never {@code null} or blank + * @since 1.12 + * @see org.junit.platform.commons.support.ReflectionSupport#tryToGetResources(String, ClassLoader) + */ + @API(status = INTERNAL, since = "1.12") + public static Try> tryToGetResources(String classpathResourceName) { + return tryToGetResources(classpathResourceName, ClassLoaderUtils.getDefaultClassLoader()); + } + + /** + * Try to get {@linkplain Resource resources} by their name, using the + * supplied {@link ClassLoader}. + * + *

    See {@link org.junit.platform.commons.support.ReflectionSupport#tryToGetResources(String, ClassLoader)} + * for details. + * + * @param classpathResourceName the name of the resources to load; never {@code null} or blank + * @param classLoader the {@code ClassLoader} to use; never {@code null} + * @since 1.12 + */ + @API(status = INTERNAL, since = "1.12") + public static Try> tryToGetResources(String classpathResourceName, ClassLoader classLoader) { + Preconditions.notBlank(classpathResourceName, "Resource name must not be null or blank"); + Preconditions.notNull(classLoader, "Class loader must not be null"); + boolean startsWithSlash = classpathResourceName.startsWith("/"); + String canonicalClasspathResourceName = (startsWithSlash ? classpathResourceName.substring(1) + : classpathResourceName); + + return Try.call(() -> { + List resources = Collections.list(classLoader.getResources(canonicalClasspathResourceName)); + return resources.stream().map(url -> { + try { + return new ClasspathResource(canonicalClasspathResourceName, url.toURI()); + } + catch (URISyntaxException e) { + throw ExceptionUtils.throwAsUncheckedException(e); + } + }).collect(toCollection(LinkedHashSet::new)); + }); + } + private static Class loadArrayType(ClassLoader classLoader, String componentTypeName, int dimensions) throws ClassNotFoundException { diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClasspathResourceSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClasspathResourceSelector.java index eb0aff3fda14..4b591a38684e 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClasspathResourceSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClasspathResourceSelector.java @@ -10,13 +10,21 @@ package org.junit.platform.engine.discovery; +import static java.util.Collections.unmodifiableSet; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.INTERNAL; import static org.apiguardian.api.API.Status.STABLE; +import java.util.LinkedHashSet; import java.util.Objects; import java.util.Optional; +import java.util.Set; import org.apiguardian.api.API; +import org.junit.platform.commons.PreconditionViolationException; +import org.junit.platform.commons.function.Try; +import org.junit.platform.commons.support.Resource; +import org.junit.platform.commons.util.ReflectionUtils; import org.junit.platform.commons.util.StringUtils; import org.junit.platform.commons.util.ToStringBuilder; import org.junit.platform.engine.DiscoverySelector; @@ -34,6 +42,10 @@ * {@linkplain Thread#getContextClassLoader() context class loader} of the * {@linkplain Thread thread} that uses it. * + *

    Note: Since Java 9, all resources are on the module path. Either in + * named or unnamed modules. These resources are also considered to be + * classpath resources. + * * @since 1.0 * @see DiscoverySelectors#selectClasspathResource(String) * @see ClasspathRootSelector @@ -44,6 +56,7 @@ public class ClasspathResourceSelector implements DiscoverySelector { private final String classpathResourceName; private final FilePosition position; + private Set classpathResources; ClasspathResourceSelector(String classpathResourceName, FilePosition position) { boolean startsWithSlash = classpathResourceName.startsWith("/"); @@ -51,6 +64,11 @@ public class ClasspathResourceSelector implements DiscoverySelector { this.position = position; } + ClasspathResourceSelector(Set classpathResources) { + this(classpathResources.iterator().next().getName(), null); + this.classpathResources = unmodifiableSet(new LinkedHashSet<>(classpathResources)); + } + /** * Get the name of the selected classpath resource. * @@ -65,6 +83,32 @@ public String getClasspathResourceName() { return this.classpathResourceName; } + /** + * Get the selected {@link Resource resources}. + * + *

    If the {@link Resource resources} were not provided, but only their name, + * this method attempts to lazily load the {@link Resource resources} based on + * their name and throws a {@link PreconditionViolationException} if the + * resource cannot be loaded. + * + * @since 1.12 + */ + @API(status = EXPERIMENTAL, since = "1.12") + public Set getClasspathResources() { + if (this.classpathResources == null) { + Try> tryToGetResource = ReflectionUtils.tryToGetResources(this.classpathResourceName); + Set classpathResources = tryToGetResource.getOrThrow( // + cause -> new PreconditionViolationException( // + "Could not load resource(s) with name: " + this.classpathResourceName, cause)); + if (classpathResources.isEmpty()) { + throw new PreconditionViolationException( + "Could not find any resource(s) with name: " + this.classpathResourceName); + } + this.classpathResources = unmodifiableSet(classpathResources); + } + return this.classpathResources; + } + /** * Get the selected {@code FilePosition} within the classpath resource. */ @@ -100,8 +144,12 @@ public int hashCode() { @Override public String toString() { - return new ToStringBuilder(this).append("classpathResourceName", this.classpathResourceName).append("position", - this.position).toString(); + // @formatter:off + return new ToStringBuilder(this) + .append("classpathResourceName", this.classpathResourceName) + .append("position", this.position) + .toString(); + // @formatter:on } @Override diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectors.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectors.java index 1c6964579e13..28dda12b3a76 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectors.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectors.java @@ -10,6 +10,7 @@ package org.junit.platform.engine.discovery; +import static java.util.stream.Collectors.toList; import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.STABLE; import static org.junit.platform.commons.util.CollectionUtils.toUnmodifiableList; @@ -29,6 +30,8 @@ import org.apiguardian.api.API; import org.junit.platform.commons.PreconditionViolationException; +import org.junit.platform.commons.support.ReflectionSupport; +import org.junit.platform.commons.support.Resource; import org.junit.platform.commons.util.Preconditions; import org.junit.platform.commons.util.ReflectionUtils; import org.junit.platform.engine.DiscoverySelector; @@ -281,6 +284,7 @@ public static List selectClasspathRoots(Set classpa * @param classpathResourceName the name of the classpath resource; never * {@code null} or blank * @see #selectClasspathResource(String, FilePosition) + * @see #selectClasspathResource(Set) * @see ClasspathResourceSelector * @see ClassLoader#getResource(String) * @see ClassLoader#getResourceAsStream(String) @@ -310,6 +314,7 @@ public static ClasspathResourceSelector selectClasspathResource(String classpath * {@code null} or blank * @param position the position inside the classpath resource; may be {@code null} * @see #selectClasspathResource(String) + * @see #selectClasspathResource(Set) * @see ClasspathResourceSelector * @see ClassLoader#getResource(String) * @see ClassLoader#getResourceAsStream(String) @@ -317,10 +322,43 @@ public static ClasspathResourceSelector selectClasspathResource(String classpath */ public static ClasspathResourceSelector selectClasspathResource(String classpathResourceName, FilePosition position) { - Preconditions.notBlank(classpathResourceName, "Classpath resource name must not be null or blank"); + Preconditions.notBlank(classpathResourceName, "classpath resource name must not be null or blank"); return new ClasspathResourceSelector(classpathResourceName, position); } + /** + * Create a {@code ClasspathResourceSelector} for the supplied classpath + * resources. + * + *

    Since {@linkplain org.junit.platform.engine.TestEngine engines} are not + * expected to modify the classpath, the supplied resource must be on the + * classpath of the + * {@linkplain Thread#getContextClassLoader() context class loader} of the + * {@linkplain Thread thread} that uses the resulting selector. + * + *

    Note: Since Java 9, all resources are on the module path. Either in + * named or unnamed modules. These resources are also considered to be + * classpath resources. + * + * @param classpathResources a set of classpath resources; never + * {@code null} or empty. All resources must have the same name, may not + * be {@code null} or blank. + * @since 1.12 + * @see #selectClasspathResource(String, FilePosition) + * @see #selectClasspathResource(String) + * @see ClasspathResourceSelector + * @see ReflectionSupport#tryToGetResources(String) + */ + @API(status = EXPERIMENTAL, since = "1.12") + public static ClasspathResourceSelector selectClasspathResource(Set classpathResources) { + Preconditions.notEmpty(classpathResources, "classpath resources must not be null or empty"); + Preconditions.containsNoNullElements(classpathResources, "individual classpath resources must not be null"); + List resourceNames = classpathResources.stream().map(Resource::getName).distinct().collect(toList()); + Preconditions.condition(resourceNames.size() == 1, "all classpath resources must have the same name"); + Preconditions.notBlank(resourceNames.get(0), "classpath resource names must not be null or blank"); + return new ClasspathResourceSelector(classpathResources); + } + /** * Create a {@code ModuleSelector} for the supplied module name. * diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/EngineDiscoveryRequestResolver.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/EngineDiscoveryRequestResolver.java index df5611990a78..277bd119cb24 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/EngineDiscoveryRequestResolver.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/EngineDiscoveryRequestResolver.java @@ -11,6 +11,7 @@ package org.junit.platform.engine.support.discovery; import static java.util.stream.Collectors.toCollection; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.STABLE; import java.util.ArrayList; @@ -19,6 +20,7 @@ import java.util.function.Predicate; import org.apiguardian.api.API; +import org.junit.platform.commons.support.Resource; import org.junit.platform.commons.util.Preconditions; import org.junit.platform.engine.DiscoveryFilter; import org.junit.platform.engine.EngineDiscoveryRequest; @@ -26,6 +28,7 @@ import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.discovery.ClassNameFilter; import org.junit.platform.engine.discovery.ClassSelector; +import org.junit.platform.engine.discovery.ClasspathResourceSelector; import org.junit.platform.engine.discovery.ClasspathRootSelector; import org.junit.platform.engine.discovery.ModuleSelector; import org.junit.platform.engine.discovery.PackageNameFilter; @@ -160,6 +163,25 @@ public Builder addClassContainerSelectorResolver(Predicate> classFil context -> new ClassContainerSelectorResolver(classFilter, context.getClassNameFilter())); } + /** + * Add a predefined resolver that resolves {@link ClasspathRootSelector + * ClasspathRootSelectors}, {@link ModuleSelector ModuleSelectors}, and + * {@link PackageSelector PackageSelectors} into {@link ClasspathResourceSelector + * ClasspathResourceSelectors} by scanning for resources that satisfy the supplied + * predicate in the respective class containers to this builder. + * + * @param resourceFilter predicate the resolved classes must satisfy; never + * {@code null} + * @return this builder for method chaining + * @since 1.12 + */ + @API(status = EXPERIMENTAL, since = "1.12") + public Builder addResourceContainerSelectorResolver(Predicate resourceFilter) { + Preconditions.notNull(resourceFilter, "resourceFilter must not be null"); + return addSelectorResolver( + context -> new ResourceContainerSelectorResolver(resourceFilter, context.getPackageFilter())); + } + /** * Add a context insensitive {@link SelectorResolver} to this builder. * @@ -247,6 +269,18 @@ public interface InitializationContext { */ Predicate getClassNameFilter(); + /** + * Get the package name filter built from the {@link PackageNameFilter + * PackageNameFilters} in the {@link EngineDiscoveryRequest} that is + * about to be resolved. + * + * @return the predicate for filtering the resolved resource names; never + * {@code null} + * @since 1.12 + */ + @API(status = EXPERIMENTAL, since = "1.12") + Predicate getPackageFilter(); + } private static class DefaultInitializationContext implements InitializationContext { @@ -254,11 +288,13 @@ private static class DefaultInitializationContext impl private final EngineDiscoveryRequest request; private final T engineDescriptor; private final Predicate classNameFilter; + private final Predicate packageFilter; DefaultInitializationContext(EngineDiscoveryRequest request, T engineDescriptor) { this.request = request; this.engineDescriptor = engineDescriptor; this.classNameFilter = buildClassNamePredicate(request); + this.packageFilter = buildPackagePredicate(request); } /** @@ -274,6 +310,12 @@ private Predicate buildClassNamePredicate(EngineDiscoveryRequest request return Filter.composeFilters(filters).toPredicate(); } + private Predicate buildPackagePredicate(EngineDiscoveryRequest request) { + List> filters = new ArrayList<>(); + filters.addAll(request.getFiltersByType(PackageNameFilter.class)); + return Filter.composeFilters(filters).toPredicate(); + } + @Override public EngineDiscoveryRequest getDiscoveryRequest() { return request; @@ -288,6 +330,11 @@ public T getEngineDescriptor() { public Predicate getClassNameFilter() { return classNameFilter; } + + @Override + public Predicate getPackageFilter() { + return packageFilter; + } } } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/ResourceContainerSelectorResolver.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/ResourceContainerSelectorResolver.java new file mode 100644 index 000000000000..e5c41492b999 --- /dev/null +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/ResourceContainerSelectorResolver.java @@ -0,0 +1,74 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.engine.support.discovery; + +import static java.util.stream.Collectors.groupingBy; +import static java.util.stream.Collectors.toSet; +import static org.junit.platform.commons.support.ReflectionSupport.findAllResourcesInClasspathRoot; +import static org.junit.platform.commons.support.ReflectionSupport.findAllResourcesInPackage; +import static org.junit.platform.commons.util.ReflectionUtils.findAllResourcesInModule; +import static org.junit.platform.engine.support.discovery.ResourceUtils.packageName; +import static org.junit.platform.engine.support.discovery.SelectorResolver.Resolution.selectors; +import static org.junit.platform.engine.support.discovery.SelectorResolver.Resolution.unresolved; + +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; +import java.util.function.Predicate; + +import org.junit.platform.commons.support.Resource; +import org.junit.platform.engine.discovery.ClasspathResourceSelector; +import org.junit.platform.engine.discovery.ClasspathRootSelector; +import org.junit.platform.engine.discovery.DiscoverySelectors; +import org.junit.platform.engine.discovery.ModuleSelector; +import org.junit.platform.engine.discovery.PackageSelector; + +/** + * @since 1.12 + */ +class ResourceContainerSelectorResolver implements SelectorResolver { + private final Predicate resourceFilter; + + ResourceContainerSelectorResolver(Predicate resourceFilter, Predicate packageFilter) { + this.resourceFilter = packageName(packageFilter).and(resourceFilter); + } + + @Override + public Resolution resolve(ClasspathRootSelector selector, Context context) { + return resourceSelectors(findAllResourcesInClasspathRoot(selector.getClasspathRoot(), resourceFilter)); + } + + @Override + public Resolution resolve(ModuleSelector selector, Context context) { + return resourceSelectors(findAllResourcesInModule(selector.getModuleName(), resourceFilter)); + } + + @Override + public Resolution resolve(PackageSelector selector, Context context) { + return resourceSelectors(findAllResourcesInPackage(selector.getPackageName(), resourceFilter)); + } + + private Resolution resourceSelectors(List resources) { + Set selectors = resources.stream() // + .collect(groupingBy(Resource::getName)) // + .values() // + .stream() // + .map(LinkedHashSet::new) // + .map(DiscoverySelectors::selectClasspathResource) // + .collect(toSet()); + + if (selectors.isEmpty()) { + return unresolved(); + } + return selectors(selectors); + } + +} diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/ResourceUtils.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/ResourceUtils.java new file mode 100644 index 000000000000..02bcd3656c2a --- /dev/null +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/ResourceUtils.java @@ -0,0 +1,48 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.engine.support.discovery; + +import java.util.function.Predicate; + +import org.junit.platform.commons.support.ReflectionSupport; +import org.junit.platform.commons.support.Resource; + +/** + * Resource-related utilities to be used in conjunction with {@link ReflectionSupport}. + * + * @since 1.12 + */ +class ResourceUtils { + public static final String DEFAULT_PACKAGE_NAME = ""; + private static final char CLASSPATH_RESOURCE_PATH_SEPARATOR = '/'; + private static final char PACKAGE_SEPARATOR_CHAR = '.'; + + /** + * Match resources against a package filter. + * + *

    The {@code /} separated path of a resource is rewritten to a + * {@code .} separated package names. The package filter is applied to that + * package name. + */ + static Predicate packageName(Predicate packageFilter) { + return resource -> packageFilter.test(packageName(resource.getName())); + } + + private static String packageName(String classpathResourceName) { + int lastIndexOf = classpathResourceName.lastIndexOf(CLASSPATH_RESOURCE_PATH_SEPARATOR); + if (lastIndexOf < 0) { + return DEFAULT_PACKAGE_NAME; + } + // classpath resource names do not start with / + String resourcePackagePath = classpathResourceName.substring(0, lastIndexOf); + return resourcePackagePath.replace(CLASSPATH_RESOURCE_PATH_SEPARATOR, PACKAGE_SEPARATOR_CHAR); + } +} diff --git a/platform-tests/src/test/java/org/junit/platform/commons/support/ReflectionSupportTests.java b/platform-tests/src/test/java/org/junit/platform/commons/support/ReflectionSupportTests.java index 549a2bee7f8f..d86843227abc 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/support/ReflectionSupportTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/support/ReflectionSupportTests.java @@ -16,6 +16,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.platform.commons.support.PreconditionAssertions.assertPreconditionViolationException; import static org.junit.platform.commons.support.PreconditionAssertions.assertPreconditionViolationExceptionForString; +import static org.junit.platform.commons.util.ClassLoaderUtils.getDefaultClassLoader; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -119,6 +120,31 @@ List findAllClassesInClasspathRootDelegates() throws Throwable { return tests; } + /** + * @since 1.12 + */ + @Test + void tryToGetResourcesPreconditions() { + assertPreconditionViolationExceptionForString("Resource name", () -> ReflectionSupport.tryToGetResources(null)); + assertPreconditionViolationExceptionForString("Resource name", () -> ReflectionSupport.tryToGetResources("")); + assertPreconditionViolationException("Class loader", + () -> ReflectionSupport.tryToGetResources("default-package.resource", null)); + assertPreconditionViolationException("Class loader", + () -> ReflectionSupport.tryToGetResources("default-package.resource", null)); + } + + /** + * @since 1.12 + */ + @Test + void tryToGetResources() { + assertEquals(ReflectionUtils.tryToGetResources("default-package.resource").toOptional(), + ReflectionSupport.tryToGetResources("default-package.resource").toOptional()); + assertEquals( + ReflectionUtils.tryToGetResources("default-package.resource", getDefaultClassLoader()).toOptional(), // + ReflectionSupport.tryToGetResources("default-package.resource", getDefaultClassLoader()).toOptional()); + } + @Test void findAllClassesInClasspathRootPreconditions() { var path = Path.of(".").toUri(); diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java index 5f4cd8f1d431..c8d6e694ec0b 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java @@ -15,6 +15,8 @@ import static java.util.stream.Collectors.joining; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.junit.jupiter.api.Assertions.assertAll; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -66,6 +68,7 @@ import org.junit.platform.commons.JUnitException; import org.junit.platform.commons.PreconditionViolationException; import org.junit.platform.commons.logging.LogRecordListener; +import org.junit.platform.commons.support.Resource; import org.junit.platform.commons.test.TestClassLoader; import org.junit.platform.commons.util.ReflectionUtilsTests.NestedClassTests.ClassWithNestedClasses.Nested1; import org.junit.platform.commons.util.ReflectionUtilsTests.NestedClassTests.ClassWithNestedClasses.Nested2; @@ -709,6 +712,47 @@ private void privateMethod() { } + @Nested + class ResourceLoadingTests { + + @Test + void tryToGetResourcePreconditions() { + assertThrows(PreconditionViolationException.class, () -> ReflectionUtils.tryToGetResources("")); + assertThrows(PreconditionViolationException.class, () -> ReflectionUtils.tryToGetResources(" ")); + + assertThrows(PreconditionViolationException.class, () -> ReflectionUtils.tryToGetResources(null)); + assertThrows(PreconditionViolationException.class, + () -> ReflectionUtils.tryToGetResources("org/junit/platform/commons/example.resource", null)); + } + + @Test + void tryToGetResource() { + var tryToGetResource = ReflectionUtils.tryToGetResources("org/junit/platform/commons/example.resource"); + var resource = assertDoesNotThrow(tryToGetResource::get); + assertAll( // + () -> assertThat(resource).hasSize(1), // + () -> assertThat(resource).extracting(Resource::getName) // + .containsExactly("org/junit/platform/commons/example.resource")); + } + + @Test + void tryToGetResourceWithPrefixedSlash() { + var tryToGetResource = ReflectionUtils.tryToGetResources("/org/junit/platform/commons/example.resource"); + var resource = assertDoesNotThrow(tryToGetResource::get); + assertAll( // + () -> assertThat(resource).hasSize(1), // + () -> assertThat(resource).extracting(Resource::getName) // + .containsExactly("org/junit/platform/commons/example.resource")); + } + + @Test + void tryToGetResourceWhenResourceNotFound() { + var tryToGetResource = ReflectionUtils.tryToGetResources("org/junit/platform/commons/no-such.resource"); + var resource = assertDoesNotThrow(tryToGetResource::get); + assertThat(resource).isEmpty(); + } + } + @Nested class ClassLoadingTests { diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/DiscoverySelectorsTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/DiscoverySelectorsTests.java index 5a1a96506927..c37ce9e8286b 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/DiscoverySelectorsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/DiscoverySelectorsTests.java @@ -14,6 +14,7 @@ import static java.util.Objects.requireNonNull; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.InstanceOfAssertFactories.type; +import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.engine.discovery.JupiterUniqueIdBuilder.uniqueIdForMethod; @@ -38,6 +39,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.Collection; +import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.Set; @@ -53,6 +55,7 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import org.junit.platform.commons.PreconditionViolationException; +import org.junit.platform.commons.support.Resource; import org.junit.platform.commons.test.TestClassLoader; import org.junit.platform.commons.util.ReflectionUtils; import org.junit.platform.engine.DiscoverySelector; @@ -286,12 +289,22 @@ void parseDirectorySelectorWithAbsolutePath() { } @Test - void selectClasspathResources() { - assertViolatesPrecondition(() -> selectClasspathResource(null)); + void selectClasspathResourcesPreconditions() { + assertViolatesPrecondition(() -> selectClasspathResource((String) null)); assertViolatesPrecondition(() -> selectClasspathResource("")); assertViolatesPrecondition(() -> selectClasspathResource(" ")); assertViolatesPrecondition(() -> selectClasspathResource("\t")); + assertViolatesPrecondition(() -> selectClasspathResource((Set) null)); + assertViolatesPrecondition(() -> selectClasspathResource(Collections.emptySet())); + assertViolatesPrecondition(() -> selectClasspathResource(Collections.singleton(null))); + assertViolatesPrecondition(() -> selectClasspathResource(Set.of(new StubResource(null)))); + assertViolatesPrecondition(() -> selectClasspathResource(Set.of(new StubResource("")))); + assertViolatesPrecondition( + () -> selectClasspathResource(Set.of(new StubResource("a"), new StubResource("b")))); + } + @Test + void selectClasspathResources() { // with unnecessary "/" prefix var selector = selectClasspathResource("/foo/bar/spec.xml"); assertEquals("foo/bar/spec.xml", selector.getClasspathResourceName()); @@ -301,6 +314,23 @@ void selectClasspathResources() { assertEquals("A/B/C/spec.json", selector.getClasspathResourceName()); } + @Test + void getSelectedClasspathResources() { + var selector = selectClasspathResource("org/junit/platform/commons/example.resource"); + var classpathResources = selector.getClasspathResources(); + assertAll(() -> assertThat(classpathResources).hasSize(1), // + () -> assertThat(classpathResources) // + .extracting(Resource::getName) // + .containsExactly("org/junit/platform/commons/example.resource") // + ); + } + + @Test + void getMissingClasspathResources() { + var selector = selectClasspathResource("org/junit/platform/commons/no-such-example.resource"); + assertViolatesPrecondition(selector::getClasspathResources); + } + @Test void selectClasspathResourcesWithFilePosition() { var filePosition = FilePosition.from(12, 34); @@ -359,6 +389,23 @@ void parseClasspathResourcesWithFilePosition() { .containsExactly("A/B/C/spec.json", Optional.of(filePosition)); } + private static class StubResource implements Resource { + private final String name; + + private StubResource(String name) { + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public URI getUri() { + return null; + } + } } @Nested diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/discovery/ResourceContainerSelectorResolverTest.java b/platform-tests/src/test/java/org/junit/platform/engine/support/discovery/ResourceContainerSelectorResolverTest.java new file mode 100644 index 000000000000..9a6b8881699e --- /dev/null +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/discovery/ResourceContainerSelectorResolverTest.java @@ -0,0 +1,144 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.engine.support.discovery; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClasspathRoots; +import static org.junit.platform.engine.discovery.DiscoverySelectors.selectPackage; +import static org.junit.platform.engine.discovery.PackageNameFilter.includePackageNames; +import static org.junit.platform.engine.support.discovery.SelectorResolver.Match.exact; +import static org.junit.platform.engine.support.discovery.SelectorResolver.Resolution.match; + +import java.net.URI; +import java.nio.file.Path; +import java.util.Collections; +import java.util.Optional; +import java.util.Set; +import java.util.function.Predicate; + +import org.junit.jupiter.api.Test; +import org.junit.platform.commons.support.Resource; +import org.junit.platform.engine.TestDescriptor; +import org.junit.platform.engine.UniqueId; +import org.junit.platform.engine.discovery.ClasspathResourceSelector; +import org.junit.platform.engine.support.descriptor.EngineDescriptor; +import org.junit.platform.fakes.TestDescriptorStub; +import org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder; + +class ResourceContainerSelectorResolverTest { + + final TestDescriptor engineDescriptor = new EngineDescriptor(UniqueId.forEngine("resource-engine"), + "Resource Engine"); + final Predicate isResource = resource -> resource.getName().endsWith(".resource"); + + final EngineDiscoveryRequestResolver resolver = EngineDiscoveryRequestResolver.builder() // + .addResourceContainerSelectorResolver(isResource) // + .addSelectorResolver(new ResourceSelectorResolver()) // + .build(); + + @Test + void shouldDiscoverAllResourcesInPackage() { + var request = LauncherDiscoveryRequestBuilder.request() // + .selectors(selectPackage("org.junit.platform.commons")) // + .build(); + + resolver.resolve(request, engineDescriptor); + + // @formatter:off + assertThat(engineDescriptor.getChildren()) + .extracting(TestDescriptor::getDisplayName) + .containsExactlyInAnyOrder( + "org/junit/platform/commons/example.resource", + "org/junit/platform/commons/other-example.resource"); + // @formatter:on + + } + + @Test + void shouldDiscoverAllResourcesInRootPackage() { + var request = LauncherDiscoveryRequestBuilder.request() // + .selectors(selectPackage("")) // + .build(); + + resolver.resolve(request, engineDescriptor); + + // @formatter:off + assertThat(engineDescriptor.getChildren()) + .extracting(TestDescriptor::getDisplayName) + .containsExactlyInAnyOrder( + "default-package.resource", + "org/junit/platform/commons/example.resource", + "org/junit/platform/commons/other-example.resource"); + // @formatter:on + + } + + @Test + void shouldFilterPackages() { + var request = LauncherDiscoveryRequestBuilder.request() // + .selectors(selectPackage("")) // + .filters(includePackageNames("org.junit.platform")) // + .build(); + + resolver.resolve(request, engineDescriptor); + + // @formatter:off + assertThat(engineDescriptor.getChildren()) + .extracting(TestDescriptor::getDisplayName) + .containsExactlyInAnyOrder( + "org/junit/platform/commons/example.resource", + "org/junit/platform/commons/other-example.resource"); + // @formatter:on + + } + + @Test + void shouldDiscoverAllResourcesInClasspathRoot() { + var request = LauncherDiscoveryRequestBuilder.request() // + .selectors(selectClasspathRoots(getTestClasspathResourceRoot())) // + .build(); + + resolver.resolve(request, engineDescriptor); + + // @formatter:off + assertThat(engineDescriptor.getChildren()) + .extracting(TestDescriptor::getDisplayName) + .containsExactlyInAnyOrder( + "default-package.resource", + "org/junit/platform/commons/example.resource", + "org/junit/platform/commons/other-example.resource"); + // @formatter:on + } + + private Set getTestClasspathResourceRoot() { + // Gradle puts classes and resources in different roots. + var defaultPackageResource = "/default-package.resource"; + var resourceUri = getClass().getResource(defaultPackageResource).toString(); + var uri = URI.create(resourceUri.substring(0, resourceUri.length() - defaultPackageResource.length())); + return Collections.singleton(Path.of(uri)); + } + + private static class ResourceSelectorResolver implements SelectorResolver { + @Override + public Resolution resolve(ClasspathResourceSelector selector, Context context) { + return context.addToParent(parent -> createTestDescriptor(parent, selector.getClasspathResourceName())) // + .map(testDescriptor -> match(exact(testDescriptor))) // + .orElseGet(Resolution::unresolved); + } + + private static Optional createTestDescriptor(TestDescriptor parent, + String classpathResourceName) { + var uniqueId = parent.getUniqueId().append("resource", classpathResourceName); + var descriptor = new TestDescriptorStub(uniqueId, classpathResourceName); + return Optional.of(descriptor); + } + } +} From 5d06504856862c8b407c9b8f6e9bfd64fcd2a01f Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 29 Oct 2024 10:28:19 +0100 Subject: [PATCH 235/611] Polish contribution --- .../engine/discovery/DiscoverySelectorsTests.java | 9 ++------- .../discovery/ResourceContainerSelectorResolverTest.java | 3 --- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/DiscoverySelectorsTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/DiscoverySelectorsTests.java index c37ce9e8286b..df80a3f580c2 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/DiscoverySelectorsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/DiscoverySelectorsTests.java @@ -389,16 +389,11 @@ void parseClasspathResourcesWithFilePosition() { .containsExactly("A/B/C/spec.json", Optional.of(filePosition)); } - private static class StubResource implements Resource { - private final String name; - - private StubResource(String name) { - this.name = name; - } + private record StubResource(String name) implements Resource { @Override public String getName() { - return name; + return name(); } @Override diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/discovery/ResourceContainerSelectorResolverTest.java b/platform-tests/src/test/java/org/junit/platform/engine/support/discovery/ResourceContainerSelectorResolverTest.java index 9a6b8881699e..67ea75c1d0f6 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/discovery/ResourceContainerSelectorResolverTest.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/discovery/ResourceContainerSelectorResolverTest.java @@ -59,7 +59,6 @@ void shouldDiscoverAllResourcesInPackage() { "org/junit/platform/commons/example.resource", "org/junit/platform/commons/other-example.resource"); // @formatter:on - } @Test @@ -78,7 +77,6 @@ void shouldDiscoverAllResourcesInRootPackage() { "org/junit/platform/commons/example.resource", "org/junit/platform/commons/other-example.resource"); // @formatter:on - } @Test @@ -97,7 +95,6 @@ void shouldFilterPackages() { "org/junit/platform/commons/example.resource", "org/junit/platform/commons/other-example.resource"); // @formatter:on - } @Test From 6f821e9a8f04b89fc9750f5930bedd011f25303c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 29 Oct 2024 09:34:51 +0000 Subject: [PATCH 236/611] Update jackson monorepo to v2.18.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e707a0ebe9ae..53c7b2e3a6c8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,7 @@ assertj = "3.26.3" bnd = "7.0.0" checkstyle = "10.19.0" eclipse = "4.32.0" -jackson = "2.18.0" +jackson = "2.18.1" jacoco = "0.8.12" jmh = "1.37" junit4 = "4.13.2" From f32aa0a840da0115c8dd2d46547493e356e04475 Mon Sep 17 00:00:00 2001 From: Andreas Turban Date: Tue, 29 Oct 2024 12:26:18 +0100 Subject: [PATCH 237/611] Introduce PreInterruptCallback extension point (#3431) The new extension point allows defines the API for `Extensions` that wish to be called prior to invocations of `Thread#interrupt()` by the `@Timeout` extension. When enabled via the `junit.jupiter.execution.timeout.threaddump.enabled` configuration parameter, a default extension implementation that writes a thread dump to `System.out` is registered. Resolves #2938. --------- Co-authored-by: Marc Philipp --- .../src/docs/asciidoc/link-attributes.adoc | 1 + .../release-notes-5.12.0-M1.adoc | 1 + .../docs/asciidoc/user-guide/extensions.adoc | 9 + .../asciidoc/user-guide/writing-tests.adoc | 16 ++ .../api/AssertTimeoutPreemptively.java | 4 +- .../org/junit/jupiter/api/Assertions.java | 2 +- .../api/extension/PreInterruptCallback.java | 60 +++++ .../api/extension/PreInterruptContext.java | 35 +++ .../org/junit/jupiter/engine/Constants.java | 13 +- .../config/CachingJupiterConfiguration.java | 6 + .../config/DefaultJupiterConfiguration.java | 5 + .../engine/config/JupiterConfiguration.java | 4 + .../descriptor/AbstractExtensionContext.java | 21 +- .../descriptor/ClassBasedTestDescriptor.java | 5 +- .../descriptor/ClassExtensionContext.java | 17 +- .../descriptor/DynamicExtensionContext.java | 7 +- .../descriptor/DynamicNodeTestDescriptor.java | 4 +- .../descriptor/JupiterEngineDescriptor.java | 3 +- .../JupiterEngineExtensionContext.java | 8 +- .../descriptor/MethodExtensionContext.java | 8 +- .../descriptor/TestMethodTestDescriptor.java | 4 +- .../TestTemplateExtensionContext.java | 9 +- .../TestTemplateTestDescriptor.java | 4 +- .../extension/DefaultPreInterruptContext.java | 41 +++ .../extension/ExtensionContextInternal.java | 38 +++ .../extension/MutableExtensionRegistry.java | 9 + .../PreInterruptCallbackInvocation.java | 24 ++ ...PreInterruptCallbackInvocationFactory.java | 46 ++++ .../PreInterruptThreadDumpPrinter.java | 74 ++++++ .../SameThreadTimeoutInvocation.java | 21 +- .../SeparateThreadTimeoutInvocation.java | 7 +- .../engine/extension/TimeoutExtension.java | 4 +- .../extension/TimeoutInvocationFactory.java | 15 +- ...ertTimeoutPreemptivelyAssertionsTests.java | 4 +- .../api/extension/KitchenSinkExtension.java | 11 +- .../descriptor/ExtensionContextTests.java | 58 +++-- .../extension/PreInterruptCallbackTests.java | 244 ++++++++++++++++++ .../SameThreadTimeoutInvocationTests.java | 3 +- .../SeparateThreadTimeoutInvocationTests.java | 3 +- .../TimeoutInvocationFactoryTests.java | 3 +- .../tooling/support/tests/ArchUnitTests.java | 2 + 41 files changed, 766 insertions(+), 87 deletions(-) create mode 100644 junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptCallback.java create mode 100644 junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptContext.java create mode 100644 junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultPreInterruptContext.java create mode 100644 junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/ExtensionContextInternal.java create mode 100644 junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptCallbackInvocation.java create mode 100644 junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptCallbackInvocationFactory.java create mode 100644 junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptThreadDumpPrinter.java create mode 100644 jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/PreInterruptCallbackTests.java diff --git a/documentation/src/docs/asciidoc/link-attributes.adoc b/documentation/src/docs/asciidoc/link-attributes.adoc index 5c55bec09cf7..46da6e279efd 100644 --- a/documentation/src/docs/asciidoc/link-attributes.adoc +++ b/documentation/src/docs/asciidoc/link-attributes.adoc @@ -156,6 +156,7 @@ endif::[] :TestTemplateInvocationContext: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/TestTemplateInvocationContext.html[TestTemplateInvocationContext] :TestTemplateInvocationContextProvider: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.html[TestTemplateInvocationContextProvider] :TestWatcher: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/TestWatcher.html[TestWatcher] +:PreInterruptCallback: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/extension/PreInterruptCallback.html[PreInterruptCallback] // Jupiter Conditions :DisabledForJreRange: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/condition/DisabledForJreRange.html[@DisabledForJreRange] :DisabledIf: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/condition/DisabledIf.html[@DisabledIf] diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 0a247d5a0256..86e3bdcedd73 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -90,6 +90,7 @@ JUnit repository on GitHub. a test-scoped `ExtensionContext` in `Extension` methods called during test class instantiation. This behavior will become the default in future versions of JUnit. * `@TempDir` is now supported on test class constructors. +* Added `PreInterruptCallback` [[release-notes-5.12.0-M1-junit-vintage]] diff --git a/documentation/src/docs/asciidoc/user-guide/extensions.adoc b/documentation/src/docs/asciidoc/user-guide/extensions.adoc index 3e8c551415dc..d50940991b1c 100644 --- a/documentation/src/docs/asciidoc/user-guide/extensions.adoc +++ b/documentation/src/docs/asciidoc/user-guide/extensions.adoc @@ -715,6 +715,15 @@ test methods. include::{testDir}/example/exception/MultipleHandlersTestCase.java[tags=user_guide] ---- +[[extensions-preinterrupt-callback]] +=== Pre-Interrupt Callback + +`{PreInterruptCallback}` defines the API for `Extensions` that wish to react on +timeouts before the `Thread.interrupt()` is called. + +Please refer to <> for additional information. + + [[extensions-intercepting-invocations]] === Intercepting Invocations diff --git a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc index 8df05f70c3ba..b973308ddee4 100644 --- a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc +++ b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc @@ -2659,6 +2659,22 @@ asynchronous tests, consider using a dedicated library such as link:https://github.com/awaitility/awaitility[Awaitility]. +[[writing-tests-declarative-timeouts-debugging]] +=== Debugging Timeouts + +Registered <> extensions are called prior to invoking +`Thread.interrupt()` on the thread that is executing the timed out method. This allows to +inspect the application state and output additional information that might be helpful for +diagnosing the cause of a timeout. + + +[[writing-tests-declarative-timeouts-debugging-thread-dump]] +==== Thread Dump on Timeout +JUnit registers a default implementation of the <> extension point that +dumps the stacks of all threads to `System.out` if enabled by setting the +`junit.jupiter.execution.timeout.threaddump.enabled` configuration parameter to `true`. + + [[writing-tests-declarative-timeouts-mode]] ==== Disable @Timeout Globally When stepping through your code in a debug session, a fixed timeout limit may influence diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertTimeoutPreemptively.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertTimeoutPreemptively.java index 4585bb0e8927..aa68efbbcab8 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertTimeoutPreemptively.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertTimeoutPreemptively.java @@ -113,7 +113,7 @@ private static T resolveFutureAndHandleException(Future cause = new ExecutionTimeoutException("Execution timed out in thread " + thread.getName()); cause.setStackTrace(thread.getStackTrace()); } - throw failureFactory.createTimeoutFailure(timeout, messageSupplier, cause); + throw failureFactory.createTimeoutFailure(timeout, messageSupplier, cause, thread); } catch (ExecutionException ex) { throw throwAsUncheckedException(ex.getCause()); @@ -124,7 +124,7 @@ private static T resolveFutureAndHandleException(Future } private static AssertionFailedError createAssertionFailure(Duration timeout, Supplier messageSupplier, - Throwable cause) { + Throwable cause, Thread thread) { return assertionFailure() // .message(messageSupplier) // .reason("execution timed out after " + timeout.toMillis() + " ms") // diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Assertions.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Assertions.java index 3f5df08971a0..3b0bf640ac47 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Assertions.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Assertions.java @@ -3662,6 +3662,6 @@ public interface TimeoutFailureFactory { * * @return timeout failure; never {@code null} */ - T createTimeoutFailure(Duration timeout, Supplier messageSupplier, Throwable cause); + T createTimeoutFailure(Duration timeout, Supplier messageSupplier, Throwable cause, Thread testThread); } } diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptCallback.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptCallback.java new file mode 100644 index 000000000000..d32d77e34406 --- /dev/null +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptCallback.java @@ -0,0 +1,60 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.api.extension; + +import static org.apiguardian.api.API.Status.EXPERIMENTAL; + +import org.apiguardian.api.API; + +/** + * {@code PreInterruptCallback} defines the API for {@link Extension + * Extensions} that wish to be called prior to invocations of + * {@link Thread#interrupt()} by the {@link org.junit.jupiter.api.Timeout} + * extension. + * + *

    JUnit registers a default implementation that dumps the stacks of all + * {@linkplain Thread threads} to {@code System.out} if the + * {@value #THREAD_DUMP_ENABLED_PROPERTY_NAME} configuration parameter is set to + * {@code true}. + * + * @since 5.12 + * @see org.junit.jupiter.api.Timeout + */ +@API(status = EXPERIMENTAL, since = "5.12") +public interface PreInterruptCallback extends Extension { + + /** + * Property name used to enable dumping the stack of all + * {@linkplain Thread threads} to {@code System.out} when a timeout has occurred. + * + *

    This behavior is disabled by default. + * + * @since 5.12 + */ + @API(status = EXPERIMENTAL, since = "5.12") + String THREAD_DUMP_ENABLED_PROPERTY_NAME = "junit.jupiter.execution.timeout.threaddump.enabled"; + + /** + * Callback that is invoked before a {@link Thread} is interrupted with + * {@link Thread#interrupt()}. + * + *

    Note: There is no guarantee on which {@link Thread} this callback will be + * executed. + * + * @param preInterruptContext the context with the target {@link Thread}, which will get interrupted. + * @param extensionContext the extension context for the callback; never {@code null} + * @since 5.12 + * @see PreInterruptContext + */ + @API(status = EXPERIMENTAL, since = "5.12") + void beforeThreadInterrupt(PreInterruptContext preInterruptContext, ExtensionContext extensionContext) + throws Exception; +} diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptContext.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptContext.java new file mode 100644 index 000000000000..117ca0c9a457 --- /dev/null +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptContext.java @@ -0,0 +1,35 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.api.extension; + +import static org.apiguardian.api.API.Status.EXPERIMENTAL; + +import org.apiguardian.api.API; + +/** + * {@code PreInterruptContext} encapsulates the context in which an + * {@link PreInterruptCallback#beforeThreadInterrupt(PreInterruptContext, ExtensionContext) beforeThreadInterrupt} method is called. + * + * @since 5.12 + * @see PreInterruptCallback + */ +@API(status = EXPERIMENTAL, since = "5.12") +public interface PreInterruptContext { + + /** + * Get the {@link Thread} which will be interrupted. + * + * @return the Thread; never {@code null} + * @since 5.12 + */ + @API(status = EXPERIMENTAL, since = "5.12") + Thread getThreadToInterrupt(); +} diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java index 2f64dd866cd2..92c6990cb7ed 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java @@ -108,6 +108,17 @@ public final class Constants { */ public static final String EXTENSIONS_AUTODETECTION_ENABLED_PROPERTY_NAME = JupiterConfiguration.EXTENSIONS_AUTODETECTION_ENABLED_PROPERTY_NAME; + /** + * Property name used to enable dumping the stack of all + * {@linkplain Thread threads} to {@code System.out} when a timeout has occurred. + * + *

    This behavior is disabled by default. + * + * @since 5.12 + */ + @API(status = EXPERIMENTAL, since = "5.12") + public static final String EXTENSIONS_TIMEOUT_THREAD_DUMP_ENABLED_PROPERTY_NAME = JupiterConfiguration.EXTENSIONS_TIMEOUT_THREAD_DUMP_ENABLED_PROPERTY_NAME; + /** * Property name used to set the default test instance lifecycle mode: {@value} * @@ -192,7 +203,7 @@ public final class Constants { *

    When set to {@code false} the underlying fork-join pool will reject * additional tasks if all available workers are busy and the maximum * pool-size would be exceeded. - + * *

    Value must either {@code true} or {@code false}; defaults to {@code true}. * *

    Note: This property only takes affect on Java 9+. diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/CachingJupiterConfiguration.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/CachingJupiterConfiguration.java index 3082830d2146..f2e24ba494dc 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/CachingJupiterConfiguration.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/CachingJupiterConfiguration.java @@ -68,6 +68,12 @@ public boolean isExtensionAutoDetectionEnabled() { __ -> delegate.isExtensionAutoDetectionEnabled()); } + @Override + public boolean isThreadDumpOnTimeoutEnabled() { + return (boolean) cache.computeIfAbsent(EXTENSIONS_TIMEOUT_THREAD_DUMP_ENABLED_PROPERTY_NAME, + __ -> delegate.isThreadDumpOnTimeoutEnabled()); + } + @Override public ExecutionMode getDefaultExecutionMode() { return (ExecutionMode) cache.computeIfAbsent(DEFAULT_EXECUTION_MODE_PROPERTY_NAME, diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/DefaultJupiterConfiguration.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/DefaultJupiterConfiguration.java index 1057ab563b1f..b72b0362e638 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/DefaultJupiterConfiguration.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/DefaultJupiterConfiguration.java @@ -93,6 +93,11 @@ public boolean isExtensionAutoDetectionEnabled() { return configurationParameters.getBoolean(EXTENSIONS_AUTODETECTION_ENABLED_PROPERTY_NAME).orElse(false); } + @Override + public boolean isThreadDumpOnTimeoutEnabled() { + return configurationParameters.getBoolean(EXTENSIONS_TIMEOUT_THREAD_DUMP_ENABLED_PROPERTY_NAME).orElse(false); + } + @Override public ExecutionMode getDefaultExecutionMode() { return executionModeConverter.get(configurationParameters, DEFAULT_EXECUTION_MODE_PROPERTY_NAME, diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java index c695e7e4b10b..b342054c5cbf 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java @@ -23,6 +23,7 @@ import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.extension.ExecutionCondition; +import org.junit.jupiter.api.extension.PreInterruptCallback; import org.junit.jupiter.api.extension.TestInstantiationAwareExtension.ExtensionContextScope; import org.junit.jupiter.api.io.CleanupMode; import org.junit.jupiter.api.io.TempDirFactory; @@ -40,6 +41,7 @@ public interface JupiterConfiguration { String DEFAULT_EXECUTION_MODE_PROPERTY_NAME = Execution.DEFAULT_EXECUTION_MODE_PROPERTY_NAME; String DEFAULT_CLASSES_EXECUTION_MODE_PROPERTY_NAME = Execution.DEFAULT_CLASSES_EXECUTION_MODE_PROPERTY_NAME; String EXTENSIONS_AUTODETECTION_ENABLED_PROPERTY_NAME = "junit.jupiter.extensions.autodetection.enabled"; + String EXTENSIONS_TIMEOUT_THREAD_DUMP_ENABLED_PROPERTY_NAME = PreInterruptCallback.THREAD_DUMP_ENABLED_PROPERTY_NAME; String DEFAULT_TEST_INSTANCE_LIFECYCLE_PROPERTY_NAME = TestInstance.Lifecycle.DEFAULT_LIFECYCLE_PROPERTY_NAME; String DEFAULT_DISPLAY_NAME_GENERATOR_PROPERTY_NAME = DisplayNameGenerator.DEFAULT_GENERATOR_PROPERTY_NAME; String DEFAULT_TEST_METHOD_ORDER_PROPERTY_NAME = MethodOrderer.DEFAULT_ORDER_PROPERTY_NAME; @@ -54,6 +56,8 @@ public interface JupiterConfiguration { boolean isExtensionAutoDetectionEnabled(); + boolean isThreadDumpOnTimeoutEnabled(); + ExecutionMode getDefaultExecutionMode(); ExecutionMode getDefaultClassesExecutionMode(); diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/AbstractExtensionContext.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/AbstractExtensionContext.java index a1772e796146..4ff9573a32b6 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/AbstractExtensionContext.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/AbstractExtensionContext.java @@ -15,17 +15,22 @@ import java.util.Collections; import java.util.LinkedHashSet; +import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.function.Function; import org.junit.jupiter.api.extension.ExecutableInvoker; +import org.junit.jupiter.api.extension.Extension; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource; import org.junit.jupiter.api.parallel.ExecutionMode; import org.junit.jupiter.engine.config.JupiterConfiguration; +import org.junit.jupiter.engine.execution.DefaultExecutableInvoker; import org.junit.jupiter.engine.execution.NamespaceAwareStore; +import org.junit.jupiter.engine.extension.ExtensionContextInternal; +import org.junit.jupiter.engine.extension.ExtensionRegistry; import org.junit.platform.commons.JUnitException; import org.junit.platform.commons.util.Preconditions; import org.junit.platform.engine.EngineExecutionListener; @@ -38,7 +43,7 @@ /** * @since 5.0 */ -abstract class AbstractExtensionContext implements ExtensionContext, AutoCloseable { +abstract class AbstractExtensionContext implements ExtensionContextInternal, AutoCloseable { private static final NamespacedHierarchicalStore.CloseAction CLOSE_RESOURCES = (__, ___, value) -> { if (value instanceof CloseableResource) { @@ -53,20 +58,21 @@ abstract class AbstractExtensionContext implements Ext private final JupiterConfiguration configuration; private final NamespacedHierarchicalStore valuesStore; private final ExecutableInvoker executableInvoker; + private final ExtensionRegistry extensionRegistry; AbstractExtensionContext(ExtensionContext parent, EngineExecutionListener engineExecutionListener, T testDescriptor, - JupiterConfiguration configuration, - Function executableInvokerFactory) { - this.executableInvoker = executableInvokerFactory.apply(this); + JupiterConfiguration configuration, ExtensionRegistry extensionRegistry) { Preconditions.notNull(testDescriptor, "TestDescriptor must not be null"); Preconditions.notNull(configuration, "JupiterConfiguration must not be null"); - + Preconditions.notNull(extensionRegistry, "ExtensionRegistry must not be null"); + this.executableInvoker = new DefaultExecutableInvoker(this, extensionRegistry); this.parent = parent; this.engineExecutionListener = engineExecutionListener; this.testDescriptor = testDescriptor; this.configuration = configuration; this.valuesStore = createStore(parent); + this.extensionRegistry = extensionRegistry; // @formatter:off this.tags = testDescriptor.getTags().stream() @@ -152,6 +158,11 @@ public ExecutableInvoker getExecutableInvoker() { return executableInvoker; } + @Override + public List getExtensions(Class extensionType) { + return extensionRegistry.getExtensions(extensionType); + } + protected abstract Node.ExecutionMode getPlatformExecutionMode(); private ExecutionMode toJupiterExecutionMode(Node.ExecutionMode mode) { diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java index ee53adcb2500..2b6b93e79bc3 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java @@ -55,7 +55,6 @@ import org.junit.jupiter.engine.config.JupiterConfiguration; import org.junit.jupiter.engine.execution.AfterEachMethodAdapter; import org.junit.jupiter.engine.execution.BeforeEachMethodAdapter; -import org.junit.jupiter.engine.execution.DefaultExecutableInvoker; import org.junit.jupiter.engine.execution.DefaultTestInstances; import org.junit.jupiter.engine.execution.ExtensionContextSupplier; import org.junit.jupiter.engine.execution.InterceptingExecutableInvoker; @@ -181,8 +180,8 @@ public JupiterEngineExecutionContext prepare(JupiterEngineExecutionContext conte ThrowableCollector throwableCollector = createThrowableCollector(); ClassExtensionContext extensionContext = new ClassExtensionContext(context.getExtensionContext(), - context.getExecutionListener(), this, this.lifecycle, context.getConfiguration(), throwableCollector, - it -> new DefaultExecutableInvoker(it, registry)); + context.getExecutionListener(), this, this.lifecycle, context.getConfiguration(), registry, + throwableCollector); // @formatter:off return context.extend() diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassExtensionContext.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassExtensionContext.java index ddeb750dbb29..cc4fd4bec672 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassExtensionContext.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassExtensionContext.java @@ -13,13 +13,12 @@ import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import java.util.Optional; -import java.util.function.Function; import org.junit.jupiter.api.TestInstance.Lifecycle; -import org.junit.jupiter.api.extension.ExecutableInvoker; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.TestInstances; import org.junit.jupiter.engine.config.JupiterConfiguration; +import org.junit.jupiter.engine.extension.ExtensionRegistry; import org.junit.platform.engine.EngineExecutionListener; import org.junit.platform.engine.support.hierarchical.Node; import org.junit.platform.engine.support.hierarchical.ThrowableCollector; @@ -39,23 +38,21 @@ final class ClassExtensionContext extends AbstractExtensionContext executableInvokerFactory) { + ExtensionRegistry extensionRegistry, ThrowableCollector throwableCollector) { - this(parent, engineExecutionListener, testDescriptor, Lifecycle.PER_METHOD, configuration, throwableCollector, - executableInvokerFactory); + this(parent, engineExecutionListener, testDescriptor, Lifecycle.PER_METHOD, configuration, extensionRegistry, + throwableCollector); } ClassExtensionContext(ExtensionContext parent, EngineExecutionListener engineExecutionListener, ClassBasedTestDescriptor testDescriptor, Lifecycle lifecycle, JupiterConfiguration configuration, - ThrowableCollector throwableCollector, - Function executableInvokerFactory) { + ExtensionRegistry extensionRegistry, ThrowableCollector throwableCollector) { - super(parent, engineExecutionListener, testDescriptor, configuration, executableInvokerFactory); + super(parent, engineExecutionListener, testDescriptor, configuration, extensionRegistry); this.lifecycle = lifecycle; this.throwableCollector = throwableCollector; diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicExtensionContext.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicExtensionContext.java index 0bc5c0542167..2cc4e130a5b2 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicExtensionContext.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicExtensionContext.java @@ -13,13 +13,12 @@ import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import java.util.Optional; -import java.util.function.Function; import org.junit.jupiter.api.TestInstance; -import org.junit.jupiter.api.extension.ExecutableInvoker; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.TestInstances; import org.junit.jupiter.engine.config.JupiterConfiguration; +import org.junit.jupiter.engine.extension.ExtensionRegistry; import org.junit.platform.engine.EngineExecutionListener; import org.junit.platform.engine.support.hierarchical.Node; @@ -27,8 +26,8 @@ class DynamicExtensionContext extends AbstractExtensionContext executableInvokerFactory) { - super(parent, engineExecutionListener, testDescriptor, configuration, executableInvokerFactory); + ExtensionRegistry extensionRegistry) { + super(parent, engineExecutionListener, testDescriptor, configuration, extensionRegistry); } @Override diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicNodeTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicNodeTestDescriptor.java index ba07a11b6ec4..4fc200a9e4a2 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicNodeTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicNodeTestDescriptor.java @@ -12,7 +12,6 @@ import org.junit.jupiter.api.DynamicNode; import org.junit.jupiter.engine.config.JupiterConfiguration; -import org.junit.jupiter.engine.execution.DefaultExecutableInvoker; import org.junit.jupiter.engine.execution.JupiterEngineExecutionContext; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.TestSource; @@ -46,8 +45,7 @@ public String getLegacyReportingName() { @Override public JupiterEngineExecutionContext prepare(JupiterEngineExecutionContext context) { DynamicExtensionContext extensionContext = new DynamicExtensionContext(context.getExtensionContext(), - context.getExecutionListener(), this, context.getConfiguration(), - it -> new DefaultExecutableInvoker(it, context.getExtensionRegistry())); + context.getExecutionListener(), this, context.getConfiguration(), context.getExtensionRegistry()); // @formatter:off return context.extend() .withExtensionContext(extensionContext) diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterEngineDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterEngineDescriptor.java index 0f87b7a182b2..50d694b46f5e 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterEngineDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterEngineDescriptor.java @@ -16,7 +16,6 @@ import org.apiguardian.api.API; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.engine.config.JupiterConfiguration; -import org.junit.jupiter.engine.execution.DefaultExecutableInvoker; import org.junit.jupiter.engine.execution.JupiterEngineExecutionContext; import org.junit.jupiter.engine.extension.MutableExtensionRegistry; import org.junit.platform.engine.EngineExecutionListener; @@ -53,7 +52,7 @@ public JupiterEngineExecutionContext prepare(JupiterEngineExecutionContext conte context.getConfiguration()); EngineExecutionListener executionListener = context.getExecutionListener(); ExtensionContext extensionContext = new JupiterEngineExtensionContext(executionListener, this, - context.getConfiguration(), it -> new DefaultExecutableInvoker(it, extensionRegistry)); + context.getConfiguration(), extensionRegistry); // @formatter:off return context.extend() diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterEngineExtensionContext.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterEngineExtensionContext.java index 988dc8ea0254..88d94db6225d 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterEngineExtensionContext.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterEngineExtensionContext.java @@ -13,13 +13,11 @@ import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import java.util.Optional; -import java.util.function.Function; import org.junit.jupiter.api.TestInstance.Lifecycle; -import org.junit.jupiter.api.extension.ExecutableInvoker; -import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.TestInstances; import org.junit.jupiter.engine.config.JupiterConfiguration; +import org.junit.jupiter.engine.extension.ExtensionRegistry; import org.junit.platform.engine.EngineExecutionListener; import org.junit.platform.engine.support.hierarchical.Node; @@ -30,9 +28,9 @@ final class JupiterEngineExtensionContext extends AbstractExtensionContext executableInvokerFactory) { + ExtensionRegistry extensionRegistry) { - super(null, engineExecutionListener, testDescriptor, configuration, executableInvokerFactory); + super(null, engineExecutionListener, testDescriptor, configuration, extensionRegistry); } @Override diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodExtensionContext.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodExtensionContext.java index 6c5e2efc6fbf..2c51ad7e5862 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodExtensionContext.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodExtensionContext.java @@ -13,13 +13,12 @@ import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import java.util.Optional; -import java.util.function.Function; import org.junit.jupiter.api.TestInstance.Lifecycle; -import org.junit.jupiter.api.extension.ExecutableInvoker; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.TestInstances; import org.junit.jupiter.engine.config.JupiterConfiguration; +import org.junit.jupiter.engine.extension.ExtensionRegistry; import org.junit.platform.engine.EngineExecutionListener; import org.junit.platform.engine.support.hierarchical.Node; import org.junit.platform.engine.support.hierarchical.ThrowableCollector; @@ -35,10 +34,9 @@ final class MethodExtensionContext extends AbstractExtensionContext executableInvokerFactory) { + ExtensionRegistry extensionRegistry, ThrowableCollector throwableCollector) { - super(parent, engineExecutionListener, testDescriptor, configuration, executableInvokerFactory); + super(parent, engineExecutionListener, testDescriptor, configuration, extensionRegistry); this.throwableCollector = throwableCollector; } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestMethodTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestMethodTestDescriptor.java index d9da3cb4da7a..b2c7830da1a9 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestMethodTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestMethodTestDescriptor.java @@ -35,7 +35,6 @@ import org.junit.jupiter.engine.config.JupiterConfiguration; import org.junit.jupiter.engine.execution.AfterEachMethodAdapter; import org.junit.jupiter.engine.execution.BeforeEachMethodAdapter; -import org.junit.jupiter.engine.execution.DefaultExecutableInvoker; import org.junit.jupiter.engine.execution.InterceptingExecutableInvoker; import org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.ReflectiveInterceptorCall; import org.junit.jupiter.engine.execution.JupiterEngineExecutionContext; @@ -99,8 +98,7 @@ public JupiterEngineExecutionContext prepare(JupiterEngineExecutionContext conte MutableExtensionRegistry registry = populateNewExtensionRegistry(context); ThrowableCollector throwableCollector = createThrowableCollector(); MethodExtensionContext extensionContext = new MethodExtensionContext(context.getExtensionContext(), - context.getExecutionListener(), this, context.getConfiguration(), throwableCollector, - it -> new DefaultExecutableInvoker(it, registry)); + context.getExecutionListener(), this, context.getConfiguration(), registry, throwableCollector); // @formatter:off JupiterEngineExecutionContext newContext = context.extend() .withExtensionRegistry(registry) diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateExtensionContext.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateExtensionContext.java index ae4f92b8195f..9d40ec8fa1bb 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateExtensionContext.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateExtensionContext.java @@ -13,13 +13,12 @@ import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; import java.util.Optional; -import java.util.function.Function; import org.junit.jupiter.api.TestInstance.Lifecycle; -import org.junit.jupiter.api.extension.ExecutableInvoker; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.TestInstances; import org.junit.jupiter.engine.config.JupiterConfiguration; +import org.junit.jupiter.engine.extension.ExtensionRegistry; import org.junit.platform.engine.EngineExecutionListener; import org.junit.platform.engine.support.hierarchical.Node; @@ -31,10 +30,10 @@ final class TestTemplateExtensionContext extends AbstractExtensionContext executableInvokerFactory) { + TestTemplateTestDescriptor testDescriptor, JupiterConfiguration configuration, + ExtensionRegistry extensionRegistry, TestInstances testInstances) { - super(parent, engineExecutionListener, testDescriptor, configuration, executableInvokerFactory); + super(parent, engineExecutionListener, testDescriptor, configuration, extensionRegistry); this.testInstances = testInstances; } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java index fee7c3906d15..53206b685d07 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java @@ -26,7 +26,6 @@ import org.junit.jupiter.api.extension.TestTemplateInvocationContext; import org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider; import org.junit.jupiter.engine.config.JupiterConfiguration; -import org.junit.jupiter.engine.execution.DefaultExecutableInvoker; import org.junit.jupiter.engine.execution.JupiterEngineExecutionContext; import org.junit.jupiter.engine.extension.ExtensionRegistry; import org.junit.jupiter.engine.extension.MutableExtensionRegistry; @@ -81,8 +80,7 @@ public JupiterEngineExecutionContext prepare(JupiterEngineExecutionContext conte TestInstances testInstances = context.getExtensionContext().getTestInstances().orElse(null); ExtensionContext extensionContext = new TestTemplateExtensionContext(context.getExtensionContext(), - context.getExecutionListener(), this, context.getConfiguration(), testInstances, - it -> new DefaultExecutableInvoker(it, registry)); + context.getExecutionListener(), this, context.getConfiguration(), registry, testInstances); // @formatter:off return context.extend() diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultPreInterruptContext.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultPreInterruptContext.java new file mode 100644 index 000000000000..5dfb552d9412 --- /dev/null +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultPreInterruptContext.java @@ -0,0 +1,41 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.engine.extension; + +import org.junit.jupiter.api.extension.PreInterruptContext; +import org.junit.platform.commons.util.Preconditions; +import org.junit.platform.commons.util.ToStringBuilder; + +/** + * @since 5.12 + */ +class DefaultPreInterruptContext implements PreInterruptContext { + private final Thread threadToInterrupt; + + DefaultPreInterruptContext(Thread threadToInterrupt) { + Preconditions.notNull(threadToInterrupt, "threadToInterrupt must not be null"); + this.threadToInterrupt = threadToInterrupt; + } + + @Override + public Thread getThreadToInterrupt() { + return threadToInterrupt; + } + + @Override + public String toString() { + // @formatter:off + return new ToStringBuilder(this) + .append("threadToInterrupt", this.threadToInterrupt) + .toString(); + // @formatter:on + } +} diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/ExtensionContextInternal.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/ExtensionContextInternal.java new file mode 100644 index 000000000000..26a1f3f316aa --- /dev/null +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/ExtensionContextInternal.java @@ -0,0 +1,38 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.engine.extension; + +import static org.apiguardian.api.API.Status.INTERNAL; + +import java.util.List; + +import org.apiguardian.api.API; +import org.junit.jupiter.api.extension.Extension; +import org.junit.jupiter.api.extension.ExtensionContext; + +/** + * {@code ExtensionContextInternal} extends the {@link ExtensionContext} with internal API. + * + * @since 5.12 + * @see ExtensionContext + */ +@API(status = INTERNAL, since = "5.12") +public interface ExtensionContextInternal extends ExtensionContext { + + /** + * Returns a list of registered extension at this context of the passed {@code extensionType}. + * + * @param the extension type + * @param extensionType the extension type + * @return the list of extensions + */ + List getExtensions(Class extensionType); +} diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/MutableExtensionRegistry.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/MutableExtensionRegistry.java index 5a719f8b2817..676598c7abe0 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/MutableExtensionRegistry.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/MutableExtensionRegistry.java @@ -66,6 +66,11 @@ public class MutableExtensionRegistry implements ExtensionRegistry, ExtensionReg * auto-detected using Java's {@link ServiceLoader} mechanism and automatically * registered after the default extensions. * + *

    If the + * {@value org.junit.jupiter.engine.Constants#EXTENSIONS_TIMEOUT_THREAD_DUMP_ENABLED_PROPERTY_NAME} + * configuration parameter has been set to {@code true}, the + * {@link PreInterruptThreadDumpPrinter} will be registered. + * * @param configuration configuration parameters used to retrieve the extension * auto-detection flag; never {@code null} * @return a new {@code ExtensionRegistry}; never {@code null} @@ -81,6 +86,10 @@ public static MutableExtensionRegistry createRegistryWithDefaultExtensions(Jupit registerAutoDetectedExtensions(extensionRegistry); } + if (configuration.isThreadDumpOnTimeoutEnabled()) { + extensionRegistry.registerDefaultExtension(new PreInterruptThreadDumpPrinter()); + } + return extensionRegistry; } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptCallbackInvocation.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptCallbackInvocation.java new file mode 100644 index 000000000000..290c3464ca2a --- /dev/null +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptCallbackInvocation.java @@ -0,0 +1,24 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.engine.extension; + +import java.util.function.Consumer; + +/** + * @since 5.12 + */ +@FunctionalInterface +interface PreInterruptCallbackInvocation { + PreInterruptCallbackInvocation NOOP = (t, e) -> { + }; + + void executePreInterruptCallback(Thread threadToInterrupt, Consumer errorHandler); +} diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptCallbackInvocationFactory.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptCallbackInvocationFactory.java new file mode 100644 index 000000000000..a265a2435a76 --- /dev/null +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptCallbackInvocationFactory.java @@ -0,0 +1,46 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.engine.extension; + +import java.util.List; + +import org.junit.jupiter.api.extension.PreInterruptCallback; +import org.junit.jupiter.api.extension.PreInterruptContext; +import org.junit.platform.commons.util.UnrecoverableExceptions; + +/** + * @since 5.12 + * @see PreInterruptCallbackInvocation + */ +final class PreInterruptCallbackInvocationFactory { + + private PreInterruptCallbackInvocationFactory() { + } + + static PreInterruptCallbackInvocation create(ExtensionContextInternal extensionContext) { + final List callbacks = extensionContext.getExtensions(PreInterruptCallback.class); + if (callbacks.isEmpty()) { + return PreInterruptCallbackInvocation.NOOP; + } + return (thread, errorHandler) -> { + PreInterruptContext preInterruptContext = new DefaultPreInterruptContext(thread); + for (PreInterruptCallback callback : callbacks) { + try { + callback.beforeThreadInterrupt(preInterruptContext, extensionContext); + } + catch (Throwable ex) { + UnrecoverableExceptions.rethrowIfUnrecoverable(ex); + errorHandler.accept(ex); + } + } + }; + } +} diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptThreadDumpPrinter.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptThreadDumpPrinter.java new file mode 100644 index 000000000000..b454d96a7277 --- /dev/null +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptThreadDumpPrinter.java @@ -0,0 +1,74 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.engine.extension; + +import java.util.Map; + +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.PreInterruptCallback; +import org.junit.jupiter.api.extension.PreInterruptContext; +import org.junit.jupiter.engine.Constants; + +/** + * The default implementation for {@link PreInterruptCallback}, + * which will print the stacks of all {@link Thread}s to {@code System.out}. + * + *

    Note: This is disabled by default, and must be enabled with + * {@link Constants#EXTENSIONS_TIMEOUT_THREAD_DUMP_ENABLED_PROPERTY_NAME} + * + * @since 5.12 + */ +final class PreInterruptThreadDumpPrinter implements PreInterruptCallback { + private static final String NL = "\n"; + + @Override + public void beforeThreadInterrupt(PreInterruptContext preInterruptContext, ExtensionContext extensionContext) { + Map stackTraces = Thread.getAllStackTraces(); + StringBuilder sb = new StringBuilder(); + sb.append("Thread "); + appendThreadName(sb, preInterruptContext.getThreadToInterrupt()); + sb.append(" will be interrupted."); + sb.append(NL); + for (Map.Entry entry : stackTraces.entrySet()) { + Thread thread = entry.getKey(); + StackTraceElement[] stack = entry.getValue(); + if (stack.length > 0) { + sb.append(NL); + appendThreadName(sb, thread); + for (StackTraceElement stackTraceElement : stack) { + sb.append(NL); + //Do the same prefix as java.lang.Throwable.printStackTrace(java.lang.Throwable.PrintStreamOrWriter) + sb.append("\tat "); + sb.append(stackTraceElement.toString()); + + } + sb.append(NL); + } + } + System.out.println(sb); + } + + /** + * Appends the {@link Thread} name and ID in a similar fashion as {@code jstack}. + * @param sb the buffer + * @param th the thread to append + */ + private void appendThreadName(StringBuilder sb, Thread th) { + sb.append("\""); + sb.append(th.getName()); + sb.append("\""); + sb.append(" #"); + sb.append(th.getId()); + if (th.isDaemon()) { + sb.append(" daemon"); + } + } +} diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/SameThreadTimeoutInvocation.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/SameThreadTimeoutInvocation.java index fc4834eff4e9..38d7526a7875 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/SameThreadTimeoutInvocation.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/SameThreadTimeoutInvocation.java @@ -10,6 +10,8 @@ package org.junit.jupiter.engine.extension; +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.function.Supplier; @@ -26,18 +28,20 @@ class SameThreadTimeoutInvocation implements Invocation { private final TimeoutDuration timeout; private final ScheduledExecutorService executor; private final Supplier descriptionSupplier; + private final PreInterruptCallbackInvocation preInterruptCallback; SameThreadTimeoutInvocation(Invocation delegate, TimeoutDuration timeout, ScheduledExecutorService executor, - Supplier descriptionSupplier) { + Supplier descriptionSupplier, PreInterruptCallbackInvocation preInterruptCallback) { this.delegate = delegate; this.timeout = timeout; this.executor = executor; this.descriptionSupplier = descriptionSupplier; + this.preInterruptCallback = preInterruptCallback; } @Override public T proceed() throws Throwable { - InterruptTask interruptTask = new InterruptTask(Thread.currentThread()); + InterruptTask interruptTask = new InterruptTask(Thread.currentThread(), preInterruptCallback); ScheduledFuture future = executor.schedule(interruptTask, timeout.getValue(), timeout.getUnit()); Throwable failure = null; T result = null; @@ -56,6 +60,7 @@ public T proceed() throws Throwable { if (interruptTask.executed) { Thread.interrupted(); failure = TimeoutExceptionFactory.create(descriptionSupplier.get(), timeout, failure); + interruptTask.attachSuppressedExceptions(failure); } } if (failure != null) { @@ -65,20 +70,28 @@ public T proceed() throws Throwable { } static class InterruptTask implements Runnable { - + private final PreInterruptCallbackInvocation preInterruptCallback; + private final List exceptionsDuringInterruption = new CopyOnWriteArrayList<>(); private final Thread thread; private volatile boolean executed; - InterruptTask(Thread thread) { + InterruptTask(Thread thread, PreInterruptCallbackInvocation preInterruptCallback) { this.thread = thread; + this.preInterruptCallback = preInterruptCallback; } @Override public void run() { executed = true; + preInterruptCallback.executePreInterruptCallback(thread, exceptionsDuringInterruption::add); thread.interrupt(); } + void attachSuppressedExceptions(Throwable outerException) { + for (Throwable throwable : exceptionsDuringInterruption) { + outerException.addSuppressed(throwable); + } + } } } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/SeparateThreadTimeoutInvocation.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/SeparateThreadTimeoutInvocation.java index f102bae0cf9a..df176021f96e 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/SeparateThreadTimeoutInvocation.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/SeparateThreadTimeoutInvocation.java @@ -25,19 +25,22 @@ class SeparateThreadTimeoutInvocation implements Invocation { private final Invocation delegate; private final TimeoutDuration timeout; private final Supplier descriptionSupplier; + private final PreInterruptCallbackInvocation preInterruptCallback; SeparateThreadTimeoutInvocation(Invocation delegate, TimeoutDuration timeout, - Supplier descriptionSupplier) { + Supplier descriptionSupplier, PreInterruptCallbackInvocation preInterruptCallback) { this.delegate = delegate; this.timeout = timeout; this.descriptionSupplier = descriptionSupplier; + this.preInterruptCallback = preInterruptCallback; } @Override public T proceed() throws Throwable { return assertTimeoutPreemptively(timeout.toDuration(), delegate::proceed, descriptionSupplier, - (__, messageSupplier, cause) -> { + (__, messageSupplier, cause, testThread) -> { TimeoutException exception = TimeoutExceptionFactory.create(messageSupplier.get(), timeout, null); + preInterruptCallback.executePreInterruptCallback(testThread, exception::addSuppressed); exception.initCause(cause); return exception; }); diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutExtension.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutExtension.java index f8b87a62bed8..44d0a402c387 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutExtension.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutExtension.java @@ -182,8 +182,8 @@ private Invocation decorate(Invocation invocation, ReflectiveInvocatio ThreadMode threadMode = resolveTimeoutThreadMode(extensionContext); return new TimeoutInvocationFactory(extensionContext.getRoot().getStore(NAMESPACE)).create(threadMode, - new TimeoutInvocationParameters<>(invocation, timeout, - () -> describe(invocationContext, extensionContext))); + new TimeoutInvocationParameters<>(invocation, timeout, () -> describe(invocationContext, extensionContext), + PreInterruptCallbackInvocationFactory.create((ExtensionContextInternal) extensionContext))); } private ThreadMode resolveTimeoutThreadMode(ExtensionContext extensionContext) { diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactory.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactory.java index 004915069e32..a782c8e6bee8 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactory.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactory.java @@ -39,11 +39,13 @@ Invocation create(ThreadMode threadMode, TimeoutInvocationParameters t Preconditions.notNull(timeoutInvocationParameters, "timeout invocation parameters must not be null"); if (threadMode == ThreadMode.SEPARATE_THREAD) { return new SeparateThreadTimeoutInvocation<>(timeoutInvocationParameters.getInvocation(), - timeoutInvocationParameters.getTimeoutDuration(), timeoutInvocationParameters.getDescriptionSupplier()); + timeoutInvocationParameters.getTimeoutDuration(), timeoutInvocationParameters.getDescriptionSupplier(), + timeoutInvocationParameters.getPreInterruptCallback()); } return new SameThreadTimeoutInvocation<>(timeoutInvocationParameters.getInvocation(), timeoutInvocationParameters.getTimeoutDuration(), getThreadExecutorForSameThreadInvocation(), - timeoutInvocationParameters.getDescriptionSupplier()); + timeoutInvocationParameters.getDescriptionSupplier(), + timeoutInvocationParameters.getPreInterruptCallback()); } private ScheduledExecutorService getThreadExecutorForSameThreadInvocation() { @@ -90,13 +92,16 @@ static class TimeoutInvocationParameters { private final Invocation invocation; private final TimeoutDuration timeout; private final Supplier descriptionSupplier; + private final PreInterruptCallbackInvocation preInterruptCallback; TimeoutInvocationParameters(Invocation invocation, TimeoutDuration timeout, - Supplier descriptionSupplier) { + Supplier descriptionSupplier, PreInterruptCallbackInvocation preInterruptCallback) { this.invocation = Preconditions.notNull(invocation, "invocation must not be null"); this.timeout = Preconditions.notNull(timeout, "timeout must not be null"); this.descriptionSupplier = Preconditions.notNull(descriptionSupplier, "description supplier must not be null"); + this.preInterruptCallback = Preconditions.notNull(preInterruptCallback, + "preInterruptCallback must not be null"); } public Invocation getInvocation() { @@ -110,5 +115,9 @@ public TimeoutDuration getTimeoutDuration() { public Supplier getDescriptionSupplier() { return descriptionSupplier; } + + public PreInterruptCallbackInvocation getPreInterruptCallback() { + return preInterruptCallback; + } } } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertTimeoutPreemptivelyAssertionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertTimeoutPreemptivelyAssertionsTests.java index c445f86f67fc..94ee07931088 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertTimeoutPreemptivelyAssertionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertTimeoutPreemptivelyAssertionsTests.java @@ -40,8 +40,8 @@ class AssertTimeoutPreemptivelyAssertionsTests { private static final Duration PREEMPTIVE_TIMEOUT = ofMillis(WINDOWS.isCurrentOs() ? 1000 : 100); - private static final Assertions.TimeoutFailureFactory TIMEOUT_EXCEPTION_FACTORY = (__, ___, - ____) -> new TimeoutException(); + private static final Assertions.TimeoutFailureFactory TIMEOUT_EXCEPTION_FACTORY = (__, ___, ____, + _____) -> new TimeoutException(); private static final ThreadLocal changed = ThreadLocal.withInitial(() -> new AtomicBoolean(false)); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java index 03106324eec7..8ee6b62a4075 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java @@ -60,7 +60,8 @@ public class KitchenSinkExtension implements // Miscellaneous TestWatcher, - InvocationInterceptor + InvocationInterceptor, + PreInterruptCallback // @formatter:on { @@ -254,4 +255,12 @@ public void interceptAfterAllMethod(Invocation invocation, ReflectiveInvocationContext invocationContext, ExtensionContext extensionContext) throws Throwable { InvocationInterceptor.super.interceptAfterAllMethod(invocation, invocationContext, extensionContext); } + + // --- PreInterruptCallback ------------------------------------------------ + + @Override + public void beforeThreadInterrupt(PreInterruptContext preInterruptContext, ExtensionContext extensionContext) + throws Exception { + + } } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java index d8c6014eadd7..779ff8620904 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java @@ -32,12 +32,15 @@ import org.junit.jupiter.api.Named; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.Extension; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ExtensionContext.Namespace; +import org.junit.jupiter.api.extension.PreInterruptCallback; import org.junit.jupiter.api.parallel.ExecutionMode; import org.junit.jupiter.engine.config.DefaultJupiterConfiguration; import org.junit.jupiter.engine.config.JupiterConfiguration; import org.junit.jupiter.engine.execution.DefaultTestInstances; +import org.junit.jupiter.engine.extension.ExtensionRegistry; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import org.junit.platform.commons.PreconditionViolationException; @@ -62,6 +65,7 @@ public class ExtensionContextTests { private final JupiterConfiguration configuration = mock(); + private final ExtensionRegistry extensionRegistry = mock(); @BeforeEach void setUp() { @@ -76,7 +80,7 @@ void fromJupiterEngineDescriptor() { UniqueId.root("engine", "junit-jupiter"), configuration); try (var engineContext = new JupiterEngineExtensionContext(null, engineTestDescriptor, configuration, - __ -> null)) { + extensionRegistry)) { // @formatter:off assertAll("engineContext", () -> assertThat(engineContext.getElement()).isEmpty(), @@ -89,7 +93,8 @@ void fromJupiterEngineDescriptor() { () -> assertThat(engineContext.getDisplayName()).isEqualTo(engineTestDescriptor.getDisplayName()), () -> assertThat(engineContext.getParent()).isEmpty(), () -> assertThat(engineContext.getRoot()).isSameAs(engineContext), - () -> assertThat(engineContext.getExecutionMode()).isEqualTo(ExecutionMode.SAME_THREAD) + () -> assertThat(engineContext.getExecutionMode()).isEqualTo(ExecutionMode.SAME_THREAD), + () -> assertThat(engineContext.getExtensions(PreInterruptCallback.class)).isEmpty() ); // @formatter:on } @@ -102,7 +107,7 @@ void fromClassTestDescriptor() { ClassTestDescriptor outerClassDescriptor = outerClassDescriptor(nestedClassDescriptor); ClassExtensionContext outerExtensionContext = new ClassExtensionContext(null, null, outerClassDescriptor, - configuration, null, __ -> null); + configuration, extensionRegistry, null); // @formatter:off assertAll("outerContext", @@ -115,15 +120,29 @@ void fromClassTestDescriptor() { () -> assertThrows(PreconditionViolationException.class, outerExtensionContext::getRequiredTestMethod), () -> assertThat(outerExtensionContext.getDisplayName()).isEqualTo(outerClassDescriptor.getDisplayName()), () -> assertThat(outerExtensionContext.getParent()).isEmpty(), - () -> assertThat(outerExtensionContext.getExecutionMode()).isEqualTo(ExecutionMode.SAME_THREAD) + () -> assertThat(outerExtensionContext.getExecutionMode()).isEqualTo(ExecutionMode.SAME_THREAD), + () -> assertThat(outerExtensionContext.getExtensions(PreInterruptCallback.class)).isEmpty() ); // @formatter:on ClassExtensionContext nestedExtensionContext = new ClassExtensionContext(outerExtensionContext, null, - nestedClassDescriptor, configuration, null, __ -> null); + nestedClassDescriptor, configuration, extensionRegistry, null); assertThat(nestedExtensionContext.getParent()).containsSame(outerExtensionContext); } + @Test + void ExtensionContext_With_ExtensionRegistry_getExtensions() { + NestedClassTestDescriptor classTestDescriptor = nestedClassDescriptor(); + try (ClassExtensionContext ctx = new ClassExtensionContext(null, null, classTestDescriptor, configuration, + extensionRegistry, null)) { + + Extension ext = mock(); + when(extensionRegistry.getExtensions(Extension.class)).thenReturn(List.of(ext)); + + assertThat(ctx.getExtensions(Extension.class)).isEqualTo(List.of(ext)); + } + } + @Test @SuppressWarnings("resource") void tagsCanBeRetrievedInExtensionContext() { @@ -133,18 +152,18 @@ void tagsCanBeRetrievedInExtensionContext() { outerClassDescriptor.addChild(methodTestDescriptor); ClassExtensionContext outerExtensionContext = new ClassExtensionContext(null, null, outerClassDescriptor, - configuration, null, __ -> null); + configuration, extensionRegistry, null); assertThat(outerExtensionContext.getTags()).containsExactly("outer-tag"); assertThat(outerExtensionContext.getRoot()).isSameAs(outerExtensionContext); ClassExtensionContext nestedExtensionContext = new ClassExtensionContext(outerExtensionContext, null, - nestedClassDescriptor, configuration, null, __ -> null); + nestedClassDescriptor, configuration, extensionRegistry, null); assertThat(nestedExtensionContext.getTags()).containsExactlyInAnyOrder("outer-tag", "nested-tag"); assertThat(nestedExtensionContext.getRoot()).isSameAs(outerExtensionContext); MethodExtensionContext methodExtensionContext = new MethodExtensionContext(outerExtensionContext, null, - methodTestDescriptor, configuration, new OpenTest4JAwareThrowableCollector(), __ -> null); + methodTestDescriptor, configuration, extensionRegistry, new OpenTest4JAwareThrowableCollector()); methodExtensionContext.setTestInstances(DefaultTestInstances.of(new OuterClass())); assertThat(methodExtensionContext.getTags()).containsExactlyInAnyOrder("outer-tag", "method-tag"); assertThat(methodExtensionContext.getRoot()).isSameAs(outerExtensionContext); @@ -163,11 +182,11 @@ void fromMethodTestDescriptor() { Method testMethod = methodTestDescriptor.getTestMethod(); JupiterEngineExtensionContext engineExtensionContext = new JupiterEngineExtensionContext(null, engineDescriptor, - configuration, __ -> null); + configuration, extensionRegistry); ClassExtensionContext classExtensionContext = new ClassExtensionContext(engineExtensionContext, null, - classTestDescriptor, configuration, null, __ -> null); + classTestDescriptor, configuration, extensionRegistry, null); MethodExtensionContext methodExtensionContext = new MethodExtensionContext(classExtensionContext, null, - methodTestDescriptor, configuration, new OpenTest4JAwareThrowableCollector(), __ -> null); + methodTestDescriptor, configuration, extensionRegistry, new OpenTest4JAwareThrowableCollector()); methodExtensionContext.setTestInstances(DefaultTestInstances.of(testInstance)); // @formatter:off @@ -193,7 +212,7 @@ void reportEntriesArePublishedToExecutionContext() { ClassTestDescriptor classTestDescriptor = outerClassDescriptor(null); EngineExecutionListener engineExecutionListener = Mockito.spy(EngineExecutionListener.class); ExtensionContext extensionContext = new ClassExtensionContext(null, engineExecutionListener, - classTestDescriptor, configuration, null, __ -> null); + classTestDescriptor, configuration, extensionRegistry, null); Map map1 = Collections.singletonMap("key", "value"); Map map2 = Collections.singletonMap("other key", "other value"); @@ -223,10 +242,10 @@ void reportEntriesArePublishedToExecutionContext() { void usingStore() { TestMethodTestDescriptor methodTestDescriptor = methodDescriptor(); ClassTestDescriptor classTestDescriptor = outerClassDescriptor(methodTestDescriptor); - ExtensionContext parentContext = new ClassExtensionContext(null, null, classTestDescriptor, configuration, null, - __ -> null); + ExtensionContext parentContext = new ClassExtensionContext(null, null, classTestDescriptor, configuration, + extensionRegistry, null); MethodExtensionContext childContext = new MethodExtensionContext(parentContext, null, methodTestDescriptor, - configuration, new OpenTest4JAwareThrowableCollector(), __ -> null); + configuration, extensionRegistry, new OpenTest4JAwareThrowableCollector()); childContext.setTestInstances(DefaultTestInstances.of(new OuterClass())); ExtensionContext.Store childStore = childContext.getStore(Namespace.GLOBAL); @@ -271,25 +290,28 @@ void configurationParameter(Function>> extensionContextFactories() { + ExtensionRegistry extensionRegistry = mock(); Class testClass = ExtensionContextTests.class; return List.of( // named("engine", (JupiterConfiguration configuration) -> { UniqueId engineUniqueId = UniqueId.parse("[engine:junit-jupiter]"); JupiterEngineDescriptor engineDescriptor = new JupiterEngineDescriptor(engineUniqueId, configuration); - return new JupiterEngineExtensionContext(null, engineDescriptor, configuration, __ -> null); + return new JupiterEngineExtensionContext(null, engineDescriptor, configuration, extensionRegistry); }), // named("class", (JupiterConfiguration configuration) -> { UniqueId classUniqueId = UniqueId.parse("[engine:junit-jupiter]/[class:MyClass]"); ClassTestDescriptor classTestDescriptor = new ClassTestDescriptor(classUniqueId, testClass, configuration); - return new ClassExtensionContext(null, null, classTestDescriptor, configuration, null, __ -> null); + return new ClassExtensionContext(null, null, classTestDescriptor, configuration, extensionRegistry, + null); }), // named("method", (JupiterConfiguration configuration) -> { Method method = ReflectionSupport.findMethod(testClass, "extensionContextFactories").orElseThrow(); UniqueId methodUniqueId = UniqueId.parse("[engine:junit-jupiter]/[class:MyClass]/[method:myMethod]"); TestMethodTestDescriptor methodTestDescriptor = new TestMethodTestDescriptor(methodUniqueId, testClass, method, configuration); - return new MethodExtensionContext(null, null, methodTestDescriptor, configuration, null, __ -> null); + return new MethodExtensionContext(null, null, methodTestDescriptor, configuration, extensionRegistry, + null); }) // ); } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/PreInterruptCallbackTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/PreInterruptCallbackTests.java new file mode 100644 index 000000000000..09361e45095e --- /dev/null +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/PreInterruptCallbackTests.java @@ -0,0 +1,244 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.engine.extension; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.parallel.ResourceAccessMode.READ_WRITE; +import static org.junit.jupiter.api.parallel.Resources.SYSTEM_OUT; +import static org.junit.jupiter.api.parallel.Resources.SYSTEM_PROPERTIES; +import static org.junit.platform.testkit.engine.EventConditions.event; +import static org.junit.platform.testkit.engine.EventConditions.finishedWithFailure; +import static org.junit.platform.testkit.engine.EventConditions.test; +import static org.junit.platform.testkit.engine.TestExecutionResultConditions.instanceOf; +import static org.junit.platform.testkit.engine.TestExecutionResultConditions.message; +import static org.junit.platform.testkit.engine.TestExecutionResultConditions.suppressed; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.nio.charset.StandardCharsets; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Timeout; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.PreInterruptCallback; +import org.junit.jupiter.api.extension.PreInterruptContext; +import org.junit.jupiter.api.parallel.Isolated; +import org.junit.jupiter.api.parallel.ResourceLock; +import org.junit.jupiter.engine.AbstractJupiterTestEngineTests; +import org.junit.jupiter.engine.Constants; +import org.junit.platform.testkit.engine.Events; + +/** + * @since 5.12 + */ +@Isolated +class PreInterruptCallbackTests extends AbstractJupiterTestEngineTests { + private static final String TC = "test"; + private static final String TIMEOUT_ERROR_MSG = TC + "() timed out after 1 microsecond"; + private static final String DEFAULT_ENABLE_PROPERTY = Constants.EXTENSIONS_TIMEOUT_THREAD_DUMP_ENABLED_PROPERTY_NAME; + private static final AtomicBoolean interruptedTest = new AtomicBoolean(); + private static final CompletableFuture testThreadExecutionDone = new CompletableFuture<>(); + private static final AtomicReference interruptedTestThread = new AtomicReference<>(); + private static final AtomicBoolean interruptCallbackShallThrowException = new AtomicBoolean(); + private static final AtomicReference calledPreInterruptContext = new AtomicReference<>(); + + @BeforeEach + void setUp() { + interruptedTest.set(false); + interruptCallbackShallThrowException.set(false); + calledPreInterruptContext.set(null); + } + + @AfterEach + void tearDown() { + calledPreInterruptContext.set(null); + interruptedTestThread.set(null); + } + + @Test + @ResourceLock(value = SYSTEM_PROPERTIES, mode = READ_WRITE) + @ResourceLock(value = SYSTEM_OUT, mode = READ_WRITE) + void testCaseWithDefaultInterruptCallbackEnabled() { + String orgValue = System.getProperty(DEFAULT_ENABLE_PROPERTY); + System.setProperty(DEFAULT_ENABLE_PROPERTY, Boolean.TRUE.toString()); + PrintStream orgOutStream = System.out; + Events tests; + String output; + try { + ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + PrintStream outStream = new PrintStream(buffer); + System.setOut(outStream); + tests = executeTestsForClass(DefaultPreInterruptCallbackTimeoutOnMethodTestCase.class).testEvents(); + output = buffer.toString(StandardCharsets.UTF_8); + } + finally { + System.setOut(orgOutStream); + if (orgValue != null) { + System.setProperty(DEFAULT_ENABLE_PROPERTY, orgValue); + } + else { + System.clearProperty(DEFAULT_ENABLE_PROPERTY); + } + } + + assertTestHasTimedOut(tests); + assertTrue(interruptedTest.get()); + Thread thread = Thread.currentThread(); + assertTrue( + output.contains("Thread \"" + thread.getName() + "\" #" + thread.threadId() + " will be interrupted."), + output); + assertTrue(output.contains("java.lang.Thread.sleep"), output); + assertTrue(output.contains( + "org.junit.jupiter.engine.extension.PreInterruptCallbackTests$DefaultPreInterruptCallbackTimeoutOnMethodTestCase.test(PreInterruptCallbackTests.java"), + output); + + assertTrue(output.contains("junit-jupiter-timeout-watcher"), output); + assertTrue( + output.contains("org.junit.jupiter.engine.extension.PreInterruptThreadDumpPrinter.beforeThreadInterrupt"), + output); + } + + @Test + void testCaseWithNoInterruptCallbackEnabled() { + Events tests = executeTestsForClass(DefaultPreInterruptCallbackTimeoutOnMethodTestCase.class).testEvents(); + assertTestHasTimedOut(tests); + assertTrue(interruptedTest.get()); + } + + @Test + void testCaseWithDeclaredInterruptCallbackEnabled() { + Events tests = executeTestsForClass(DefaultPreInterruptCallbackWithExplicitCallbackTestCase.class).testEvents(); + assertTestHasTimedOut(tests); + assertTrue(interruptedTest.get()); + PreInterruptContext preInterruptContext = calledPreInterruptContext.get(); + assertNotNull(preInterruptContext); + assertNotNull(preInterruptContext.getThreadToInterrupt()); + assertEquals(preInterruptContext.getThreadToInterrupt(), interruptedTestThread.get()); + } + + @Test + void testCaseWithDeclaredInterruptCallbackEnabledWithSeparateThread() throws Exception { + Events tests = executeTestsForClass( + DefaultPreInterruptCallbackWithExplicitCallbackWithSeparateThreadTestCase.class).testEvents(); + assertOneFailedTest(tests); + tests.failed().assertEventsMatchExactly( + event(test(TC), finishedWithFailure(instanceOf(TimeoutException.class)))); + + //Wait until the real test thread was interrupted due to executor.shutdown(), otherwise the asserts below will be flaky. + testThreadExecutionDone.get(1, TimeUnit.SECONDS); + + assertTrue(interruptedTest.get()); + PreInterruptContext preInterruptContext = calledPreInterruptContext.get(); + assertNotNull(preInterruptContext); + assertNotNull(preInterruptContext.getThreadToInterrupt()); + assertEquals(preInterruptContext.getThreadToInterrupt(), interruptedTestThread.get()); + } + + @Test + void testCaseWithDeclaredInterruptCallbackThrowsException() { + interruptCallbackShallThrowException.set(true); + Events tests = executeTestsForClass(DefaultPreInterruptCallbackWithExplicitCallbackTestCase.class).testEvents(); + tests.failed().assertEventsMatchExactly(event(test(TC), + finishedWithFailure(instanceOf(TimeoutException.class), message(TIMEOUT_ERROR_MSG), + suppressed(0, instanceOf(InterruptedException.class)), + suppressed(1, instanceOf(IllegalStateException.class))))); + assertTrue(interruptedTest.get()); + PreInterruptContext preInterruptContext = calledPreInterruptContext.get(); + assertNotNull(preInterruptContext); + assertNotNull(preInterruptContext.getThreadToInterrupt()); + assertEquals(preInterruptContext.getThreadToInterrupt(), interruptedTestThread.get()); + } + + private static void assertTestHasTimedOut(Events tests) { + assertOneFailedTest(tests); + tests.failed().assertEventsMatchExactly( + event(test(TC), finishedWithFailure(instanceOf(TimeoutException.class), message(TIMEOUT_ERROR_MSG), // + suppressed(0, instanceOf(InterruptedException.class))// + ))); + } + + private static void assertOneFailedTest(Events tests) { + tests.assertStatistics(stats -> stats.started(1).succeeded(0).failed(1)); + } + + static class TestPreInterruptCallback implements PreInterruptCallback { + + @Override + public void beforeThreadInterrupt(PreInterruptContext preInterruptContext, ExtensionContext extensionContext) { + assertNotNull(extensionContext); + + calledPreInterruptContext.set(preInterruptContext); + if (interruptCallbackShallThrowException.get()) { + throw new IllegalStateException("Test-Ex"); + } + } + } + + static class DefaultPreInterruptCallbackTimeoutOnMethodTestCase { + @Test + @Timeout(value = 1, unit = TimeUnit.MICROSECONDS) + void test() throws InterruptedException { + try { + Thread.sleep(1000); + } + catch (InterruptedException ex) { + interruptedTest.set(true); + interruptedTestThread.set(Thread.currentThread()); + throw ex; + } + } + } + + @ExtendWith(TestPreInterruptCallback.class) + static class DefaultPreInterruptCallbackWithExplicitCallbackTestCase { + @Test + @Timeout(value = 1, unit = TimeUnit.MICROSECONDS) + void test() throws InterruptedException { + try { + Thread.sleep(1000); + } + catch (InterruptedException ex) { + interruptedTest.set(true); + interruptedTestThread.set(Thread.currentThread()); + throw ex; + } + } + } + + @ExtendWith(TestPreInterruptCallback.class) + static class DefaultPreInterruptCallbackWithExplicitCallbackWithSeparateThreadTestCase { + @Test + @Timeout(value = 200, unit = TimeUnit.MILLISECONDS, threadMode = Timeout.ThreadMode.SEPARATE_THREAD) + void test() throws InterruptedException { + try { + Thread.sleep(2000); + } + catch (InterruptedException ex) { + interruptedTest.set(true); + interruptedTestThread.set(Thread.currentThread()); + throw ex; + } + finally { + testThreadExecutionDone.complete(null); + } + } + } +} diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/SameThreadTimeoutInvocationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/SameThreadTimeoutInvocationTests.java index d7440eb1c985..6a2191f8e015 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/SameThreadTimeoutInvocationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/SameThreadTimeoutInvocationTests.java @@ -34,7 +34,8 @@ void resetsInterruptFlag() { var exception = assertThrows(TimeoutException.class, () -> withExecutor(executor -> { var delegate = new EventuallyInterruptibleInvocation(); var duration = new TimeoutDuration(1, NANOSECONDS); - var timeoutInvocation = new SameThreadTimeoutInvocation<>(delegate, duration, executor, () -> "execution"); + var timeoutInvocation = new SameThreadTimeoutInvocation<>(delegate, duration, executor, () -> "execution", + PreInterruptCallbackInvocation.NOOP); timeoutInvocation.proceed(); })); assertFalse(Thread.currentThread().isInterrupted()); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/SeparateThreadTimeoutInvocationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/SeparateThreadTimeoutInvocationTests.java index 23307e43dd7b..166fcb0897e2 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/SeparateThreadTimeoutInvocationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/SeparateThreadTimeoutInvocationTests.java @@ -73,7 +73,8 @@ private static SeparateThreadTimeoutInvocation aSeparateThreadInvocation( var namespace = ExtensionContext.Namespace.create(SeparateThreadTimeoutInvocationTests.class); var store = new NamespaceAwareStore(new NamespacedHierarchicalStore<>(null), namespace); var parameters = new TimeoutInvocationParameters<>(invocation, - new TimeoutDuration(PREEMPTIVE_TIMEOUT_MILLIS, MILLISECONDS), () -> "method()"); + new TimeoutDuration(PREEMPTIVE_TIMEOUT_MILLIS, MILLISECONDS), () -> "method()", + PreInterruptCallbackInvocation.NOOP); return (SeparateThreadTimeoutInvocation) new TimeoutInvocationFactory(store) // .create(ThreadMode.SEPARATE_THREAD, parameters); } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactoryTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactoryTests.java index 01b20579b1d8..8c91d4b231c3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactoryTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactoryTests.java @@ -56,7 +56,8 @@ class TimeoutInvocationFactoryTests { @BeforeEach void setUp() { - parameters = new TimeoutInvocationParameters<>(invocation, timeoutDuration, () -> "description"); + parameters = new TimeoutInvocationParameters<>(invocation, timeoutDuration, () -> "description", + PreInterruptCallbackInvocation.NOOP); timeoutInvocationFactory = new TimeoutInvocationFactory(store); } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java index 1ecbc4764582..9cc73d479795 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java @@ -108,6 +108,8 @@ void avoidAccessingStandardStreams(JavaClasses classes) { .that(are(not(name("org.junit.platform.runner.JUnitPlatformRunnerListener")))) // .that(are(not(name("org.junit.platform.testkit.engine.Events")))) // .that(are(not(name("org.junit.platform.testkit.engine.Executions")))) // + //The PreInterruptThreadDumpPrinter writes to StdOut by contract to dump threads + .that(are(not(name("org.junit.jupiter.engine.extension.PreInterruptThreadDumpPrinter")))) // .that(are(not(resideInAPackage("org.junit.platform.console.shadow.picocli")))); GeneralCodingRules.NO_CLASSES_SHOULD_ACCESS_STANDARD_STREAMS.check(subset); } From c5e045a34ec297308d5302d11e60832a8878db65 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 29 Oct 2024 12:32:17 +0100 Subject: [PATCH 238/611] Expand release notes for `PreInterruptCallback` --- .../asciidoc/release-notes/release-notes-5.12.0-M1.adoc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 86e3bdcedd73..5f7af01a9880 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -90,7 +90,12 @@ JUnit repository on GitHub. a test-scoped `ExtensionContext` in `Extension` methods called during test class instantiation. This behavior will become the default in future versions of JUnit. * `@TempDir` is now supported on test class constructors. -* Added `PreInterruptCallback` +* The new `PreInterruptCallback` extension point defines the API for `Extensions` that + wish to be called prior to invocations of `Thread#interrupt()` by the `@Timeout` + extension. +* When enabled via the `junit.jupiter.execution.timeout.threaddump.enabled` configuration + parameter, an implementation of `PreInterruptCallback` is registered that writes a + thread dump to `System.out` prior to interrupting a test thread due to a timeout. [[release-notes-5.12.0-M1-junit-vintage]] From 79c834ca504d90358ef99e9abe0bd74f145e994e Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 29 Oct 2024 12:33:31 +0100 Subject: [PATCH 239/611] Fix heading levels --- documentation/src/docs/asciidoc/user-guide/writing-tests.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc index b973308ddee4..6322a1bbef3c 100644 --- a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc +++ b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc @@ -2660,7 +2660,7 @@ link:https://github.com/awaitility/awaitility[Awaitility]. [[writing-tests-declarative-timeouts-debugging]] -=== Debugging Timeouts +==== Debugging Timeouts Registered <> extensions are called prior to invoking `Thread.interrupt()` on the thread that is executing the timed out method. This allows to @@ -2669,7 +2669,7 @@ diagnosing the cause of a timeout. [[writing-tests-declarative-timeouts-debugging-thread-dump]] -==== Thread Dump on Timeout +===== Thread Dump on Timeout JUnit registers a default implementation of the <> extension point that dumps the stacks of all threads to `System.out` if enabled by setting the `junit.jupiter.execution.timeout.threaddump.enabled` configuration parameter to `true`. From 5aa9311186e0e72192697335d2ca4f532c3dee97 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 29 Oct 2024 23:29:38 +0000 Subject: [PATCH 240/611] Update graalvm/setup-graalvm digest to 3aaf71e --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c6782d3fc550..18c02ee7706c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,7 @@ jobs: with: fetch-depth: 1 - name: Install GraalVM - uses: graalvm/setup-graalvm@6f327093bb6a42fe5eac053d21b168c46aa46f22 # v1 + uses: graalvm/setup-graalvm@3aaf71e276c9159bbdfbcdab8abc50c95f41a2c8 # v1 with: distribution: graalvm-community version: 'latest' From c877702ea5edbf835478bdf84825056f7abbbd75 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 31 Oct 2024 20:30:05 +0000 Subject: [PATCH 241/611] Update dependency com.puppycrawl.tools:checkstyle to v10.20.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 53c7b2e3a6c8..57e96291abd1 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ asciidoctorj-pdf = "2.3.19" asciidoctor-plugins = "4.0.3" # Check if workaround in documentation.gradle.kts can be removed when upgrading assertj = "3.26.3" bnd = "7.0.0" -checkstyle = "10.19.0" +checkstyle = "10.20.0" eclipse = "4.32.0" jackson = "2.18.1" jacoco = "0.8.12" From c016a81f4542512f261c52be052f2768f554fe75 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 2 Nov 2024 21:36:25 +0000 Subject: [PATCH 242/611] Update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.5.2 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 57e96291abd1..a0dce29bbcab 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -16,7 +16,7 @@ ktlint = "1.4.0" log4j = "2.24.1" opentest4j = "1.3.0" openTestReporting = "0.1.0-M2" -surefire = "3.5.1" +surefire = "3.5.2" xmlunit = "2.10.0" [libraries] From 67cdb9050ae6372ba77f425cfd5d282fdeffd6fe Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 07:47:11 +0000 Subject: [PATCH 243/611] Update dependency org.apache.maven.plugins:maven-surefire-plugin to v3.5.2 --- platform-tooling-support-tests/projects/java-versions/pom.xml | 2 +- platform-tooling-support-tests/projects/maven-starter/pom.xml | 2 +- platform-tooling-support-tests/projects/vintage/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/platform-tooling-support-tests/projects/java-versions/pom.xml b/platform-tooling-support-tests/projects/java-versions/pom.xml index dc735616b169..a469343ded01 100644 --- a/platform-tooling-support-tests/projects/java-versions/pom.xml +++ b/platform-tooling-support-tests/projects/java-versions/pom.xml @@ -41,7 +41,7 @@ maven-surefire-plugin - 3.5.1 + 3.5.2 diff --git a/platform-tooling-support-tests/projects/maven-starter/pom.xml b/platform-tooling-support-tests/projects/maven-starter/pom.xml index 012e56ca896b..5ba697cd2353 100644 --- a/platform-tooling-support-tests/projects/maven-starter/pom.xml +++ b/platform-tooling-support-tests/projects/maven-starter/pom.xml @@ -47,7 +47,7 @@ maven-surefire-plugin - 3.5.1 + 3.5.2 diff --git a/platform-tooling-support-tests/projects/vintage/pom.xml b/platform-tooling-support-tests/projects/vintage/pom.xml index 1838bdee03f4..d8f486bf8ba7 100644 --- a/platform-tooling-support-tests/projects/vintage/pom.xml +++ b/platform-tooling-support-tests/projects/vintage/pom.xml @@ -43,7 +43,7 @@ maven-surefire-plugin - 3.5.1 + 3.5.2 From d2eb19722d0d674bae1543f5312c851c81fc968f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 09:42:49 +0000 Subject: [PATCH 244/611] Update plugin shadow to v8.3.5 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a0dce29bbcab..f7f1e4e7c2cd 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -91,6 +91,6 @@ gitPublish = { id = "org.ajoberstar.git-publish", version = "4.2.2" } jmh = { id = "me.champeau.jmh", version = "0.7.2" } nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" } plantuml = { id = "io.freefair.plantuml", version = "8.10.2" } -shadow = { id = "com.gradleup.shadow", version = "8.3.4" } +shadow = { id = "com.gradleup.shadow", version = "8.3.5" } spotless = { id = "com.diffplug.spotless", version = "7.0.0.BETA4" } versions = { id = "com.github.ben-manes.versions", version = "0.51.0" } From 2be6e9e396b7b1e7be6a3b5933c62e0b8599b3f2 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 5 Nov 2024 15:50:48 +0100 Subject: [PATCH 245/611] Use same format as JDK for thread dumps so tools like IDEA can parse it --- .../PreInterruptThreadDumpPrinter.java | 13 ++++++++-- .../extension/PreInterruptCallbackTests.java | 25 ++++++++++--------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptThreadDumpPrinter.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptThreadDumpPrinter.java index b454d96a7277..eded2b8cd4f5 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptThreadDumpPrinter.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptThreadDumpPrinter.java @@ -31,12 +31,15 @@ final class PreInterruptThreadDumpPrinter implements PreInterruptCallback { @Override public void beforeThreadInterrupt(PreInterruptContext preInterruptContext, ExtensionContext extensionContext) { + Map stackTraces = Thread.getAllStackTraces(); + StringBuilder sb = new StringBuilder(); sb.append("Thread "); appendThreadName(sb, preInterruptContext.getThreadToInterrupt()); sb.append(" will be interrupted."); sb.append(NL); + for (Map.Entry entry : stackTraces.entrySet()) { Thread thread = entry.getKey(); StackTraceElement[] stack = entry.getValue(); @@ -53,6 +56,7 @@ public void beforeThreadInterrupt(PreInterruptContext preInterruptContext, Exten sb.append(NL); } } + System.out.println(sb); } @@ -62,13 +66,18 @@ public void beforeThreadInterrupt(PreInterruptContext preInterruptContext, Exten * @param th the thread to append */ private void appendThreadName(StringBuilder sb, Thread th) { + // Use same format as java.lang.management.ThreadInfo.toString sb.append("\""); sb.append(th.getName()); sb.append("\""); - sb.append(" #"); - sb.append(th.getId()); if (th.isDaemon()) { sb.append(" daemon"); } + sb.append(" prio="); + sb.append(th.getPriority()); + sb.append(" Id="); + sb.append(th.getId()); + sb.append(" "); + sb.append(th.getState()); } } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/PreInterruptCallbackTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/PreInterruptCallbackTests.java index 09361e45095e..6f39ed398da7 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/PreInterruptCallbackTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/PreInterruptCallbackTests.java @@ -10,6 +10,7 @@ package org.junit.jupiter.engine.extension; +import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -102,18 +103,18 @@ void testCaseWithDefaultInterruptCallbackEnabled() { assertTestHasTimedOut(tests); assertTrue(interruptedTest.get()); Thread thread = Thread.currentThread(); - assertTrue( - output.contains("Thread \"" + thread.getName() + "\" #" + thread.threadId() + " will be interrupted."), - output); - assertTrue(output.contains("java.lang.Thread.sleep"), output); - assertTrue(output.contains( - "org.junit.jupiter.engine.extension.PreInterruptCallbackTests$DefaultPreInterruptCallbackTimeoutOnMethodTestCase.test(PreInterruptCallbackTests.java"), - output); - - assertTrue(output.contains("junit-jupiter-timeout-watcher"), output); - assertTrue( - output.contains("org.junit.jupiter.engine.extension.PreInterruptThreadDumpPrinter.beforeThreadInterrupt"), - output); + + assertThat(output) // + .containsSubsequence( + "Thread \"%s\" prio=%d Id=%d %s will be interrupted.".formatted(thread.getName(), + thread.getPriority(), thread.threadId(), Thread.State.TIMED_WAITING), // + "java.lang.Thread.sleep", // + "org.junit.jupiter.engine.extension.PreInterruptCallbackTests$DefaultPreInterruptCallbackTimeoutOnMethodTestCase.test(PreInterruptCallbackTests.java"); + + assertThat(output) // + .containsSubsequence( // + "junit-jupiter-timeout-watcher", // + "org.junit.jupiter.engine.extension.PreInterruptThreadDumpPrinter.beforeThreadInterrupt"); } @Test From e6c3b52ae57bd75a85c5719e6b74bf4f0b896883 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 6 Nov 2024 08:10:03 +0100 Subject: [PATCH 246/611] Inject GRADLE_ENCRYPTION_KEY for configuration cache see https://github.com/gradle/actions/blob/main/docs/setup-gradle.md#saving-configuration-cache-data --- .github/actions/run-gradle/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/run-gradle/action.yml b/.github/actions/run-gradle/action.yml index c097e93cdeea..e3f714e606d6 100644 --- a/.github/actions/run-gradle/action.yml +++ b/.github/actions/run-gradle/action.yml @@ -15,6 +15,8 @@ runs: java-version: 21 check-latest: true - uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # v4 + with: + cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} - shell: bash env: JAVA_HOME: ${{ steps.setup-gradle-jdk.outputs.path }} From 10416cf7889b105eaa260eafdbcb7bbc8ff4ca20 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 6 Nov 2024 08:42:55 +0100 Subject: [PATCH 247/611] Delete obsolete config --- documentation/documentation.gradle.kts | 3 --- 1 file changed, 3 deletions(-) diff --git a/documentation/documentation.gradle.kts b/documentation/documentation.gradle.kts index f5f6e1b6391a..bffe07b472cd 100644 --- a/documentation/documentation.gradle.kts +++ b/documentation/documentation.gradle.kts @@ -481,9 +481,6 @@ tasks { dependsOn(fixJavadoc, asciidoctor, asciidoctorPdf) outputs.dir(docsDir) - from(layout.buildDirectory.dir("checksum")) { - include("published-checksum.txt") - } from(asciidoctor.map { it.outputDir }) { include("user-guide/**") include("release-notes/**") From cb3fbfbcc7e9656527e2ef09123d991e15bfdbf5 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 6 Nov 2024 08:43:32 +0100 Subject: [PATCH 248/611] Use automatically generated GitHub token --- .github/workflows/main.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 18c02ee7706c..0e574c23a72a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -115,9 +115,11 @@ jobs: - name: Upload Documentation if: github.event_name == 'push' && github.repository == 'junit-team/junit5' && github.ref == 'refs/heads/main' uses: ./.github/actions/run-gradle + permissions: + contents: write with: arguments: | gitPublishPush \ -Dscan.tag.Documentation env: - GRGIT_USER: ${{ secrets.GH_TOKEN }} + GRGIT_USER: ${{ secrets.GITHUB_TOKEN }} From 216377b6bd916a1f53709970b88212c52e42c06e Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 6 Nov 2024 08:46:00 +0100 Subject: [PATCH 249/611] Link to configuration parameter section --- .../src/docs/asciidoc/user-guide/writing-tests.adoc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc index 6322a1bbef3c..7911b146cd4e 100644 --- a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc +++ b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc @@ -2670,13 +2670,16 @@ diagnosing the cause of a timeout. [[writing-tests-declarative-timeouts-debugging-thread-dump]] ===== Thread Dump on Timeout -JUnit registers a default implementation of the <> extension point that -dumps the stacks of all threads to `System.out` if enabled by setting the -`junit.jupiter.execution.timeout.threaddump.enabled` configuration parameter to `true`. + +JUnit registers a default implementation of the <> +extension point that dumps the stacks of all threads to `System.out` if enabled by setting +the `junit.jupiter.execution.timeout.threaddump.enabled` +<> to `true`. [[writing-tests-declarative-timeouts-mode]] ==== Disable @Timeout Globally + When stepping through your code in a debug session, a fixed timeout limit may influence the result of the test, e.g. mark the test as failed although all assertions were met. From 6ba1f2bcd6c600c75f814e2acd1f97c0a168f071 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 6 Nov 2024 08:57:44 +0100 Subject: [PATCH 250/611] Pass encryption key as input to composite actions Because composite actions can't access secrets directly --- .github/actions/main-build/action.yml | 4 ++++ .github/actions/run-gradle/action.yml | 5 ++++- .github/workflows/codeql-analysis.yml | 1 + .github/workflows/cross-version.yml | 2 ++ .github/workflows/main.yml | 10 +++++++++- .github/workflows/reproducible-build.yml | 1 + 6 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/actions/main-build/action.yml b/.github/actions/main-build/action.yml index 4c6c611412d7..b9d087000352 100644 --- a/.github/actions/main-build/action.yml +++ b/.github/actions/main-build/action.yml @@ -5,6 +5,9 @@ inputs: required: true description: Gradle arguments default: :platform-tooling-support-tests:test build --configuration-cache + encryptionKey: + required: true + description: Gradle cache encryption key runs: using: "composite" steps: @@ -12,3 +15,4 @@ runs: - uses: ./.github/actions/run-gradle with: arguments: ${{ inputs.arguments }} + encryptionKey: ${{ inputs.encryptionKey }} diff --git a/.github/actions/run-gradle/action.yml b/.github/actions/run-gradle/action.yml index e3f714e606d6..b0321a5cd4bf 100644 --- a/.github/actions/run-gradle/action.yml +++ b/.github/actions/run-gradle/action.yml @@ -5,6 +5,9 @@ inputs: required: true description: Gradle arguments default: build + encryptionKey: + required: true + description: Gradle cache encryption key runs: using: "composite" steps: @@ -16,7 +19,7 @@ runs: check-latest: true - uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # v4 with: - cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} + cache-encryption-key: ${{ inputs.encryptionKey }} - shell: bash env: JAVA_HOME: ${{ steps.setup-gradle-jdk.outputs.path }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index a61c954088c0..26980922e15b 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -41,6 +41,7 @@ jobs: - name: Build uses: ./.github/actions/run-gradle with: + encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} arguments: | --no-build-cache \ -Dscan.tag.CodeQL \ diff --git a/.github/workflows/cross-version.yml b/.github/workflows/cross-version.yml index c04042d59911..877dc4b124ea 100644 --- a/.github/workflows/cross-version.yml +++ b/.github/workflows/cross-version.yml @@ -60,6 +60,7 @@ jobs: - name: Build uses: ./.github/actions/run-gradle with: + encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} arguments: | -PjavaToolchain.version=${{ matrix.jdk.version }} \ -Dscan.tag.JDK_${{ matrix.jdk.version }} \ @@ -93,6 +94,7 @@ jobs: - name: Build uses: ./.github/actions/run-gradle with: + encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} arguments: | -PjavaToolchain.version=${{ matrix.jdk }} \ -PjavaToolchain.implementation=j9 \ diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0e574c23a72a..f3b51b3669e0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,6 +32,7 @@ jobs: - name: Build uses: ./.github/actions/main-build with: + encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} arguments: | -Ptesting.enableJaCoCo \ :platform-tooling-support-tests:test \ @@ -52,6 +53,8 @@ jobs: fetch-depth: 1 - name: Build uses: ./.github/actions/main-build + with: + encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} macOS: runs-on: macos-latest @@ -62,10 +65,12 @@ jobs: fetch-depth: 1 - name: Build uses: ./.github/actions/main-build + with: + encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} publish_artifacts: name: Publish Snapshot Artifacts - needs: linux + needs: Linux runs-on: ubuntu-latest permissions: attestations: write # required for build provenance attestation @@ -82,6 +87,7 @@ jobs: ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} with: + encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} arguments: | publish -x check \ prepareGitHubAttestation @@ -109,6 +115,7 @@ jobs: - name: Build Documentation uses: ./.github/actions/run-gradle with: + encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} arguments: | prepareDocsForUploadToGhPages \ -Dscan.tag.Documentation @@ -118,6 +125,7 @@ jobs: permissions: contents: write with: + encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} arguments: | gitPublishPush \ -Dscan.tag.Documentation diff --git a/.github/workflows/reproducible-build.yml b/.github/workflows/reproducible-build.yml index 5216dd8beb12..cd5af71feca7 100644 --- a/.github/workflows/reproducible-build.yml +++ b/.github/workflows/reproducible-build.yml @@ -26,6 +26,7 @@ jobs: - name: Restore Gradle cache and display toolchains uses: ./.github/actions/run-gradle with: + encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} arguments: | --quiet \ --configuration-cache From 825690df2aabd4c7de567fbfb199ce02c5f8428d Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 6 Nov 2024 09:01:44 +0100 Subject: [PATCH 251/611] Link to correct section --- documentation/src/docs/asciidoc/user-guide/writing-tests.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc index 7911b146cd4e..0e597ae4ab0a 100644 --- a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc +++ b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc @@ -2674,7 +2674,7 @@ diagnosing the cause of a timeout. JUnit registers a default implementation of the <> extension point that dumps the stacks of all threads to `System.out` if enabled by setting the `junit.jupiter.execution.timeout.threaddump.enabled` -<> to `true`. +<> to `true`. [[writing-tests-declarative-timeouts-mode]] From d474340d9a1cf4c2037480b192a6fac07050993d Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 6 Nov 2024 09:05:19 +0100 Subject: [PATCH 252/611] Move permissions to job level --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f3b51b3669e0..fe1dea705049 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -101,6 +101,8 @@ jobs: concurrency: group: github-pages-${{ github.ref }} cancel-in-progress: true + permissions: + contents: write needs: Linux runs-on: ubuntu-latest steps: @@ -122,8 +124,6 @@ jobs: - name: Upload Documentation if: github.event_name == 'push' && github.repository == 'junit-team/junit5' && github.ref == 'refs/heads/main' uses: ./.github/actions/run-gradle - permissions: - contents: write with: encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} arguments: | From 6e328c0b06292ab876ac27ff3d001424229e2af7 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 6 Nov 2024 09:14:17 +0100 Subject: [PATCH 253/611] Revert "Move permissions to job level" This reverts commit d474340d9a1cf4c2037480b192a6fac07050993d. --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fe1dea705049..f3b51b3669e0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -101,8 +101,6 @@ jobs: concurrency: group: github-pages-${{ github.ref }} cancel-in-progress: true - permissions: - contents: write needs: Linux runs-on: ubuntu-latest steps: @@ -124,6 +122,8 @@ jobs: - name: Upload Documentation if: github.event_name == 'push' && github.repository == 'junit-team/junit5' && github.ref == 'refs/heads/main' uses: ./.github/actions/run-gradle + permissions: + contents: write with: encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} arguments: | From 6dc8121fb0441c42f0f4f5179a1ccd759b16c1bf Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 6 Nov 2024 09:14:22 +0100 Subject: [PATCH 254/611] Revert "Use automatically generated GitHub token" This reverts commit cb3fbfbcc7e9656527e2ef09123d991e15bfdbf5. --- .github/workflows/main.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f3b51b3669e0..0f4ee19c6675 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -122,12 +122,10 @@ jobs: - name: Upload Documentation if: github.event_name == 'push' && github.repository == 'junit-team/junit5' && github.ref == 'refs/heads/main' uses: ./.github/actions/run-gradle - permissions: - contents: write with: encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} arguments: | gitPublishPush \ -Dscan.tag.Documentation env: - GRGIT_USER: ${{ secrets.GITHUB_TOKEN }} + GRGIT_USER: ${{ secrets.GH_TOKEN }} From 90b4b514d5bb737c465953855798daad9643e541 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 6 Nov 2024 09:56:46 +0100 Subject: [PATCH 255/611] Delete obsolete issue template --- .github/ISSUE_TEMPLATE.md | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index f1ce8b0c8472..000000000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,23 +0,0 @@ -## Overview - -_Replace the following bullet points with your issue description, -after answering yourself: **"What kind of issue is this?"**_ - -- ( ) **Question.** This issue tracker is not the place for questions. -If you want to ask how to do something, or to understand why -something isn't working the way you expect it to, please first use Stack -Overflow or Gitter. -https://stackoverflow.com/questions/tagged/junit5 - -- ( ) **Bug report.** Please provide us the version of JUnit 5 you are -using and, if possible, a failing unit test with your bug report. Don't -forget to describe the rationale for this issue (e.g. expected vs. -actual behavior). - -- ( ) **Feature request.** Start by telling us what problem you’re trying -to solve. Often a solution already exists! Please, don’t send pull requests -to implement new features without first getting our support. - -## Deliverables - -- [ ] ... From 1c95ec25be014355e43c43d6beb7272c76a989dc Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 6 Nov 2024 08:18:52 +0000 Subject: [PATCH 256/611] Update dependency com.pinterest.ktlint:ktlint-cli to v1.4.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f7f1e4e7c2cd..ba71f97f2a27 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -12,7 +12,7 @@ jacoco = "0.8.12" jmh = "1.37" junit4 = "4.13.2" junit4Min = "4.12" -ktlint = "1.4.0" +ktlint = "1.4.1" log4j = "2.24.1" opentest4j = "1.3.0" openTestReporting = "0.1.0-M2" From 068da81c387814e2b45a83a3bb6a2dade0ccb72b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 6 Nov 2024 09:36:16 +0000 Subject: [PATCH 257/611] Update actions/attest-build-provenance action to v1.4.4 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0f4ee19c6675..a4412115bae4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -92,7 +92,7 @@ jobs: publish -x check \ prepareGitHubAttestation - name: Generate build provenance attestations - uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3 + uses: actions/attest-build-provenance@ef244123eb79f2f7a7e75d99086184180e6d0018 # v1.4.4 with: subject-path: documentation/build/attestation/*.jar From 274089421bc7da48d382eea4fb86ad7ef2eb2be9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 7 Nov 2024 18:33:35 +0000 Subject: [PATCH 258/611] Update dependency com.puppycrawl.tools:checkstyle to v10.20.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ba71f97f2a27..e2f46f27aeec 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ asciidoctorj-pdf = "2.3.19" asciidoctor-plugins = "4.0.3" # Check if workaround in documentation.gradle.kts can be removed when upgrading assertj = "3.26.3" bnd = "7.0.0" -checkstyle = "10.20.0" +checkstyle = "10.20.1" eclipse = "4.32.0" jackson = "2.18.1" jacoco = "0.8.12" From ea3edff8cc003d238bcc1b591a67c699699755b5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 8 Nov 2024 06:53:19 +0000 Subject: [PATCH 259/611] Update dependency org.apache.groovy:groovy to v4.0.24 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e2f46f27aeec..0a629ad665b1 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -34,7 +34,7 @@ bndlib = { module = "biz.aQute.bnd:biz.aQute.bndlib", version.ref = "bnd" } checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checkstyle" } classgraph = { module = "io.github.classgraph:classgraph", version = "4.8.177" } commons-io = { module = "commons-io:commons-io", version = "2.17.0" } -groovy4 = { module = "org.apache.groovy:groovy", version = "4.0.23" } +groovy4 = { module = "org.apache.groovy:groovy", version = "4.0.24" } groovy2-bom = { module = "org.codehaus.groovy:groovy-bom", version = "2.5.23" } hamcrest = { module = "org.hamcrest:hamcrest", version = "3.0" } jackson-dataformat-yaml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml", version.ref = "jackson" } From 2e4d6e4cdc937c44963df29dac83254e3d2ee803 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 8 Nov 2024 09:26:33 +0000 Subject: [PATCH 260/611] Update dependency gg.jte:jte to v3.1.14 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0a629ad665b1..280296f51653 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -45,7 +45,7 @@ jimfs = { module = "com.google.jimfs:jimfs", version = "1.3.0" } jmh-core = { module = "org.openjdk.jmh:jmh-core", version.ref = "jmh" } jmh-generator-annprocess = { module = "org.openjdk.jmh:jmh-generator-annprocess", version.ref = "jmh" } joox = { module = "org.jooq:joox", version = "2.0.1" } -jte = { module = "gg.jte:jte", version = "3.1.13" } +jte = { module = "gg.jte:jte", version = "3.1.14" } junit4 = { module = "junit:junit", version = { require = "[4.12,)", prefer = "4.13.2" } } kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.9.0" } log4j-core = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j" } From a90829111ca00204a04efeffefa01c5f28aff683 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 8 Nov 2024 14:41:37 +0100 Subject: [PATCH 261/611] Clean up funding links --- .github/FUNDING.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 0786ce3ef470..3982c296a43f 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,8 +1 @@ -# These are supported funding model platforms - -github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] -patreon: # Replace with a single Patreon username -open_collective: # Replace with a single Open Collective username -ko_fi: # Replace with a single Ko-fi username -tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel custom: https://junit.org/sponsoring From be4edac23460608892ad5c77fcd2185429ce6459 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 8 Nov 2024 17:06:11 +0000 Subject: [PATCH 262/611] Update github/codeql-action digest to 4f3212b --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/ossf-scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 26980922e15b..8f6634686250 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -34,7 +34,7 @@ jobs: - name: Check out repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Initialize CodeQL - uses: github/codeql-action/init@662472033e021d55d94146f66f6058822b0b39fd # v3 + uses: github/codeql-action/init@4f3212b61783c3c68e8309a0f18a699764811cda # v3 with: languages: ${{ matrix.language }} tools: linked @@ -47,4 +47,4 @@ jobs: -Dscan.tag.CodeQL \ allMainClasses - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@662472033e021d55d94146f66f6058822b0b39fd # v3 + uses: github/codeql-action/analyze@4f3212b61783c3c68e8309a0f18a699764811cda # v3 diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index 5028c4705f41..929ab6238d62 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard (optional). # Commenting out will disable upload of results to your repo's Code Scanning dashboard - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@662472033e021d55d94146f66f6058822b0b39fd # v3 + uses: github/codeql-action/upload-sarif@4f3212b61783c3c68e8309a0f18a699764811cda # v3 with: sarif_file: results.sarif From 5e2b6948517162b7d5cdf70c4f4a9449de154f73 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 11 Nov 2024 18:02:49 +0100 Subject: [PATCH 263/611] Add JUnit-specific metadata to open-test-reporting's HTML report (#4116) When creating the event-based XML report, the `OpenTestReportGeneratingListener` includes JUnit-specific metadata: type, unique ID, and legacy reporting name. This PR implements open-test-reporting's `Contributor` SPI to include that data in the new HTML report of open-test-reporting. Moreover, it configures the build to create a single report for all test tasks per subproject and uploads it as part of GitHub Action runs. --- .github/actions/main-build/action.yml | 5 ++ .github/workflows/cross-version.yml | 10 +++ documentation/documentation.gradle.kts | 28 +++++-- .../release-notes-5.12.0-M1.adoc | 3 + gradle/libs.versions.toml | 6 +- .../junitbuild.testing-conventions.gradle.kts | 48 +++++++++++ ...nit-platform-console-standalone.gradle.kts | 2 + .../junit-platform-console.gradle.kts | 1 + .../junit-platform-reporting.gradle.kts | 10 ++- .../reporting/open/xml/JUnitContributor.java | 79 +++++++++++++++++++ ...porting.tooling.spi.htmlreport.Contributor | 1 + .../module-info.java | 4 + ...eportGenerationSystemPropertyOverride.java | 43 ++++++++++ .../org.junit.jupiter.api.extension.Extension | 1 + platform-tests/platform-tests.gradle.kts | 3 +- .../legacy/xml/XmlReportWriterTests.java | 2 +- .../open/xml/JUnitContributorTests.java | 67 ++++++++++++++++ ...OpenTestReportGeneratingListenerTests.java | 4 +- .../test/resources/junit-platform.properties | 1 + .../platform-tooling-support-tests.gradle.kts | 1 + .../junit-platform-reporting.expected.txt | 2 + .../projects/maven-starter/pom.xml | 10 +++ .../multi-release-jar/default/pom.xml | 10 +++ .../tooling/support/tests/ArchUnitTests.java | 5 ++ .../support/tests/JarDescribeModuleTests.java | 3 +- .../support/tests/ModularUserGuideTests.java | 1 + .../support/tests/StandaloneTests.java | 5 +- .../support/tests/ToolProviderTests.java | 6 +- 28 files changed, 343 insertions(+), 18 deletions(-) create mode 100644 junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/JUnitContributor.java create mode 100644 junit-platform-reporting/src/main/resources/META-INF/services/org.opentest4j.reporting.tooling.spi.htmlreport.Contributor create mode 100644 junit-platform-reporting/src/testFixtures/java/org/junit/platform/reporting/open/xml/OpenTestReportGenerationSystemPropertyOverride.java create mode 100644 junit-platform-reporting/src/testFixtures/resources/META-INF/services/org.junit.jupiter.api.extension.Extension create mode 100644 platform-tests/src/test/java/org/junit/platform/reporting/open/xml/JUnitContributorTests.java create mode 100644 platform-tests/src/test/resources/junit-platform.properties diff --git a/.github/actions/main-build/action.yml b/.github/actions/main-build/action.yml index b9d087000352..95bf73979406 100644 --- a/.github/actions/main-build/action.yml +++ b/.github/actions/main-build/action.yml @@ -16,3 +16,8 @@ runs: with: arguments: ${{ inputs.arguments }} encryptionKey: ${{ inputs.encryptionKey }} + - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4 + if: ${{ always() }} + with: + name: Open Test Reports (${{ github.job }}) + path: '**/build/reports/open-test-report.html' diff --git a/.github/workflows/cross-version.yml b/.github/workflows/cross-version.yml index 877dc4b124ea..9c6eabee0ab8 100644 --- a/.github/workflows/cross-version.yml +++ b/.github/workflows/cross-version.yml @@ -66,6 +66,11 @@ jobs: -Dscan.tag.JDK_${{ matrix.jdk.version }} \ build \ --configuration-cache + - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4 + if: ${{ always() }} + with: + name: Open Test Reports (${{ github.job }} ${{ matrix.jdk.version }} (${{ matrix.jdk.release || matrix.jdk.type }})) + path: '**/build/reports/open-test-report.html' openj9: strategy: fail-fast: false @@ -102,3 +107,8 @@ jobs: -Dscan.tag.OpenJ9 \ build \ --configuration-cache + - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4 + if: ${{ always() }} + with: + name: Open Test Reports (${{ github.job }}) + path: '**/build/reports/open-test-report.html' diff --git a/documentation/documentation.gradle.kts b/documentation/documentation.gradle.kts index bffe07b472cd..62e8b3605e06 100644 --- a/documentation/documentation.gradle.kts +++ b/documentation/documentation.gradle.kts @@ -6,6 +6,7 @@ import junitbuild.javadoc.ModuleSpecificJavadocFileOption import org.asciidoctor.gradle.base.AsciidoctorAttributeProvider import org.asciidoctor.gradle.jvm.AbstractAsciidoctorTask import org.gradle.api.tasks.PathSensitivity.RELATIVE +import java.nio.file.Files plugins { alias(libs.plugins.asciidoctorConvert) @@ -144,23 +145,40 @@ require(externalModulesWithoutModularJavadoc.values.all { it.endsWith("/") }) { tasks { + val consoleLauncherTestReportsDir = project.layout.buildDirectory.dir("console-launcher-test-results") + val consoleLauncherTestEventXmlFiles = + files(consoleLauncherTestReportsDir.map { it.asFileTree.matching { include("junit-platform-events-*.xml") } }) + val consoleLauncherTest by registering(RunConsoleLauncher::class) { args.addAll("execute") args.addAll("--scan-classpath") args.addAll("--config=junit.platform.reporting.open.xml.enabled=true") - val reportsDir = project.layout.buildDirectory.dir("console-launcher-test-results") - outputs.dir(reportsDir) + outputs.dir(consoleLauncherTestReportsDir) argumentProviders.add(CommandLineArgumentProvider { listOf( - "--reports-dir=${reportsDir.get()}", - "--config=junit.platform.reporting.output.dir=${reportsDir.get()}" - + "--reports-dir=${consoleLauncherTestReportsDir.get()}", + "--config=junit.platform.reporting.output.dir=${consoleLauncherTestReportsDir.get()}", ) }) args.addAll("--include-classname", ".*Tests") args.addAll("--include-classname", ".*Demo") args.addAll("--exclude-tag", "exclude") args.addAll("--exclude-tag", "timeout") + + doFirst { + consoleLauncherTestEventXmlFiles.files.forEach { + Files.delete(it.toPath()) + } + } + + finalizedBy(generateOpenTestHtmlReport) + } + + generateOpenTestHtmlReport { + mustRunAfter(consoleLauncherTest) + argumentProviders += CommandLineArgumentProvider { + consoleLauncherTestEventXmlFiles.files.map { it.absolutePath }.toList() + } } register("consoleLauncher") { diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 5f7af01a9880..0803439636db 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -38,6 +38,9 @@ JUnit repository on GitHub. `--select-file` and `--select-resource`. * `ConsoleLauncher` now accepts multiple values for all `--select` options. * Add `--select-unique-id` support to ConsoleLauncher. +* The `junit-platform-reporting` module now contributes a section containing + JUnit-specific metadata about each test/container to the HTML report written by + open-test-reporting when added to the classpath/module path. [[release-notes-5.12.0-M1-junit-jupiter]] diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 280296f51653..cac10079a754 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -15,7 +15,7 @@ junit4Min = "4.12" ktlint = "1.4.1" log4j = "2.24.1" opentest4j = "1.3.0" -openTestReporting = "0.1.0-M2" +openTestReporting = "0.1.0-SNAPSHOT" surefire = "3.5.2" xmlunit = "2.10.0" @@ -56,8 +56,10 @@ memoryfilesystem = { module = "com.github.marschall:memoryfilesystem", version = mockito = { module = "org.mockito:mockito-junit-jupiter", version = "5.14.2" } nohttp-checkstyle = { module = "io.spring.nohttp:nohttp-checkstyle", version = "0.0.11" } opentest4j = { module = "org.opentest4j:opentest4j", version.ref = "opentest4j" } +openTestReporting-cli = { module = "org.opentest4j.reporting:open-test-reporting-cli", version.ref = "openTestReporting" } openTestReporting-events = { module = "org.opentest4j.reporting:open-test-reporting-events", version.ref = "openTestReporting" } -openTestReporting-tooling = { module = "org.opentest4j.reporting:open-test-reporting-tooling", version.ref = "openTestReporting" } +openTestReporting-tooling-core = { module = "org.opentest4j.reporting:open-test-reporting-tooling-core", version.ref = "openTestReporting" } +openTestReporting-tooling-spi = { module = "org.opentest4j.reporting:open-test-reporting-tooling-spi", version.ref = "openTestReporting" } picocli = { module = "info.picocli:picocli", version = "4.7.6" } slf4j-julBinding = { module = "org.slf4j:slf4j-jdk14", version = "2.0.16" } spock1 = { module = "org.spockframework:spock-core", version = "1.3-groovy-2.5" } diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts index 0048f12f7b21..ca95f0852acc 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts @@ -1,14 +1,50 @@ + import com.gradle.develocity.agent.gradle.internal.test.PredictiveTestSelectionConfigurationInternal import com.gradle.develocity.agent.gradle.test.PredictiveTestSelectionMode +import org.gradle.api.tasks.PathSensitivity.NONE import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL import org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED import org.gradle.internal.os.OperatingSystem +import java.nio.file.Files plugins { `java-library` id("junitbuild.build-parameters") } +var openTestReportingCli = configurations.dependencyScope("openTestReportingCli") +var openTestReportingCliClasspath = configurations.resolvable("openTestReportingCliClasspath") { + extendsFrom(openTestReportingCli.get()) +} + +val generateOpenTestHtmlReport by tasks.registering(JavaExec::class) { + mustRunAfter(tasks.withType()) + mainClass.set("org.opentest4j.reporting.cli.ReportingCli") + args("html-report") + classpath(openTestReportingCliClasspath) + argumentProviders += objects.newInstance(HtmlReportParameters::class).apply { + eventXmlFiles.from(tasks.withType().map { + objects.fileTree() + .from(it.reports.junitXml.outputLocation) + .include("junit-platform-events-*.xml") + }) + outputLocation = layout.buildDirectory.file("reports/open-test-report.html") + } +} + +abstract class HtmlReportParameters : CommandLineArgumentProvider { + + @get:InputFiles + @get:PathSensitive(NONE) + abstract val eventXmlFiles: ConfigurableFileCollection + + @get:OutputFile + abstract val outputLocation: RegularFileProperty + + override fun asArguments() = listOf("--output", outputLocation.get().asFile.absolutePath) + + eventXmlFiles.map { it.absolutePath }.toList() +} + tasks.withType().configureEach { useJUnitPlatform { includeEngines("junit-jupiter") @@ -79,6 +115,15 @@ tasks.withType().configureEach { "-Djunit.platform.reporting.output.dir=${reports.junitXml.outputLocation.get().asFile.absolutePath}" ) } + + val reportFiles = objects.fileTree().from(reports.junitXml.outputLocation).matching { include("junit-platform-events-*.xml") } + doFirst { + reportFiles.files.forEach { + Files.delete(it.toPath()) + } + } + + finalizedBy(generateOpenTestHtmlReport) } dependencies { @@ -98,4 +143,7 @@ dependencies { testRuntimeOnly(dependencyFromLibs("openTestReporting-events")) { because("it's required to run tests via IntelliJ which does not consumed the shadowed jar of junit-platform-reporting") } + + openTestReportingCli(dependencyFromLibs("openTestReporting-cli")) + openTestReportingCli(project(":junit-platform-reporting")) } diff --git a/junit-platform-console-standalone/junit-platform-console-standalone.gradle.kts b/junit-platform-console-standalone/junit-platform-console-standalone.gradle.kts index d3d933e10caa..7eac863ccdd7 100644 --- a/junit-platform-console-standalone/junit-platform-console-standalone.gradle.kts +++ b/junit-platform-console-standalone/junit-platform-console-standalone.gradle.kts @@ -17,6 +17,8 @@ dependencies { shadowed(libs.apiguardian) { because("downstream projects need it to avoid compiler warnings") } + + osgiVerification(libs.openTestReporting.tooling.spi) } val jupiterVersion = rootProject.version diff --git a/junit-platform-console/junit-platform-console.gradle.kts b/junit-platform-console/junit-platform-console.gradle.kts index be24d568d804..24a041a49f50 100644 --- a/junit-platform-console/junit-platform-console.gradle.kts +++ b/junit-platform-console/junit-platform-console.gradle.kts @@ -20,6 +20,7 @@ dependencies { osgiVerification(projects.junitJupiterEngine) osgiVerification(projects.junitPlatformLauncher) + osgiVerification(libs.openTestReporting.tooling.spi) } tasks { diff --git a/junit-platform-reporting/junit-platform-reporting.gradle.kts b/junit-platform-reporting/junit-platform-reporting.gradle.kts index b95816fcfc2d..f1dede61555d 100644 --- a/junit-platform-reporting/junit-platform-reporting.gradle.kts +++ b/junit-platform-reporting/junit-platform-reporting.gradle.kts @@ -1,6 +1,7 @@ plugins { id("junitbuild.java-library-conventions") id("junitbuild.shadow-conventions") + `java-test-fixtures` } description = "JUnit Platform Reporting" @@ -10,16 +11,23 @@ dependencies { api(projects.junitPlatformLauncher) compileOnlyApi(libs.apiguardian) + compileOnlyApi(libs.openTestReporting.tooling.spi) shadowed(libs.openTestReporting.events) osgiVerification(projects.junitJupiterEngine) osgiVerification(projects.junitPlatformLauncher) + osgiVerification(libs.openTestReporting.tooling.spi) + + testFixturesApi(projects.junitJupiterApi) } tasks { shadowJar { - relocate("org.opentest4j.reporting", "org.junit.platform.reporting.shadow.org.opentest4j.reporting") + listOf("events", "schema").forEach { name -> + val packageName = "org.opentest4j.reporting.${name}" + relocate(packageName, "org.junit.platform.reporting.shadow.${packageName}") + } from(projectDir) { include("LICENSE-open-test-reporting.md") into("META-INF") diff --git a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/JUnitContributor.java b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/JUnitContributor.java new file mode 100644 index 000000000000..252900d5c645 --- /dev/null +++ b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/JUnitContributor.java @@ -0,0 +1,79 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.reporting.open.xml; + +import static java.util.Collections.emptyList; +import static java.util.Collections.singletonList; +import static org.apiguardian.api.API.Status.INTERNAL; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.apiguardian.api.API; +import org.opentest4j.reporting.schema.Namespace; +import org.opentest4j.reporting.tooling.spi.htmlreport.Contributor; +import org.opentest4j.reporting.tooling.spi.htmlreport.KeyValuePairs; +import org.opentest4j.reporting.tooling.spi.htmlreport.Section; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * Contributes a section containing JUnit-specific metadata for each test node + * to the open-test-reporting HTML report. + * + * @since 1.12 + */ +@SuppressWarnings("exports") // we don't want to export 'org.opentest4j.reporting.tooling.spi' transitively +@API(status = INTERNAL, since = "1.12") +public class JUnitContributor implements Contributor { + + public JUnitContributor() { + } + + @Override + public List

    contributeSectionsForTestNode(Element testNodeElement) { + return findChild(testNodeElement, Namespace.REPORTING_CORE, "metadata") // + .map(metadata -> { + Map table = new LinkedHashMap<>(); + findChild(metadata, JUnitFactory.NAMESPACE, "type") // + .map(Node::getTextContent) // + .ifPresent(value -> table.put("Type", value)); + findChild(metadata, JUnitFactory.NAMESPACE, "uniqueId") // + .map(Node::getTextContent) // + .ifPresent(value -> table.put("Unique ID", value)); + findChild(metadata, JUnitFactory.NAMESPACE, "legacyReportingName") // + .map(Node::getTextContent) // + .ifPresent(value -> table.put("Legacy reporting name", value)); + return table; + }) // + .filter(table -> !table.isEmpty()) // + .map(table -> singletonList(Section.builder() // + .title("JUnit metadata") // + .order(15) // + .addBlock(KeyValuePairs.builder().content(table).build()) // + .build())) // + .orElse(emptyList()); + } + + private static Optional findChild(Node parent, Namespace namespace, String localName) { + NodeList children = parent.getChildNodes(); + for (int i = 0; i < children.getLength(); i++) { + Node child = children.item(i); + if (localName.equals(child.getLocalName()) && namespace.getUri().equals(child.getNamespaceURI())) { + return Optional.of(child); + } + } + return Optional.empty(); + } +} diff --git a/junit-platform-reporting/src/main/resources/META-INF/services/org.opentest4j.reporting.tooling.spi.htmlreport.Contributor b/junit-platform-reporting/src/main/resources/META-INF/services/org.opentest4j.reporting.tooling.spi.htmlreport.Contributor new file mode 100644 index 000000000000..151ef99b166d --- /dev/null +++ b/junit-platform-reporting/src/main/resources/META-INF/services/org.opentest4j.reporting.tooling.spi.htmlreport.Contributor @@ -0,0 +1 @@ +org.junit.platform.reporting.open.xml.JUnitContributor diff --git a/junit-platform-reporting/src/module/org.junit.platform.reporting/module-info.java b/junit-platform-reporting/src/module/org.junit.platform.reporting/module-info.java index 66c749470bf0..e871bf2a97fe 100644 --- a/junit-platform-reporting/src/module/org.junit.platform.reporting/module-info.java +++ b/junit-platform-reporting/src/module/org.junit.platform.reporting/module-info.java @@ -19,6 +19,7 @@ requires org.junit.platform.commons; requires transitive org.junit.platform.engine; requires transitive org.junit.platform.launcher; + requires org.opentest4j.reporting.tooling.spi; // exports org.junit.platform.reporting; empty package exports org.junit.platform.reporting.legacy; @@ -27,4 +28,7 @@ provides org.junit.platform.launcher.TestExecutionListener with org.junit.platform.reporting.open.xml.OpenTestReportGeneratingListener; + + provides org.opentest4j.reporting.tooling.spi.htmlreport.Contributor + with org.junit.platform.reporting.open.xml.JUnitContributor; } diff --git a/junit-platform-reporting/src/testFixtures/java/org/junit/platform/reporting/open/xml/OpenTestReportGenerationSystemPropertyOverride.java b/junit-platform-reporting/src/testFixtures/java/org/junit/platform/reporting/open/xml/OpenTestReportGenerationSystemPropertyOverride.java new file mode 100644 index 000000000000..c3937c128a01 --- /dev/null +++ b/junit-platform-reporting/src/testFixtures/java/org/junit/platform/reporting/open/xml/OpenTestReportGenerationSystemPropertyOverride.java @@ -0,0 +1,43 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.reporting.open.xml; + +import static org.junit.platform.reporting.open.xml.OpenTestReportGeneratingListener.ENABLED_PROPERTY_NAME; + +import org.junit.jupiter.api.extension.AfterTestExecutionCallback; +import org.junit.jupiter.api.extension.BeforeTestExecutionCallback; +import org.junit.jupiter.api.extension.ExtensionContext; + +public class OpenTestReportGenerationSystemPropertyOverride + implements BeforeTestExecutionCallback, AfterTestExecutionCallback { + + @Override + public void beforeTestExecution(ExtensionContext context) { + var oldValue = System.clearProperty(ENABLED_PROPERTY_NAME); + getStore(context).put(ENABLED_PROPERTY_NAME, oldValue); + } + + @Override + public void afterTestExecution(ExtensionContext context) { + var oldValue = getStore(context).get(ENABLED_PROPERTY_NAME, String.class); + if (oldValue == null) { + System.clearProperty(ENABLED_PROPERTY_NAME); + } + else { + System.setProperty(ENABLED_PROPERTY_NAME, oldValue); + } + } + + private static ExtensionContext.Store getStore(ExtensionContext context) { + return context.getStore( + ExtensionContext.Namespace.create(OpenTestReportGenerationSystemPropertyOverride.class)); + } +} diff --git a/junit-platform-reporting/src/testFixtures/resources/META-INF/services/org.junit.jupiter.api.extension.Extension b/junit-platform-reporting/src/testFixtures/resources/META-INF/services/org.junit.jupiter.api.extension.Extension new file mode 100644 index 000000000000..1b5725ecf2df --- /dev/null +++ b/junit-platform-reporting/src/testFixtures/resources/META-INF/services/org.junit.jupiter.api.extension.Extension @@ -0,0 +1 @@ +org.junit.platform.reporting.open.xml.OpenTestReportGenerationSystemPropertyOverride diff --git a/platform-tests/platform-tests.gradle.kts b/platform-tests/platform-tests.gradle.kts index 183203351e94..b1bbf5c4799f 100644 --- a/platform-tests/platform-tests.gradle.kts +++ b/platform-tests/platform-tests.gradle.kts @@ -32,10 +32,11 @@ dependencies { exclude(group = "org.junit.vintage") } testImplementation(libs.joox) - testImplementation(libs.openTestReporting.tooling) + testImplementation(libs.openTestReporting.tooling.core) testImplementation(libs.picocli) testImplementation(libs.bundles.xmlunit) testImplementation(testFixtures(projects.junitJupiterApi)) + testImplementation(testFixtures(projects.junitPlatformReporting)) // --- Test run-time dependencies --------------------------------------------- testRuntimeOnly(projects.junitVintageEngine) diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java index b66b09e50e3c..ef81af430d6e 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java @@ -248,7 +248,7 @@ public void write(char[] buffer, int off, int len) { writeXmlReport(testPlan, reportData, assertingWriter); } - @ParameterizedTest + @ParameterizedTest(name = "{index}") @MethodSource("stringPairs") void escapesIllegalChars(String input, String output) { assertEquals(output, XmlReportWriter.escapeIllegalChars(input)); diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/JUnitContributorTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/JUnitContributorTests.java new file mode 100644 index 000000000000..33fe331527a4 --- /dev/null +++ b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/JUnitContributorTests.java @@ -0,0 +1,67 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.reporting.open.xml; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; +import org.opentest4j.reporting.tooling.core.htmlreport.DefaultHtmlReportWriter; + +public class JUnitContributorTests { + + @Test + void contributesJUnitSpecificMetadata(@TempDir Path tempDir) throws Exception { + var xmlFile = Files.writeString(tempDir.resolve("report.xml"), + """ + + + + [engine:dummy] + dummy + CONTAINER + + + + + [engine:dummy]/[test:method] + method() + TEST + + + + + + + + + + """); + var htmlReport = tempDir.resolve("report.html"); + + new DefaultHtmlReportWriter().writeHtmlReport(List.of(xmlFile), htmlReport); + + assertThat(htmlReport).content() // + .contains("JUnit metadata") // + .contains("Type").contains("CONTAINER") // + .contains("Unique ID").contains("[engine:dummy]") // + .contains("Legacy reporting name").contains("dummy") // + .contains("Type").contains("TEST") // + .contains("Unique ID").contains("[engine:dummy]/[test:method]") // + .contains("Legacy reporting name").contains("method()"); + } +} diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java index 6a285f05c995..946662eb3577 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java @@ -33,8 +33,8 @@ import org.junit.platform.engine.UniqueId; import org.junit.platform.engine.reporting.ReportEntry; import org.junit.platform.engine.support.hierarchical.DemoHierarchicalTestEngine; -import org.opentest4j.reporting.tooling.validator.DefaultValidator; -import org.opentest4j.reporting.tooling.validator.ValidationResult; +import org.opentest4j.reporting.tooling.core.validator.DefaultValidator; +import org.opentest4j.reporting.tooling.core.validator.ValidationResult; import org.xmlunit.assertj3.XmlAssert; import org.xmlunit.placeholder.PlaceholderDifferenceEvaluator; diff --git a/platform-tests/src/test/resources/junit-platform.properties b/platform-tests/src/test/resources/junit-platform.properties new file mode 100644 index 000000000000..6efc0d5e85ce --- /dev/null +++ b/platform-tests/src/test/resources/junit-platform.properties @@ -0,0 +1 @@ +junit.jupiter.extensions.autodetection.enabled=true diff --git a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts index 3938425035a3..cec43928c027 100644 --- a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts +++ b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts @@ -77,6 +77,7 @@ dependencies { thirdPartyJars(libs.apiguardian) thirdPartyJars(libs.hamcrest) thirdPartyJars(libs.opentest4j) + thirdPartyJars(libs.openTestReporting.tooling.spi) thirdPartyJars(libs.jimfs) antJars(platform(projects.junitBom)) diff --git a/platform-tooling-support-tests/projects/jar-describe-module/junit-platform-reporting.expected.txt b/platform-tooling-support-tests/projects/jar-describe-module/junit-platform-reporting.expected.txt index e9dbd208e00a..2362fbb8152f 100644 --- a/platform-tooling-support-tests/projects/jar-describe-module/junit-platform-reporting.expected.txt +++ b/platform-tooling-support-tests/projects/jar-describe-module/junit-platform-reporting.expected.txt @@ -8,4 +8,6 @@ requires org.apiguardian.api static transitive requires org.junit.platform.commons requires org.junit.platform.engine transitive requires org.junit.platform.launcher transitive +requires org.opentest4j.reporting.tooling.spi provides org.junit.platform.launcher.TestExecutionListener with org.junit.platform.reporting.open.xml.OpenTestReportGeneratingListener +provides org.opentest4j.reporting.tooling.spi.htmlreport.Contributor with org.junit.platform.reporting.open.xml.JUnitContributor diff --git a/platform-tooling-support-tests/projects/maven-starter/pom.xml b/platform-tooling-support-tests/projects/maven-starter/pom.xml index 5ba697cd2353..367df2e0f09d 100644 --- a/platform-tooling-support-tests/projects/maven-starter/pom.xml +++ b/platform-tooling-support-tests/projects/maven-starter/pom.xml @@ -89,6 +89,16 @@ true + + sonatype-oss-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + true + + + false + + diff --git a/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml b/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml index e76513937258..8c9478ffa825 100644 --- a/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml +++ b/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml @@ -68,6 +68,16 @@ true + + sonatype-oss-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + true + + + false + + diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java index 9cc73d479795..21c7e2076f30 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java @@ -54,6 +54,11 @@ @AnalyzeClasses(locations = ArchUnitTests.AllJars.class) class ArchUnitTests { + @SuppressWarnings("unused") + @ArchTest + private final ArchRule allClassesAreInJUnitPackage = classes() // + .should().haveNameMatching("org\\.junit\\..+"); + @SuppressWarnings("unused") @ArchTest private final ArchRule allPublicTopLevelTypesHaveApiAnnotations = classes() // diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java index a38c353cda4d..afb87c75534c 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java @@ -20,7 +20,6 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.stream.Collectors; import de.sormuras.bartholdy.jdk.Jar; @@ -62,7 +61,7 @@ void describeModule(String module) throws Exception { result.getOutputLines("out").forEach(System.err::println); fail("No such file: " + expected); } - var expectedLines = Files.lines(expected).map(Helper::replaceVersionPlaceholders).collect(Collectors.toList()); + var expectedLines = Files.lines(expected).map(Helper::replaceVersionPlaceholders).toList(); var origin = Path.of("projects", "jar-describe-module", module + ".expected.txt").toUri(); assertLinesMatch(expectedLines, result.getOutputLines("out"), () -> String.format("%s\nError", origin)); } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java index cd1feb988436..5f3f6190d069 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java @@ -86,6 +86,7 @@ private static List compile(Path temp, Writer out, Writer err) throws Ex ThirdPartyJars.copy(lib, "org.apiguardian", "apiguardian-api"); ThirdPartyJars.copy(lib, "org.hamcrest", "hamcrest"); ThirdPartyJars.copy(lib, "org.opentest4j", "opentest4j"); + ThirdPartyJars.copy(lib, "org.opentest4j.reporting", "open-test-reporting-tooling-spi"); ThirdPartyJars.copy(lib, "com.google.jimfs", "jimfs"); ThirdPartyJars.copy(lib, "com.google.guava", "guava"); Helper.loadAllJUnitModules(lib); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java index e033b3e62e97..fcca116f5b83 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java @@ -118,7 +118,10 @@ void printVersionViaModule() { var junitJars = Stream.of("junit-platform-console", "junit-platform-reporting", "junit-platform-engine", "junit-platform-launcher", "junit-platform-commons") // .map(MavenRepo::jar); - var thirdPartyJars = Stream.of(ThirdPartyJars.find("org.opentest4j", "opentest4j")); + var thirdPartyJars = Stream.of( // + ThirdPartyJars.find("org.opentest4j", "opentest4j"), // + ThirdPartyJars.find("org.opentest4j.reporting", "open-test-reporting-tooling-spi") // + ); var modulePath = Stream.concat(junitJars, thirdPartyJars) // .map(String::valueOf) // .collect(joining(File.pathSeparator)); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ToolProviderTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ToolProviderTests.java index d99ab0164ab4..0b979d1dff44 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ToolProviderTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ToolProviderTests.java @@ -31,7 +31,6 @@ import java.util.ServiceLoader; import java.util.Set; import java.util.spi.ToolProvider; -import java.util.stream.Collectors; import java.util.stream.StreamSupport; import org.junit.jupiter.api.BeforeAll; @@ -69,6 +68,7 @@ static void prepareLocalLibraryDirectoryWithJUnitPlatformModules() { } ThirdPartyJars.copy(lib, "org.apiguardian", "apiguardian-api"); ThirdPartyJars.copy(lib, "org.opentest4j", "opentest4j"); + ThirdPartyJars.copy(lib, "org.opentest4j.reporting", "open-test-reporting-tooling-spi"); } catch (Exception e) { throw new AssertionError("Preparing local library folder failed", e); @@ -97,7 +97,7 @@ void findAndRunJUnitOnTheModulePath() { .map(ModuleReference::descriptor) // .map(ModuleDescriptor::toNameAndVersion) // .sorted() // - .collect(Collectors.toList()); + .toList(); // modules.forEach(System.out::println); var bootLayer = ModuleLayer.boot(); @@ -139,7 +139,7 @@ private static void assertJUnitPrintsHelpMessage(ToolProvider junit) { ">> USAGE >>", // "Launches the JUnit Platform for test discovery and execution.", // ">> OPTIONS >>"), // - out.toString().lines().collect(Collectors.toList())), // + out.toString().lines().toList()), // () -> assertEquals("", err.toString()), // () -> assertEquals(0, code, "Expected exit of 0, but got: " + code) // ); From 1680c9581cb46e982840571dbd80aef07a5aaf3a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2024 17:10:51 +0000 Subject: [PATCH 264/611] Update dependency gradle to v8.11 --- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index fb602ee2af06..82dd18b2043e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=31c55713e40233a8303827ceb42ca48a47267a0ad4bab9177123121e71524c26 -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip +distributionSha256Sum=57dafb5c2622c6cc08b993c85b7c06956a2f53536432a30ead46166dbca0f1e9 +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME From ddeac0da590c19704fef9e555f1eea8a5c5ebe25 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 12 Nov 2024 08:38:20 +0100 Subject: [PATCH 265/611] Enable parallel config cache load and store --- gradle.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/gradle.properties b/gradle.properties index 9fc0c535e8f1..4f2ab7df9946 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,6 +19,7 @@ org.gradle.jvmargs=-Xmx1g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryEr --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED org.gradle.caching=true org.gradle.parallel=true +org.gradle.configuration-cache.parallel=true org.gradle.java.installations.fromEnv=JDK8,JDK18,JDK19,JDK20,JDK21,JDK22,JDK23,JDK24 org.gradle.kotlin.dsl.allWarningsAsErrors=true From 84867c8f08ccee80604ab23264918e3936d69651 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 12 Nov 2024 08:39:56 +0100 Subject: [PATCH 266/611] Add indirection to suppress deprecation warning for now --- build.gradle.kts | 8 ++++---- documentation/documentation.gradle.kts | 8 ++++---- .../common/src/main/kotlin/ProjectExtensions.kt | 12 +++++++++++- .../junit-platform-console-standalone.gradle.kts | 4 ++-- .../junit-platform-console.gradle.kts | 2 +- platform-tests/platform-tests.gradle.kts | 4 ++-- .../platform-tooling-support-tests.gradle.kts | 2 +- 7 files changed, 25 insertions(+), 15 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index e5404fa14f6d..fe237503c506 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -30,7 +30,7 @@ val platformProjects by extra(listOf( projects.junitPlatformSuiteCommons, projects.junitPlatformSuiteEngine, projects.junitPlatformTestkit -).map { it.dependencyProject }) +).map { it.actualProject }) val jupiterProjects by extra(listOf( projects.junitJupiter, @@ -38,14 +38,14 @@ val jupiterProjects by extra(listOf( projects.junitJupiterEngine, projects.junitJupiterMigrationsupport, projects.junitJupiterParams -).map { it.dependencyProject }) +).map { it.actualProject }) val vintageProjects by extra(listOf( - projects.junitVintageEngine.dependencyProject + projects.junitVintageEngine.actualProject )) val mavenizedProjects by extra(platformProjects + jupiterProjects + vintageProjects) -val modularProjects by extra(mavenizedProjects - listOf(projects.junitPlatformConsoleStandalone.dependencyProject)) +val modularProjects by extra(mavenizedProjects - listOf(projects.junitPlatformConsoleStandalone.actualProject)) dependencies { modularProjects.forEach { diff --git a/documentation/documentation.gradle.kts b/documentation/documentation.gradle.kts index 62e8b3605e06..36eca562d406 100644 --- a/documentation/documentation.gradle.kts +++ b/documentation/documentation.gradle.kts @@ -553,14 +553,14 @@ tasks { eclipse { classpath { - plusConfigurations.add(projects.junitPlatformConsole.dependencyProject.configurations["shadowedClasspath"]) - plusConfigurations.add(projects.junitJupiterParams.dependencyProject.configurations["shadowedClasspath"]) + plusConfigurations.add(projects.junitPlatformConsole.actualProject.configurations["shadowedClasspath"]) + plusConfigurations.add(projects.junitJupiterParams.actualProject.configurations["shadowedClasspath"]) } } idea { module { - scopes["PROVIDED"]!!["plus"]!!.add(projects.junitPlatformConsole.dependencyProject.configurations["shadowedClasspath"]) - scopes["PROVIDED"]!!["plus"]!!.add(projects.junitJupiterParams.dependencyProject.configurations["shadowedClasspath"]) + scopes["PROVIDED"]!!["plus"]!!.add(projects.junitPlatformConsole.actualProject.configurations["shadowedClasspath"]) + scopes["PROVIDED"]!!["plus"]!!.add(projects.junitJupiterParams.actualProject.configurations["shadowedClasspath"]) } } diff --git a/gradle/plugins/common/src/main/kotlin/ProjectExtensions.kt b/gradle/plugins/common/src/main/kotlin/ProjectExtensions.kt index fc8a515977e7..faa33e8e702e 100644 --- a/gradle/plugins/common/src/main/kotlin/ProjectExtensions.kt +++ b/gradle/plugins/common/src/main/kotlin/ProjectExtensions.kt @@ -1,10 +1,20 @@ import org.gradle.api.Project +import org.gradle.api.artifacts.ProjectDependency import org.gradle.api.artifacts.VersionCatalog import org.gradle.api.artifacts.VersionCatalogsExtension import org.gradle.kotlin.dsl.the val Project.javaModuleName: String - get() = "org." + this.name.replace('-', '.') + get() = toModuleName(name) + +val ProjectDependency.javaModuleName: String + get() = toModuleName(name) + +private fun toModuleName(name: String) = "org.${name.replace('-', '.')}" + +val ProjectDependency.actualProject: Project + @Suppress("DEPRECATION") + get() = this.dependencyProject fun Project.requiredVersionFromLibs(name: String) = libsVersionCatalog.findVersion(name).get().requiredVersion diff --git a/junit-platform-console-standalone/junit-platform-console-standalone.gradle.kts b/junit-platform-console-standalone/junit-platform-console-standalone.gradle.kts index 7eac863ccdd7..aa35b91be8f8 100644 --- a/junit-platform-console-standalone/junit-platform-console-standalone.gradle.kts +++ b/junit-platform-console-standalone/junit-platform-console-standalone.gradle.kts @@ -41,11 +41,11 @@ tasks { // https://github.com/junit-team/junit5/issues/761 // prevent duplicates, add 3rd-party licenses explicitly exclude("META-INF/LICENSE*.md") - from(project.projects.junitPlatformConsole.dependencyProject.projectDir) { + from(project.projects.junitPlatformConsole.actualProject.projectDir) { include("LICENSE-picocli.md") into("META-INF") } - from(project.projects.junitJupiterParams.dependencyProject.projectDir) { + from(project.projects.junitJupiterParams.actualProject.projectDir) { include("LICENSE-univocity-parsers.md") into("META-INF") } diff --git a/junit-platform-console/junit-platform-console.gradle.kts b/junit-platform-console/junit-platform-console.gradle.kts index 24a041a49f50..cd256959b629 100644 --- a/junit-platform-console/junit-platform-console.gradle.kts +++ b/junit-platform-console/junit-platform-console.gradle.kts @@ -27,7 +27,7 @@ tasks { compileModule { options.compilerArgs.addAll(listOf( "--add-modules", "org.opentest4j.reporting.events", - "--add-reads", "${project.projects.junitPlatformReporting.dependencyProject.javaModuleName}=org.opentest4j.reporting.events", + "--add-reads", "${project.projects.junitPlatformReporting.javaModuleName}=org.opentest4j.reporting.events", "--add-modules", "info.picocli", "--add-reads", "${javaModuleName}=info.picocli" )) diff --git a/platform-tests/platform-tests.gradle.kts b/platform-tests/platform-tests.gradle.kts index b1bbf5c4799f..5d72057478d5 100644 --- a/platform-tests/platform-tests.gradle.kts +++ b/platform-tests/platform-tests.gradle.kts @@ -84,12 +84,12 @@ tasks { eclipse { classpath { - plusConfigurations.add(projects.junitPlatformConsole.dependencyProject.configurations["shadowedClasspath"]) + plusConfigurations.add(projects.junitPlatformConsole.actualProject.configurations["shadowedClasspath"]) } } idea { module { - scopes["PROVIDED"]!!["plus"]!!.add(projects.junitPlatformConsole.dependencyProject.configurations["shadowedClasspath"]) + scopes["PROVIDED"]!!["plus"]!!.add(projects.junitPlatformConsole.actualProject.configurations["shadowedClasspath"]) } } diff --git a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts index cec43928c027..3ecbdf101298 100644 --- a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts +++ b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts @@ -109,7 +109,7 @@ val normalizeMavenRepo by tasks.registering(Sync::class) { val tempRepoName: String by rootProject // All maven-aware projects must be published to the local temp repository - (mavenizedProjects + projects.junitBom.dependencyProject) + (mavenizedProjects + projects.junitBom.actualProject) .map { project -> project.tasks.named("publishAllPublicationsTo${tempRepoName.capitalized()}Repository") } .forEach { dependsOn(it) } From c643776c675ca85214c88c4aed52deceb0a5b33c Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 12 Nov 2024 08:40:09 +0100 Subject: [PATCH 267/611] Make HTML report generation cacheable --- .../src/main/kotlin/junitbuild.testing-conventions.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts index ca95f0852acc..a89dd59b290e 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts @@ -30,6 +30,7 @@ val generateOpenTestHtmlReport by tasks.registering(JavaExec::class) { }) outputLocation = layout.buildDirectory.file("reports/open-test-report.html") } + outputs.cacheIf { true } } abstract class HtmlReportParameters : CommandLineArgumentProvider { From 03abd80977ffc19bd68ebcb397de3e218e366cf9 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 12 Nov 2024 09:02:32 +0100 Subject: [PATCH 268/611] Resolve deprecation warnings --- ...unitbuild.kotlin-library-conventions.gradle.kts | 14 ++++++++------ .../main/kotlin/junitbuild/java/UpdateJarAction.kt | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.kotlin-library-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.kotlin-library-conventions.gradle.kts index 0dcf7bf13282..046cf094dfad 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.kotlin-library-conventions.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.kotlin-library-conventions.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -10,13 +12,13 @@ tasks.named("kotlinSourcesJar") { } tasks.withType().configureEach { - kotlinOptions { - apiVersion = "1.6" - languageVersion = "1.6" + compilerOptions { + apiVersion = KotlinVersion.fromVersion("1.6") + languageVersion = apiVersion allWarningsAsErrors = false // Compiler arg is required for Kotlin 1.6 and below // see https://kotlinlang.org/docs/whatsnew17.html#stable-opt-in-requirements - freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn" + freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn") } } @@ -24,10 +26,10 @@ afterEvaluate { val extension = project.the() tasks { withType().configureEach { - kotlinOptions.jvmTarget = extension.mainJavaVersion.toString() + compilerOptions.jvmTarget = JvmTarget.fromTarget(extension.mainJavaVersion.toString()) } named("compileTestKotlin") { - kotlinOptions.jvmTarget = extension.testJavaVersion.toString() + compilerOptions.jvmTarget = JvmTarget.fromTarget(extension.testJavaVersion.toString()) } } } diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild/java/UpdateJarAction.kt b/gradle/plugins/common/src/main/kotlin/junitbuild/java/UpdateJarAction.kt index 282a6aeaf469..07acb7e488e4 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild/java/UpdateJarAction.kt +++ b/gradle/plugins/common/src/main/kotlin/junitbuild/java/UpdateJarAction.kt @@ -2,7 +2,7 @@ package junitbuild.java import org.gradle.api.Action import org.gradle.api.Task -import org.gradle.api.internal.file.archive.ZipCopyAction +import org.gradle.api.internal.file.archive.ZipEntryConstants import org.gradle.api.provider.ListProperty import org.gradle.api.provider.Property import org.gradle.jvm.toolchain.JavaLauncher @@ -19,7 +19,7 @@ abstract class UpdateJarAction @Inject constructor(private val operations: ExecO // Since ZipCopyAction.CONSTANT_TIME_FOR_ZIP_ENTRIES is in the default time zone (see its Javadoc), // we're converting it to the same time in UTC here to make the jar reproducible regardless of the // build's time zone. - private val CONSTANT_TIME_FOR_ZIP_ENTRIES = LocalDateTime.ofInstant(Instant.ofEpochMilli(ZipCopyAction.CONSTANT_TIME_FOR_ZIP_ENTRIES), ZoneId.systemDefault()) + private val CONSTANT_TIME_FOR_ZIP_ENTRIES = LocalDateTime.ofInstant(Instant.ofEpochMilli(ZipEntryConstants.CONSTANT_TIME_FOR_ZIP_ENTRIES), ZoneId.systemDefault()) .toInstant(ZoneOffset.UTC) .toString() } From 9c44d42ea20409dbc01ecf835503c96d10c527ba Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 12 Nov 2024 09:08:57 +0100 Subject: [PATCH 269/611] Work around deprecation warning --- build.gradle.kts | 8 ++++---- documentation/documentation.gradle.kts | 8 ++++---- .../plugins/common/src/main/kotlin/ProjectExtensions.kt | 5 ++--- .../junit-platform-console-standalone.gradle.kts | 4 ++-- platform-tests/platform-tests.gradle.kts | 4 ++-- .../platform-tooling-support-tests.gradle.kts | 2 +- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index fe237503c506..cd79a120700b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -30,7 +30,7 @@ val platformProjects by extra(listOf( projects.junitPlatformSuiteCommons, projects.junitPlatformSuiteEngine, projects.junitPlatformTestkit -).map { it.actualProject }) +).map { dependencyProject(it) }) val jupiterProjects by extra(listOf( projects.junitJupiter, @@ -38,14 +38,14 @@ val jupiterProjects by extra(listOf( projects.junitJupiterEngine, projects.junitJupiterMigrationsupport, projects.junitJupiterParams -).map { it.actualProject }) +).map { dependencyProject(it) }) val vintageProjects by extra(listOf( - projects.junitVintageEngine.actualProject + dependencyProject(projects.junitVintageEngine) )) val mavenizedProjects by extra(platformProjects + jupiterProjects + vintageProjects) -val modularProjects by extra(mavenizedProjects - listOf(projects.junitPlatformConsoleStandalone.actualProject)) +val modularProjects by extra(mavenizedProjects - setOf(dependencyProject(projects.junitPlatformConsoleStandalone))) dependencies { modularProjects.forEach { diff --git a/documentation/documentation.gradle.kts b/documentation/documentation.gradle.kts index 36eca562d406..2f1cff759cd1 100644 --- a/documentation/documentation.gradle.kts +++ b/documentation/documentation.gradle.kts @@ -553,14 +553,14 @@ tasks { eclipse { classpath { - plusConfigurations.add(projects.junitPlatformConsole.actualProject.configurations["shadowedClasspath"]) - plusConfigurations.add(projects.junitJupiterParams.actualProject.configurations["shadowedClasspath"]) + plusConfigurations.add(dependencyProject(projects.junitPlatformConsole).configurations["shadowedClasspath"]) + plusConfigurations.add(dependencyProject(projects.junitJupiterParams).configurations["shadowedClasspath"]) } } idea { module { - scopes["PROVIDED"]!!["plus"]!!.add(projects.junitPlatformConsole.actualProject.configurations["shadowedClasspath"]) - scopes["PROVIDED"]!!["plus"]!!.add(projects.junitJupiterParams.actualProject.configurations["shadowedClasspath"]) + scopes["PROVIDED"]!!["plus"]!!.add(dependencyProject(projects.junitPlatformConsole).configurations["shadowedClasspath"]) + scopes["PROVIDED"]!!["plus"]!!.add(dependencyProject(projects.junitJupiterParams).configurations["shadowedClasspath"]) } } diff --git a/gradle/plugins/common/src/main/kotlin/ProjectExtensions.kt b/gradle/plugins/common/src/main/kotlin/ProjectExtensions.kt index faa33e8e702e..33c7a591b546 100644 --- a/gradle/plugins/common/src/main/kotlin/ProjectExtensions.kt +++ b/gradle/plugins/common/src/main/kotlin/ProjectExtensions.kt @@ -12,9 +12,8 @@ val ProjectDependency.javaModuleName: String private fun toModuleName(name: String) = "org.${name.replace('-', '.')}" -val ProjectDependency.actualProject: Project - @Suppress("DEPRECATION") - get() = this.dependencyProject +fun Project.dependencyProject(dependency: ProjectDependency) = + project(dependency.path) fun Project.requiredVersionFromLibs(name: String) = libsVersionCatalog.findVersion(name).get().requiredVersion diff --git a/junit-platform-console-standalone/junit-platform-console-standalone.gradle.kts b/junit-platform-console-standalone/junit-platform-console-standalone.gradle.kts index aa35b91be8f8..a15f463a4d04 100644 --- a/junit-platform-console-standalone/junit-platform-console-standalone.gradle.kts +++ b/junit-platform-console-standalone/junit-platform-console-standalone.gradle.kts @@ -41,11 +41,11 @@ tasks { // https://github.com/junit-team/junit5/issues/761 // prevent duplicates, add 3rd-party licenses explicitly exclude("META-INF/LICENSE*.md") - from(project.projects.junitPlatformConsole.actualProject.projectDir) { + from(dependencyProject(project.projects.junitPlatformConsole).projectDir) { include("LICENSE-picocli.md") into("META-INF") } - from(project.projects.junitJupiterParams.actualProject.projectDir) { + from(dependencyProject(project.projects.junitJupiterParams).projectDir) { include("LICENSE-univocity-parsers.md") into("META-INF") } diff --git a/platform-tests/platform-tests.gradle.kts b/platform-tests/platform-tests.gradle.kts index 5d72057478d5..d5e7467c401e 100644 --- a/platform-tests/platform-tests.gradle.kts +++ b/platform-tests/platform-tests.gradle.kts @@ -84,12 +84,12 @@ tasks { eclipse { classpath { - plusConfigurations.add(projects.junitPlatformConsole.actualProject.configurations["shadowedClasspath"]) + plusConfigurations.add(dependencyProject(projects.junitPlatformConsole).configurations["shadowedClasspath"]) } } idea { module { - scopes["PROVIDED"]!!["plus"]!!.add(projects.junitPlatformConsole.actualProject.configurations["shadowedClasspath"]) + scopes["PROVIDED"]!!["plus"]!!.add(dependencyProject(projects.junitPlatformConsole).configurations["shadowedClasspath"]) } } diff --git a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts index 3ecbdf101298..605428191449 100644 --- a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts +++ b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts @@ -109,7 +109,7 @@ val normalizeMavenRepo by tasks.registering(Sync::class) { val tempRepoName: String by rootProject // All maven-aware projects must be published to the local temp repository - (mavenizedProjects + projects.junitBom.actualProject) + (mavenizedProjects + dependencyProject(projects.junitBom)) .map { project -> project.tasks.named("publishAllPublicationsTo${tempRepoName.capitalized()}Repository") } .forEach { dependsOn(it) } From 86539a286b23b9dd192f3e54bc10e3c95f87773f Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 12 Nov 2024 09:15:43 +0100 Subject: [PATCH 270/611] Ignore .kotlin directories --- .gitignore | 1 + .../src/main/kotlin/junitbuild.checkstyle-nohttp.gradle.kts | 1 + 2 files changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 2764c9175b99..aa4aae75cc61 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Gradle .gradle +.kotlin build # Ignore Gradle GUI config diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.checkstyle-nohttp.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.checkstyle-nohttp.gradle.kts index daf45cbfea84..e1b742545cc6 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.checkstyle-nohttp.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.checkstyle-nohttp.gradle.kts @@ -20,5 +20,6 @@ tasks.register("checkstyleNohttp") { exclude("**/*.jpg", "**/*.png") exclude("**/*.jks") exclude("**/build/**") + exclude("**/.kotlin") } } From 37e6e09ce21e9c2644f3a767d220f465433daec1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 13:28:36 +0000 Subject: [PATCH 271/611] Update dependency io.github.classgraph:classgraph to v4.8.179 (#4118) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index cac10079a754..32cc2d386cb7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -32,7 +32,7 @@ assertj = { module = "org.assertj:assertj-core", version.ref = "assertj" } bartholdy = { module = "de.sormuras:bartholdy", version = "0.2.3" } bndlib = { module = "biz.aQute.bnd:biz.aQute.bndlib", version.ref = "bnd" } checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checkstyle" } -classgraph = { module = "io.github.classgraph:classgraph", version = "4.8.177" } +classgraph = { module = "io.github.classgraph:classgraph", version = "4.8.179" } commons-io = { module = "commons-io:commons-io", version = "2.17.0" } groovy4 = { module = "org.apache.groovy:groovy", version = "4.0.24" } groovy2-bom = { module = "org.codehaus.groovy:groovy-bom", version = "2.5.23" } From 3214f05f148a3b6779bd2f646890ffb7ac3471c3 Mon Sep 17 00:00:00 2001 From: Yongjun Hong Date: Tue, 12 Nov 2024 23:15:47 +0900 Subject: [PATCH 272/611] Add include matching to ClassNamePatternFilterUtils (#4115) Issue: #3717 --------- Signed-off-by: yongjunhong Co-authored-by: Marc Philipp --- .../org/junit/jupiter/engine/Constants.java | 2 +- .../util/ClassNamePatternFilterUtils.java | 53 ++++-- .../platform/launcher/LauncherConstants.java | 2 +- .../ClassNamePatternFilterUtilsTests.java | 151 ++++++++++++++++++ 4 files changed, 195 insertions(+), 13 deletions(-) diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java index 92c6990cb7ed..500f55818923 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java @@ -91,7 +91,7 @@ public final class Constants { * @see #DEACTIVATE_CONDITIONS_PATTERN_PROPERTY_NAME * @see org.junit.jupiter.api.extension.ExecutionCondition */ - public static final String DEACTIVATE_ALL_CONDITIONS_PATTERN = ClassNamePatternFilterUtils.DEACTIVATE_ALL_PATTERN; + public static final String DEACTIVATE_ALL_CONDITIONS_PATTERN = ClassNamePatternFilterUtils.ALL_PATTERN; /** * Property name used to set the default display name generator class name: {@value} diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClassNamePatternFilterUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClassNamePatternFilterUtils.java index 6c713d8c6cb4..f9ec3d257baa 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClassNamePatternFilterUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClassNamePatternFilterUtils.java @@ -41,7 +41,7 @@ private ClassNamePatternFilterUtils() { /* no-op */ } - public static final String DEACTIVATE_ALL_PATTERN = "*"; + public static final String ALL_PATTERN = "*"; /** * Create a {@link Predicate} that can be used to exclude (i.e., filter out) @@ -51,7 +51,7 @@ private ClassNamePatternFilterUtils() { * @param patterns a comma-separated list of patterns */ public static Predicate excludeMatchingClasses(String patterns) { - return excludeMatchingClasses(patterns, object -> object.getClass().getName()); + return matchingClasses(patterns, object -> object.getClass().getName(), FilterType.EXCLUDE); } /** @@ -61,26 +61,57 @@ public static Predicate excludeMatchingClasses(String patterns) { * @param patterns a comma-separated list of patterns */ public static Predicate excludeMatchingClassNames(String patterns) { - return excludeMatchingClasses(patterns, Function.identity()); + return matchingClasses(patterns, Function.identity(), FilterType.EXCLUDE); } - private static Predicate excludeMatchingClasses(String patterns, Function classNameGetter) { + /** + * Create a {@link Predicate} that can be used to include (i.e., filter in) + * objects of type {@code T} whose fully qualified class names match any of + * the supplied patterns. + * + * @param patterns a comma-separated list of patterns + */ + public static Predicate includeMatchingClasses(String patterns) { + return matchingClasses(patterns, object -> object.getClass().getName(), FilterType.INCLUDE); + } + + /** + * Create a {@link Predicate} that can be used to include (i.e., filter in) + * fully qualified class names matching any of the supplied patterns. + * + * @param patterns a comma-separated list of patterns + */ + public static Predicate includeMatchingClassNames(String patterns) { + return matchingClasses(patterns, Function.identity(), FilterType.INCLUDE); + } + + private enum FilterType { + INCLUDE, EXCLUDE + } + + private static Predicate matchingClasses(String patterns, Function classNameProvider, + FilterType type) { // @formatter:off return Optional.ofNullable(patterns) .filter(StringUtils::isNotBlank) .map(String::trim) - .map(trimmedPatterns -> createPredicateFromPatterns(trimmedPatterns, classNameGetter)) - .orElse(object -> true); + .map(trimmedPatterns -> createPredicateFromPatterns(trimmedPatterns, classNameProvider, type)) + .orElse(type == FilterType.EXCLUDE ? __ -> true : __ -> false); // @formatter:on } - private static Predicate createPredicateFromPatterns(String patterns, - Function classNameProvider) { - if (DEACTIVATE_ALL_PATTERN.equals(patterns)) { - return object -> false; + private static Predicate createPredicateFromPatterns(String patterns, Function classNameProvider, + FilterType mode) { + if (ALL_PATTERN.equals(patterns)) { + return __ -> mode == FilterType.INCLUDE; } + List patternList = convertToRegularExpressions(patterns); - return object -> patternList.stream().noneMatch(it -> it.matcher(classNameProvider.apply(object)).matches()); + return object -> { + boolean isMatchingAnyPattern = patternList.stream().anyMatch( + pattern -> pattern.matcher(classNameProvider.apply(object)).matches()); + return (mode == FilterType.INCLUDE) == isMatchingAnyPattern; + }; } private static List convertToRegularExpressions(String patterns) { diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherConstants.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherConstants.java index 5cb30bf8e69d..3a7aa079aed1 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherConstants.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherConstants.java @@ -146,7 +146,7 @@ public class LauncherConstants { * @see #DEACTIVATE_LISTENERS_PATTERN_PROPERTY_NAME * @see org.junit.platform.launcher.TestExecutionListener */ - public static final String DEACTIVATE_ALL_LISTENERS_PATTERN = ClassNamePatternFilterUtils.DEACTIVATE_ALL_PATTERN; + public static final String DEACTIVATE_ALL_LISTENERS_PATTERN = ClassNamePatternFilterUtils.ALL_PATTERN; /** * Property name used to enable support for diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/ClassNamePatternFilterUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/ClassNamePatternFilterUtilsTests.java index 1d68086db38b..a76f67a31026 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/ClassNamePatternFilterUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/ClassNamePatternFilterUtilsTests.java @@ -169,4 +169,155 @@ void alwaysExcludedClassName(String pattern) { .isEmpty(); } + //@formatter:off + @ValueSource(strings = { + "org.junit.jupiter.*", + "org.junit.platform.*.NonExistentClass", + "*.NonExistentClass*", + "*NonExistentClass*", + "AExecutionConditionClass, BExecutionConditionClass" + }) + //@formatter:on + @ParameterizedTest + void neverIncludedConditions(String pattern) { + List executionConditions = List.of(new AExecutionConditionClass(), + new BExecutionConditionClass()); + assertThat(executionConditions).filteredOn(ClassNamePatternFilterUtils.includeMatchingClasses(pattern)) // + .isEmpty(); + } + + //@formatter:off + @ValueSource(strings = { + "org.junit.platform.*", + "*.platform.*", + "*", + "*AExecutionConditionClass, *BExecutionConditionClass", + "*ExecutionConditionClass" + }) + //@formatter:on + @ParameterizedTest + void alwaysIncludedConditions(String pattern) { + List executionConditions = List.of(new AExecutionConditionClass(), + new BExecutionConditionClass()); + assertThat(executionConditions).filteredOn(ClassNamePatternFilterUtils.includeMatchingClasses(pattern)) // + .hasSize(2); + } + + //@formatter:off + @ValueSource(strings = { + "org.junit.jupiter.*", + "org.junit.platform.*.NonExistentClass", + "*.NonExistentClass*", + "*NonExistentClass*", + "ATestExecutionListenerClass, BTestExecutionListenerClass" + }) + //@formatter:on + @ParameterizedTest + void neverIncludedListeners(String pattern) { + List executionConditions = List.of(new ATestExecutionListenerClass(), + new BTestExecutionListenerClass()); + assertThat(executionConditions).filteredOn(ClassNamePatternFilterUtils.includeMatchingClasses(pattern)) // + .isEmpty(); + } + + //@formatter:off + @ValueSource(strings = { + "org.junit.platform.*", + "*.platform.*", + "*", + "*ATestExecutionListenerClass, *BTestExecutionListenerClass", + "*TestExecutionListenerClass" + }) + //@formatter:on + @ParameterizedTest + void alwaysIncludedListeners(String pattern) { + List executionConditions = List.of(new ATestExecutionListenerClass(), + new BTestExecutionListenerClass()); + assertThat(executionConditions).filteredOn(ClassNamePatternFilterUtils.includeMatchingClasses(pattern)) // + .hasSize(2); + } + + //@formatter:off + @ValueSource(strings = { + "org.junit.jupiter.*", + "org.junit.platform.*.NonExistentClass", + "*.NonExistentClass*", + "*NonExistentClass*", + "AVanillaEmpty, BVanillaEmpty" + }) + //@formatter:on + @ParameterizedTest + void neverIncludedClass(String pattern) { + var executionConditions = List.of(new AVanillaEmpty(), new BVanillaEmpty()); + assertThat(executionConditions).filteredOn(ClassNamePatternFilterUtils.includeMatchingClasses(pattern)) // + .isEmpty(); + } + + //@formatter:off + @ValueSource(strings = { + "org.junit.platform.*", + "*.platform.*", + "*", + "*AVanillaEmpty, *BVanillaEmpty", + "*VanillaEmpty" + }) + //@formatter:on + @ParameterizedTest + void alwaysIncludedClass(String pattern) { + var executionConditions = List.of(new AVanillaEmpty(), new BVanillaEmpty()); + assertThat(executionConditions).filteredOn(ClassNamePatternFilterUtils.includeMatchingClasses(pattern)) // + .hasSize(2); + } + + //@formatter:off + @ValueSource(strings = { + "org.junit.jupiter.*", + "org.junit.platform.*.NonExistentClass", + "*.NonExistentClass*", + "*NonExistentClass*", + "AVanillaEmpty, BVanillaEmpty" + }) + //@formatter:on + @ParameterizedTest + void neverIncludedClassName(String pattern) { + var executionConditions = List.of("org.junit.platform.commons.util.classes.AVanillaEmpty", + "org.junit.platform.commons.util.classes.BVanillaEmpty"); + assertThat(executionConditions).filteredOn(ClassNamePatternFilterUtils.includeMatchingClassNames(pattern)) // + .isEmpty(); + } + + //@formatter:off + @ValueSource(strings = { + "org.junit.platform.*", + "*.platform.*", + "*", + "*AVanillaEmpty, *BVanillaEmpty", + "*VanillaEmpty" + }) + //@formatter:on + @ParameterizedTest + void alwaysIncludedClassName(String pattern) { + var executionConditions = List.of("org.junit.platform.commons.util.classes.AVanillaEmpty", + "org.junit.platform.commons.util.classes.BVanillaEmpty"); + assertThat(executionConditions).filteredOn(ClassNamePatternFilterUtils.includeMatchingClassNames(pattern)) // + .hasSize(2); + } + + //@formatter:off + @ValueSource(strings = { + "org.junit.platform.*", + "*.platform.*", + "*", + "*AVanillaEmpty, *BVanillaEmpty", + "*VanillaEmpty" + }) + //@formatter:on + @ParameterizedTest + void includeAndExcludeSame(String pattern) { + var executionConditions = List.of("org.junit.platform.commons.util.classes.AVanillaEmpty", + "org.junit.platform.commons.util.classes.BVanillaEmpty"); + assertThat(executionConditions).filteredOn(ClassNamePatternFilterUtils.includeMatchingClassNames(pattern)) // + .hasSize(2); + } + } From 61578038ba1e7f4ea1059aea3e0589581991f531 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 14:27:59 +0000 Subject: [PATCH 273/611] Update github/codeql-action digest to 9278e42 (#4119) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/ossf-scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 8f6634686250..b3e5a1e51f34 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -34,7 +34,7 @@ jobs: - name: Check out repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Initialize CodeQL - uses: github/codeql-action/init@4f3212b61783c3c68e8309a0f18a699764811cda # v3 + uses: github/codeql-action/init@9278e421667d5d90a2839487a482448c4ec7df4d # v3 with: languages: ${{ matrix.language }} tools: linked @@ -47,4 +47,4 @@ jobs: -Dscan.tag.CodeQL \ allMainClasses - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@4f3212b61783c3c68e8309a0f18a699764811cda # v3 + uses: github/codeql-action/analyze@9278e421667d5d90a2839487a482448c4ec7df4d # v3 diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index 929ab6238d62..ae310339d49d 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard (optional). # Commenting out will disable upload of results to your repo's Code Scanning dashboard - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@4f3212b61783c3c68e8309a0f18a699764811cda # v3 + uses: github/codeql-action/upload-sarif@9278e421667d5d90a2839487a482448c4ec7df4d # v3 with: sarif_file: results.sarif From eaf8e2662edbcaf4da5c3008ebdfb93904e24ef9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 19:28:30 +0000 Subject: [PATCH 274/611] Update gradle/actions digest to 473878a --- .github/actions/run-gradle/action.yml | 2 +- .github/workflows/gradle-dependency-submission.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/run-gradle/action.yml b/.github/actions/run-gradle/action.yml index b0321a5cd4bf..6265705e57e6 100644 --- a/.github/actions/run-gradle/action.yml +++ b/.github/actions/run-gradle/action.yml @@ -17,7 +17,7 @@ runs: distribution: temurin java-version: 21 check-latest: true - - uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # v4 + - uses: gradle/actions/setup-gradle@473878a77f1b98e2b5ac4af93489d1656a80a5ed # v4 with: cache-encryption-key: ${{ inputs.encryptionKey }} - shell: bash diff --git a/.github/workflows/gradle-dependency-submission.yml b/.github/workflows/gradle-dependency-submission.yml index 9964dbe80360..bab2e20e114e 100644 --- a/.github/workflows/gradle-dependency-submission.yml +++ b/.github/workflows/gradle-dependency-submission.yml @@ -25,4 +25,4 @@ jobs: java-version: 21 check-latest: true - name: Generate and submit dependency graph - uses: gradle/actions/dependency-submission@d156388eb19639ec20ade50009f3d199ce1e2808 # v4 + uses: gradle/actions/dependency-submission@473878a77f1b98e2b5ac4af93489d1656a80a5ed # v4 From 35aef48ded0a1d6bab03159c6c8dbb61ccb46ca0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 13:41:06 +0000 Subject: [PATCH 275/611] Update github/codeql-action digest to 396bb3e (#4123) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/ossf-scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b3e5a1e51f34..af6a1c9e6c92 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -34,7 +34,7 @@ jobs: - name: Check out repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Initialize CodeQL - uses: github/codeql-action/init@9278e421667d5d90a2839487a482448c4ec7df4d # v3 + uses: github/codeql-action/init@396bb3e45325a47dd9ef434068033c6d5bb0d11a # v3 with: languages: ${{ matrix.language }} tools: linked @@ -47,4 +47,4 @@ jobs: -Dscan.tag.CodeQL \ allMainClasses - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@9278e421667d5d90a2839487a482448c4ec7df4d # v3 + uses: github/codeql-action/analyze@396bb3e45325a47dd9ef434068033c6d5bb0d11a # v3 diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index ae310339d49d..d88a9c79a8c1 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard (optional). # Commenting out will disable upload of results to your repo's Code Scanning dashboard - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@9278e421667d5d90a2839487a482448c4ec7df4d # v3 + uses: github/codeql-action/upload-sarif@396bb3e45325a47dd9ef434068033c6d5bb0d11a # v3 with: sarif_file: results.sarif From 8e4e33bf927725baf59c1f0d08fbf78dfb972934 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 16:40:20 +0000 Subject: [PATCH 276/611] Update plugin develocity to v3.18.2 (#4124) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 32cc2d386cb7..9f668709a414 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -87,7 +87,7 @@ asciidoctorPdf = { id = "org.asciidoctor.jvm.pdf", version.ref = "asciidoctor-pl bnd = { id = "biz.aQute.bnd", version.ref = "bnd" } buildParameters = { id = "org.gradlex.build-parameters", version = "1.4.4" } commonCustomUserData = { id = "com.gradle.common-custom-user-data-gradle-plugin", version = "2.0.2" } -develocity = { id = "com.gradle.develocity", version = "3.18.1" } +develocity = { id = "com.gradle.develocity", version = "3.18.2" } foojayResolver = { id = "org.gradle.toolchains.foojay-resolver", version = "0.8.0" } gitPublish = { id = "org.ajoberstar.git-publish", version = "4.2.2" } jmh = { id = "me.champeau.jmh", version = "0.7.2" } From 61be9a6d68cfa4bcf4d41c1eb8f883ab7e8e08d9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 18:23:07 +0000 Subject: [PATCH 277/611] Update github/codeql-action digest to ea9e4e3 (#4127) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/ossf-scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index af6a1c9e6c92..73559f7da546 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -34,7 +34,7 @@ jobs: - name: Check out repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Initialize CodeQL - uses: github/codeql-action/init@396bb3e45325a47dd9ef434068033c6d5bb0d11a # v3 + uses: github/codeql-action/init@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3 with: languages: ${{ matrix.language }} tools: linked @@ -47,4 +47,4 @@ jobs: -Dscan.tag.CodeQL \ allMainClasses - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@396bb3e45325a47dd9ef434068033c6d5bb0d11a # v3 + uses: github/codeql-action/analyze@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3 diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index d88a9c79a8c1..839051e5d1d0 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard (optional). # Commenting out will disable upload of results to your repo's Code Scanning dashboard - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@396bb3e45325a47dd9ef434068033c6d5bb0d11a # v3 + uses: github/codeql-action/upload-sarif@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3 with: sarif_file: results.sarif From d73eee8318814c3151545761f10d22640ee339ab Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 22:54:42 +0000 Subject: [PATCH 278/611] Update graalvm/setup-graalvm digest to 4a200f2 (#4128) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a4412115bae4..0e969f1b5ed4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,7 @@ jobs: with: fetch-depth: 1 - name: Install GraalVM - uses: graalvm/setup-graalvm@3aaf71e276c9159bbdfbcdab8abc50c95f41a2c8 # v1 + uses: graalvm/setup-graalvm@4a200f28cd70d1940b5e33bd00830b7dc71a7e2b # v1 with: distribution: graalvm-community version: 'latest' From 47d0e6851468ffe40d144c9903a3bc281c20d5a4 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 14 Nov 2024 12:16:59 +0100 Subject: [PATCH 279/611] Include Git metadata in Open Test Report XML output --- .../xml/OpenTestReportGeneratingListener.java | 101 +++++++++++++++++- ...OpenTestReportGeneratingListenerTests.java | 11 +- .../tooling/support/tests/XmlAssertions.java | 7 +- 3 files changed, 115 insertions(+), 4 deletions(-) diff --git a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java index dbb5541e9ce3..898a2a203ab5 100644 --- a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java +++ b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java @@ -11,6 +11,7 @@ package org.junit.platform.reporting.open.xml; import static org.apiguardian.api.API.Status.EXPERIMENTAL; +import static org.junit.platform.commons.util.StringUtils.isNotBlank; import static org.junit.platform.reporting.open.xml.JUnitFactory.legacyReportingName; import static org.junit.platform.reporting.open.xml.JUnitFactory.type; import static org.junit.platform.reporting.open.xml.JUnitFactory.uniqueId; @@ -30,6 +31,10 @@ import static org.opentest4j.reporting.events.core.CoreFactory.tags; import static org.opentest4j.reporting.events.core.CoreFactory.uriSource; import static org.opentest4j.reporting.events.core.CoreFactory.userName; +import static org.opentest4j.reporting.events.git.GitFactory.branch; +import static org.opentest4j.reporting.events.git.GitFactory.commit; +import static org.opentest4j.reporting.events.git.GitFactory.repository; +import static org.opentest4j.reporting.events.git.GitFactory.status; import static org.opentest4j.reporting.events.java.JavaFactory.classSource; import static org.opentest4j.reporting.events.java.JavaFactory.classpathResourceSource; import static org.opentest4j.reporting.events.java.JavaFactory.fileEncoding; @@ -42,18 +47,27 @@ import static org.opentest4j.reporting.events.root.RootFactory.reported; import static org.opentest4j.reporting.events.root.RootFactory.started; +import java.io.BufferedReader; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; import java.io.UncheckedIOException; import java.net.InetAddress; import java.net.UnknownHostException; +import java.nio.charset.Charset; import java.nio.file.Path; import java.time.Instant; import java.util.Map; +import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.BiConsumer; import org.apiguardian.api.API; import org.junit.platform.commons.JUnitException; +import org.junit.platform.commons.util.ExceptionUtils; import org.junit.platform.commons.util.StringUtils; import org.junit.platform.engine.ConfigurationParameters; import org.junit.platform.engine.TestExecutionResult; @@ -74,6 +88,7 @@ import org.junit.platform.launcher.listeners.OutputDir; import org.opentest4j.reporting.events.api.DocumentWriter; import org.opentest4j.reporting.events.api.NamespaceRegistry; +import org.opentest4j.reporting.events.core.Infrastructure; import org.opentest4j.reporting.events.core.Result; import org.opentest4j.reporting.events.core.Sources; import org.opentest4j.reporting.events.root.Events; @@ -103,6 +118,7 @@ public void testPlanExecutionStarted(TestPlan testPlan) { if (isEnabled(config)) { NamespaceRegistry namespaceRegistry = NamespaceRegistry.builder(Namespace.REPORTING_CORE) // .add("e", Namespace.REPORTING_EVENTS) // + .add("git", Namespace.REPORTING_GIT) // .add("java", Namespace.REPORTING_JAVA) // .add("junit", JUnitFactory.NAMESPACE, "https://junit.org/junit5/schemas/open-test-reporting/junit-1.9.xsd") // @@ -138,9 +154,92 @@ private void reportInfrastructure() { .append(javaVersion(System.getProperty("java.version"))) // .append(fileEncoding(System.getProperty("file.encoding"))) // .append(heapSize(), heapSize -> heapSize.withMax(Runtime.getRuntime().maxMemory())); + + addGitInfo(infrastructure); }); } + private static void addGitInfo(Infrastructure infrastructure) { + boolean gitInstalled = exec("git", "--version").isPresent(); + if (gitInstalled) { + exec("git", "config", "--get", "remote.origin.url") // + .filter(StringUtils::isNotBlank) // + .ifPresent( + gitUrl -> infrastructure.append(repository(), repository -> repository.withOriginUrl(gitUrl))); + exec("git", "rev-parse", "--abbrev-ref", "HEAD") // + .filter(StringUtils::isNotBlank) // + .ifPresent(branch -> infrastructure.append(branch(branch))); + exec("git", "rev-parse", "--verify", "HEAD") // + .filter(StringUtils::isNotBlank) // + .ifPresent(gitCommitHash -> infrastructure.append(commit(gitCommitHash))); + exec("git", "status", "--porcelain") // + .ifPresent(statusOutput -> infrastructure.append(status(statusOutput), + status -> status.withClean(statusOutput.isEmpty()))); + } + } + + static Optional exec(String... args) { + + Process process = startProcess(args); + + try (Reader out = newBufferedReader(process.getInputStream()); + Reader err = newBufferedReader(process.getErrorStream())) { + + StringBuilder output = new StringBuilder(); + readAllChars(out, (chars, numChars) -> output.append(chars, 0, numChars)); + + readAllChars(err, (__, ___) -> { + // ignore + }); + + boolean terminated = process.waitFor(10, TimeUnit.SECONDS); + return terminated && process.exitValue() == 0 ? Optional.of(trimAtEnd(output)) : Optional.empty(); + } + catch (InterruptedException e) { + throw ExceptionUtils.throwAsUncheckedException(e); + } + catch (IOException ignore) { + return Optional.empty(); + } + finally { + process.destroyForcibly(); + } + } + + private static BufferedReader newBufferedReader(InputStream stream) { + return new BufferedReader(new InputStreamReader(stream, Charset.defaultCharset())); + } + + private static Process startProcess(String[] args) { + Process process; + try { + process = Runtime.getRuntime().exec(args); + } + catch (IOException e) { + throw new RuntimeException(e); + } + return process; + } + + private static void readAllChars(Reader reader, BiConsumer consumer) throws IOException { + char[] buffer = new char[1024]; + int numChars; + while ((numChars = reader.read(buffer)) != -1) { + consumer.accept(buffer, numChars); + } + } + + private static String trimAtEnd(StringBuilder value) { + int endIndex = value.length(); + for (int i = value.length() - 1; i >= 0; i--) { + if (Character.isWhitespace(value.charAt(i))) { + endIndex--; + break; + } + } + return value.substring(0, endIndex); + } + @Override public void testPlanExecutionFinished(TestPlan testPlan) { try { @@ -160,7 +259,7 @@ public void executionSkipped(TestIdentifier testIdentifier, String reason) { reportStarted(testIdentifier, id); eventsFileWriter.append(finished(id, Instant.now()), // finished -> finished.append(result(Result.Status.SKIPPED), result -> { - if (StringUtils.isNotBlank(reason)) { + if (isNotBlank(reason)) { result.append(reason(reason)); } })); diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java index 946662eb3577..2c48f6feccf4 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java @@ -64,8 +64,11 @@ void writesValidXmlReport() throws Exception { assertThat(validate(xmlFile)).isEmpty(); var expected = """ - ${xmlunit.ignore} @@ -75,6 +78,10 @@ void writesValidXmlReport() throws Exception { ${xmlunit.ignore} ${xmlunit.ignore} + + ${xmlunit.ignore} + ${xmlunit.matchesRegex([0-9a-f]{40})} + ${xmlunit.ignore} diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java index b233d6c0e9eb..7e0987860245 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java @@ -34,7 +34,8 @@ static void verifyContainsExpectedStartedOpenTestReport(Path testResultsDir) { private static void verifyContent(Path xmlFile) { var expected = """ - @@ -45,6 +46,10 @@ private static void verifyContent(Path xmlFile) { ${xmlunit.ignore} ${xmlunit.ignore} + + ${xmlunit.ignore} + ${xmlunit.matchesRegex([0-9a-f]{40})} + ${xmlunit.ignore} From 8f79a2ab7bfefb5f78d3a78c31bbdfe38f8da64c Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 14 Nov 2024 15:53:01 +0100 Subject: [PATCH 280/611] Add to release notes --- .../asciidoc/release-notes/release-notes-5.12.0-M1.adoc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 0803439636db..b5aa3793f508 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -38,9 +38,11 @@ JUnit repository on GitHub. `--select-file` and `--select-resource`. * `ConsoleLauncher` now accepts multiple values for all `--select` options. * Add `--select-unique-id` support to ConsoleLauncher. -* The `junit-platform-reporting` module now contributes a section containing - JUnit-specific metadata about each test/container to the HTML report written by - open-test-reporting when added to the classpath/module path. +* The following improvements have been made to the open-test-reporting XML output: + - Information about the Git repository, the current branch, the commit hash, and the + current worktree status are now included in the XML report, if applicable. + - A section containing JUnit-specific metadata about each test/container to the HTML + report is now written by open-test-reporting when added to the classpath/module path [[release-notes-5.12.0-M1-junit-jupiter]] From e087b474d53dc38fb7422f3f11e140c4d45d56ce Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 15 Nov 2024 14:09:08 +0100 Subject: [PATCH 281/611] Start Maven builds with empty local repo to avoid flakiness --- .../support/tests/JavaVersionsTests.java | 6 +- .../tooling/support/tests/LocalMavenRepo.java | 112 ++++++++++++++++++ .../support/tests/MavenStarterTests.java | 5 +- .../MavenSurefireCompatibilityTests.java | 6 +- .../support/tests/MultiReleaseJarTests.java | 6 +- .../tests/VintageMavenIntegrationTests.java | 6 +- 6 files changed, 135 insertions(+), 6 deletions(-) create mode 100644 platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/LocalMavenRepo.java diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java index d7785cd6e1ad..8a5caad44fb8 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java @@ -27,12 +27,16 @@ import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; import platform.tooling.support.Request; +import platform.tooling.support.tests.LocalMavenRepo.Directory; /** * @since 1.4 */ class JavaVersionsTests { + @LocalMavenRepo + Directory localMavenRepo; + @Test void java_8() { var java8Home = Helper.getJavaHome("8"); @@ -54,7 +58,7 @@ List execute(String version, Path javaHome, Map environm .setTool(Request.maven()) // .setProject(Projects.JAVA_VERSIONS) // .setWorkspace("java-versions-" + version) // - .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // + .addArguments(localMavenRepo.toCliArgument(), "-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("--update-snapshots", "--batch-mode", "verify") // .setTimeout(TOOL_TIMEOUT) // .setJavaHome(javaHome); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/LocalMavenRepo.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/LocalMavenRepo.java new file mode 100644 index 000000000000..892a766bf56d --- /dev/null +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/LocalMavenRepo.java @@ -0,0 +1,112 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package platform.tooling.support.tests; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static org.junit.platform.commons.support.ReflectionSupport.streamFields; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Comparator; + +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.ExtensionContext.Namespace; +import org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource; +import org.junit.jupiter.api.extension.ParameterContext; +import org.junit.jupiter.api.extension.ParameterResolutionException; +import org.junit.jupiter.api.extension.ParameterResolver; +import org.junit.jupiter.api.extension.TestInstancePostProcessor; +import org.junit.platform.commons.support.AnnotationSupport; +import org.junit.platform.commons.support.HierarchyTraversalMode; +import org.junit.platform.commons.util.Preconditions; + +@Target({ ElementType.PARAMETER, ElementType.FIELD }) +@Retention(RUNTIME) +@ExtendWith(LocalMavenRepo.Extension.class) +public @interface LocalMavenRepo { + + class Extension implements ParameterResolver, TestInstancePostProcessor { + + @Override + public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) + throws ParameterResolutionException { + return parameterContext.isAnnotated(LocalMavenRepo.class); + } + + @Override + public Directory resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) + throws ParameterResolutionException { + Preconditions.condition(Directory.class.equals(parameterContext.getParameter().getType()), + () -> "Parameter must be of type " + Directory.class + ": " + parameterContext.getParameter()); + return getOrCreateDirectory(extensionContext); + } + + @Override + public void postProcessTestInstance(Object testInstance, ExtensionContext context) { + streamFields(testInstance.getClass(), field -> AnnotationSupport.isAnnotated(field, LocalMavenRepo.class), + HierarchyTraversalMode.BOTTOM_UP) // + .forEach(field -> { + Preconditions.condition(Directory.class.equals(field.getType()), + () -> "Field must be of type " + Directory.class + ": " + field); + try { + field.set(testInstance, getOrCreateDirectory(context)); + } + catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + }); + } + + private Directory getOrCreateDirectory(ExtensionContext extensionContext) { + return extensionContext.getRoot().getStore(Namespace.GLOBAL) // + .getOrComputeIfAbsent(Directory.class, __ -> new Directory(), Directory.class); + } + } + + class Directory implements CloseableResource { + + private final Path tempDir; + + private Directory() { + try { + tempDir = Files.createTempDirectory("local-maven-repo-"); + } + catch (IOException e) { + throw new RuntimeException(e); + } + } + + public String toCliArgument() { + return "-Dmaven.repo.local=" + tempDir; + } + + @Override + public void close() throws Throwable { + try (var files = Files.walk(tempDir)) { + files.sorted(Comparator. naturalOrder().reversed()) // + .forEach(path -> { + try { + Files.delete(path); + } + catch (IOException e) { + throw new UncheckedIOException(e); + } + }); + } + } + } +} diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java index bf5b8a581437..2f72339a6501 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java @@ -24,6 +24,7 @@ import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; import platform.tooling.support.Request; +import platform.tooling.support.tests.LocalMavenRepo.Directory; /** * @since 1.3 @@ -32,11 +33,11 @@ class MavenStarterTests { @ResourceLock(Projects.MAVEN_STARTER) @Test - void verifyMavenStarterProject() { + void verifyMavenStarterProject(@LocalMavenRepo Directory localMavenRepo) { var request = Request.builder() // .setTool(Request.maven()) // .setProject(Projects.MAVEN_STARTER) // - .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // + .addArguments(localMavenRepo.toCliArgument(), "-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("--update-snapshots", "--batch-mode", "verify") // .setTimeout(TOOL_TIMEOUT) // .setJavaHome(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java index d0e20e1c450e..44dd974e2c42 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java @@ -27,12 +27,16 @@ import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; import platform.tooling.support.Request; +import platform.tooling.support.tests.LocalMavenRepo.Directory; /** * @since 1.9.2 */ class MavenSurefireCompatibilityTests { + @LocalMavenRepo + Directory localMavenRepo; + @ResourceLock(Projects.MAVEN_SUREFIRE_COMPATIBILITY) @ParameterizedTest @CsvSource(delimiter = '|', nullValues = "", textBlock = """ @@ -44,7 +48,7 @@ void testMavenSurefireCompatibilityProject(String surefireVersion, String extraA var request = Request.builder() // .setTool(Request.maven()) // .setProject(Projects.MAVEN_SUREFIRE_COMPATIBILITY) // - .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // + .addArguments(localMavenRepo.toCliArgument(), "-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("-Dsurefire.version=" + surefireVersion) // .addArguments("--update-snapshots", "--batch-mode", "test") // .addArguments(extraArgs) // diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java index 33105f0983f4..679d6924f860 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java @@ -28,12 +28,16 @@ import platform.tooling.support.MavenRepo; import platform.tooling.support.Request; +import platform.tooling.support.tests.LocalMavenRepo.Directory; /** * @since 1.4 */ class MultiReleaseJarTests { + @LocalMavenRepo + Directory localMavenRepo; + @ResourceLock(Projects.MULTI_RELEASE_JAR) @Test void checkDefault() throws Exception { @@ -88,7 +92,7 @@ private Result mvn(String variant) { var builder = Request.builder() // .setTool(Request.maven()) // .setProject(Projects.MULTI_RELEASE_JAR) // - .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // + .addArguments(localMavenRepo.toCliArgument(), "-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("--update-snapshots", "--show-version", "--errors", "--batch-mode", "--file", variant, "test") // .setTimeout(TOOL_TIMEOUT); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java index 398c5a13ff03..c6023920830d 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java @@ -24,9 +24,13 @@ import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; import platform.tooling.support.Request; +import platform.tooling.support.tests.LocalMavenRepo.Directory; class VintageMavenIntegrationTests { + @LocalMavenRepo + Directory localMavenRepo; + @Test void unsupportedVersion() { var result = run("4.11"); @@ -61,7 +65,7 @@ private Result run(String version) { .setProject(Projects.VINTAGE) // .setWorkspace("vintage-maven-" + version) // .addArguments("clean", "test", "--update-snapshots", "--batch-mode") // - .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // + .addArguments(localMavenRepo.toCliArgument(), "-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("-Djunit4Version=" + version) // .setTimeout(TOOL_TIMEOUT) // .build() // From 9f6ad01b6d4753a0cb8f6c366371b277d49d035b Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 15 Nov 2024 17:04:42 +0100 Subject: [PATCH 282/611] Generalize resource management --- .../tooling/support/tests/GlobalResource.java | 93 +++++++++++++++ .../support/tests/JavaVersionsTests.java | 5 +- .../tooling/support/tests/LocalMavenRepo.java | 106 ++++-------------- .../support/tests/MavenStarterTests.java | 6 +- .../MavenSurefireCompatibilityTests.java | 5 +- .../support/tests/MultiReleaseJarTests.java | 5 +- .../tests/VintageMavenIntegrationTests.java | 5 +- 7 files changed, 127 insertions(+), 98 deletions(-) create mode 100644 platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GlobalResource.java diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GlobalResource.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GlobalResource.java new file mode 100644 index 000000000000..637a9abb7ac4 --- /dev/null +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GlobalResource.java @@ -0,0 +1,93 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package platform.tooling.support.tests; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; +import static org.junit.platform.commons.support.ReflectionSupport.streamFields; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.ExtensionContext.Namespace; +import org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource; +import org.junit.jupiter.api.extension.ParameterContext; +import org.junit.jupiter.api.extension.ParameterResolutionException; +import org.junit.jupiter.api.extension.ParameterResolver; +import org.junit.jupiter.api.extension.TestInstancePostProcessor; +import org.junit.platform.commons.support.AnnotationSupport; +import org.junit.platform.commons.support.HierarchyTraversalMode; +import org.junit.platform.commons.support.ReflectionSupport; +import org.junit.platform.commons.util.Preconditions; + +@Target({ ElementType.PARAMETER, ElementType.FIELD }) +@Retention(RUNTIME) +@ExtendWith(GlobalResource.Extension.class) +public @interface GlobalResource { + + class Extension implements ParameterResolver, TestInstancePostProcessor { + + @Override + public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) + throws ParameterResolutionException { + return parameterContext.isAnnotated(GlobalResource.class); + } + + @Override + public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) + throws ParameterResolutionException { + Class type = parameterContext.getParameter().getType(); + return getOrCreateResource(extensionContext, type).get(); + } + + @Override + public void postProcessTestInstance(Object testInstance, ExtensionContext extensionContext) { + streamFields(testInstance.getClass(), field -> AnnotationSupport.isAnnotated(field, GlobalResource.class), + HierarchyTraversalMode.BOTTOM_UP) // + .forEach(field -> { + try { + field.set(testInstance, getOrCreateResource(extensionContext, field.getType()).get()); + } + catch (IllegalAccessException e) { + throw new RuntimeException("Failed to inject resource into field: " + field, e); + } + }); + } + + @SuppressWarnings("unchecked") + private Resource getOrCreateResource(ExtensionContext extensionContext, Class type) { + return extensionContext.getRoot().getStore(Namespace.GLOBAL) // + .getOrComputeIfAbsent(type, Resource::new, Resource.class); + } + } + + class Resource implements CloseableResource { + + private final T value; + + private Resource(Class type) { + Preconditions.condition(AutoCloseable.class.isAssignableFrom(type), + () -> "Resource type must implement AutoCloseable: " + type.getName()); + this.value = ReflectionSupport.newInstance(type); + } + + private T get() { + return value; + } + + @Override + public void close() throws Throwable { + ((AutoCloseable) value).close(); + } + } +} diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java index 8a5caad44fb8..12528bddb994 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java @@ -27,15 +27,14 @@ import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; import platform.tooling.support.Request; -import platform.tooling.support.tests.LocalMavenRepo.Directory; /** * @since 1.4 */ class JavaVersionsTests { - @LocalMavenRepo - Directory localMavenRepo; + @GlobalResource + LocalMavenRepo localMavenRepo; @Test void java_8() { diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/LocalMavenRepo.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/LocalMavenRepo.java index 892a766bf56d..614caa229137 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/LocalMavenRepo.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/LocalMavenRepo.java @@ -10,103 +10,41 @@ package platform.tooling.support.tests; -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static org.junit.platform.commons.support.ReflectionSupport.streamFields; - import java.io.IOException; import java.io.UncheckedIOException; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; import java.nio.file.Files; import java.nio.file.Path; import java.util.Comparator; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junit.jupiter.api.extension.ExtensionContext; -import org.junit.jupiter.api.extension.ExtensionContext.Namespace; -import org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource; -import org.junit.jupiter.api.extension.ParameterContext; -import org.junit.jupiter.api.extension.ParameterResolutionException; -import org.junit.jupiter.api.extension.ParameterResolver; -import org.junit.jupiter.api.extension.TestInstancePostProcessor; -import org.junit.platform.commons.support.AnnotationSupport; -import org.junit.platform.commons.support.HierarchyTraversalMode; -import org.junit.platform.commons.util.Preconditions; - -@Target({ ElementType.PARAMETER, ElementType.FIELD }) -@Retention(RUNTIME) -@ExtendWith(LocalMavenRepo.Extension.class) -public @interface LocalMavenRepo { +public class LocalMavenRepo implements AutoCloseable { - class Extension implements ParameterResolver, TestInstancePostProcessor { - - @Override - public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) - throws ParameterResolutionException { - return parameterContext.isAnnotated(LocalMavenRepo.class); - } + private final Path tempDir; - @Override - public Directory resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) - throws ParameterResolutionException { - Preconditions.condition(Directory.class.equals(parameterContext.getParameter().getType()), - () -> "Parameter must be of type " + Directory.class + ": " + parameterContext.getParameter()); - return getOrCreateDirectory(extensionContext); + public LocalMavenRepo() { + try { + tempDir = Files.createTempDirectory("local-maven-repo-"); } - - @Override - public void postProcessTestInstance(Object testInstance, ExtensionContext context) { - streamFields(testInstance.getClass(), field -> AnnotationSupport.isAnnotated(field, LocalMavenRepo.class), - HierarchyTraversalMode.BOTTOM_UP) // - .forEach(field -> { - Preconditions.condition(Directory.class.equals(field.getType()), - () -> "Field must be of type " + Directory.class + ": " + field); - try { - field.set(testInstance, getOrCreateDirectory(context)); - } - catch (IllegalAccessException e) { - throw new RuntimeException(e); - } - }); - } - - private Directory getOrCreateDirectory(ExtensionContext extensionContext) { - return extensionContext.getRoot().getStore(Namespace.GLOBAL) // - .getOrComputeIfAbsent(Directory.class, __ -> new Directory(), Directory.class); + catch (IOException e) { + throw new RuntimeException(e); } } - class Directory implements CloseableResource { - - private final Path tempDir; - - private Directory() { - try { - tempDir = Files.createTempDirectory("local-maven-repo-"); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } - - public String toCliArgument() { - return "-Dmaven.repo.local=" + tempDir; - } + public String toCliArgument() { + return "-Dmaven.repo.local=" + tempDir; + } - @Override - public void close() throws Throwable { - try (var files = Files.walk(tempDir)) { - files.sorted(Comparator. naturalOrder().reversed()) // - .forEach(path -> { - try { - Files.delete(path); - } - catch (IOException e) { - throw new UncheckedIOException(e); - } - }); - } + @Override + public void close() throws IOException { + try (var files = Files.walk(tempDir)) { + files.sorted(Comparator. naturalOrder().reversed()) // + .forEach(path -> { + try { + Files.delete(path); + } + catch (IOException e) { + throw new UncheckedIOException(e); + } + }); } } } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java index 2f72339a6501..b335636e29ad 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java @@ -24,16 +24,18 @@ import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; import platform.tooling.support.Request; -import platform.tooling.support.tests.LocalMavenRepo.Directory; /** * @since 1.3 */ class MavenStarterTests { + @GlobalResource + LocalMavenRepo localMavenRepo; + @ResourceLock(Projects.MAVEN_STARTER) @Test - void verifyMavenStarterProject(@LocalMavenRepo Directory localMavenRepo) { + void verifyMavenStarterProject() { var request = Request.builder() // .setTool(Request.maven()) // .setProject(Projects.MAVEN_STARTER) // diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java index 44dd974e2c42..4188637a2744 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java @@ -27,15 +27,14 @@ import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; import platform.tooling.support.Request; -import platform.tooling.support.tests.LocalMavenRepo.Directory; /** * @since 1.9.2 */ class MavenSurefireCompatibilityTests { - @LocalMavenRepo - Directory localMavenRepo; + @GlobalResource + LocalMavenRepo localMavenRepo; @ResourceLock(Projects.MAVEN_SUREFIRE_COMPATIBILITY) @ParameterizedTest diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java index 679d6924f860..3e100255b26b 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java @@ -28,15 +28,14 @@ import platform.tooling.support.MavenRepo; import platform.tooling.support.Request; -import platform.tooling.support.tests.LocalMavenRepo.Directory; /** * @since 1.4 */ class MultiReleaseJarTests { - @LocalMavenRepo - Directory localMavenRepo; + @GlobalResource + LocalMavenRepo localMavenRepo; @ResourceLock(Projects.MULTI_RELEASE_JAR) @Test diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java index c6023920830d..217d40e1bbd0 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java @@ -24,12 +24,11 @@ import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; import platform.tooling.support.Request; -import platform.tooling.support.tests.LocalMavenRepo.Directory; class VintageMavenIntegrationTests { - @LocalMavenRepo - Directory localMavenRepo; + @GlobalResource + LocalMavenRepo localMavenRepo; @Test void unsupportedVersion() { From c58698dfd7d773ffe4689230e113d4ce2c1073b3 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 15 Nov 2024 17:06:10 +0100 Subject: [PATCH 283/611] Add HTTP proxy for snapshot repo to forbid downloading JUnit artifacts --- .../projects/maven-starter/pom.xml | 4 +- .../multi-release-jar/default/pom.xml | 4 +- .../tooling/support/tests/MavenRepoProxy.java | 124 ++++++++++++++++++ .../support/tests/MavenStarterTests.java | 4 + .../support/tests/MultiReleaseJarTests.java | 4 + 5 files changed, 136 insertions(+), 4 deletions(-) create mode 100644 platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenRepoProxy.java diff --git a/platform-tooling-support-tests/projects/maven-starter/pom.xml b/platform-tooling-support-tests/projects/maven-starter/pom.xml index 367df2e0f09d..31aaf42dfffe 100644 --- a/platform-tooling-support-tests/projects/maven-starter/pom.xml +++ b/platform-tooling-support-tests/projects/maven-starter/pom.xml @@ -90,8 +90,8 @@ - sonatype-oss-snapshots - https://oss.sonatype.org/content/repositories/snapshots + snapshots-repo + ${snapshot.repo.url} true diff --git a/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml b/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml index 8c9478ffa825..3f99b08745cf 100644 --- a/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml +++ b/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml @@ -69,8 +69,8 @@ - sonatype-oss-snapshots - https://oss.sonatype.org/content/repositories/snapshots + snapshots-repo + ${snapshot.repo.url} true diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenRepoProxy.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenRepoProxy.java new file mode 100644 index 000000000000..7f2326e0dd0a --- /dev/null +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenRepoProxy.java @@ -0,0 +1,124 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package platform.tooling.support.tests; + +import static java.net.http.HttpRequest.BodyPublishers.noBody; +import static org.junit.jupiter.api.Assertions.assertAll; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + +import java.io.IOException; +import java.io.InputStream; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.List; + +import com.sun.net.httpserver.HttpExchange; +import com.sun.net.httpserver.HttpServer; + +public class MavenRepoProxy implements AutoCloseable { + + // Forbid downloading JUnit artifacts since we want to use the local ones + private static final List FORBIDDEN_PATHS = List.of("/org/junit"); + + private static final List RESTRICTED_HEADER_NAMES = List.of("Connection", "Host"); + + private final HttpServer httpServer; + private final HttpClient httpClient; + + @SuppressWarnings("unused") + public MavenRepoProxy() throws IOException { + this(0); + } + + @SuppressWarnings("unused") + public MavenRepoProxy(int port) throws IOException { + this("https://oss.sonatype.org/content/repositories/snapshots", port); + } + + private MavenRepoProxy(String proxiedUrl, int port) throws IOException { + httpClient = HttpClient.newBuilder().followRedirects(HttpClient.Redirect.ALWAYS).build(); + httpServer = HttpServer.create(new InetSocketAddress(InetAddress.getLoopbackAddress(), port), 0); + httpServer.createContext("/", exchange -> { + try (exchange) { + switch (exchange.getRequestMethod()) { + case "HEAD": + case "GET": + if (FORBIDDEN_PATHS.stream().anyMatch( + it -> exchange.getRequestURI().getPath().startsWith(it))) { + exchange.sendResponseHeaders(404, 0); + break; + } + var request = mapRequest(proxiedUrl, exchange); + try { + var response = httpClient.send(request, HttpResponse.BodyHandlers.ofInputStream()); + mapResponse(response, exchange); + } + catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + break; + default: + exchange.sendResponseHeaders(405, -1); + } + } + catch (Exception e) { + e.printStackTrace(); + } + }); + httpServer.start(); + } + + URI getBaseUri() { + var address = httpServer.getAddress(); + return URI.create("http://" + address.getAddress().getHostName() + ":" + address.getPort()); + } + + private static void mapResponse(HttpResponse response, HttpExchange exchange) throws IOException { + exchange.sendResponseHeaders(response.statusCode(), + response.headers().firstValueAsLong("Content-Length").orElse(0)); + response.headers().map().forEach((key, values) -> exchange.getResponseHeaders().put(key, values)); + try (InputStream body = response.body()) { + body.transferTo(exchange.getResponseBody()); + } + } + + private static HttpRequest mapRequest(String proxiedUrl, HttpExchange exchange) { + var request = HttpRequest.newBuilder().method(exchange.getRequestMethod(), noBody()) // + .uri(URI.create(proxiedUrl + exchange.getRequestURI().getPath())); + exchange.getRequestHeaders().entrySet().stream() // + .filter(entry -> RESTRICTED_HEADER_NAMES.stream().noneMatch(it -> it.equalsIgnoreCase(entry.getKey()))) // + .forEach(entry -> entry.getValue() // + .forEach(value -> request.header(entry.getKey(), value))); + return request.build(); + } + + @Override + public void close() { + assertAll( // + () -> assertDoesNotThrow(() -> httpServer.stop(0)), // + () -> assertDoesNotThrow(httpClient::close) // + ); + } + + @SuppressWarnings("unused") + public static void main(String[] args) throws Exception { + try (var proxy = new MavenRepoProxy(12345)) { + System.out.println("Started proxy: " + proxy.getBaseUri()); + while (!Thread.interrupted()) { + Thread.onSpinWait(); + } + } + } +} diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java index b335636e29ad..d69df0020425 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java @@ -33,6 +33,9 @@ class MavenStarterTests { @GlobalResource LocalMavenRepo localMavenRepo; + @GlobalResource + MavenRepoProxy mavenRepoProxy; + @ResourceLock(Projects.MAVEN_STARTER) @Test void verifyMavenStarterProject() { @@ -40,6 +43,7 @@ void verifyMavenStarterProject() { .setTool(Request.maven()) // .setProject(Projects.MAVEN_STARTER) // .addArguments(localMavenRepo.toCliArgument(), "-Dmaven.repo=" + MavenRepo.dir()) // + .addArguments("-Dsnapshot.repo.url=" + mavenRepoProxy.getBaseUri()) // .addArguments("--update-snapshots", "--batch-mode", "verify") // .setTimeout(TOOL_TIMEOUT) // .setJavaHome(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java index 3e100255b26b..434c4f6bfe53 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java @@ -37,6 +37,9 @@ class MultiReleaseJarTests { @GlobalResource LocalMavenRepo localMavenRepo; + @GlobalResource + MavenRepoProxy mavenRepoProxy; + @ResourceLock(Projects.MULTI_RELEASE_JAR) @Test void checkDefault() throws Exception { @@ -92,6 +95,7 @@ private Result mvn(String variant) { .setTool(Request.maven()) // .setProject(Projects.MULTI_RELEASE_JAR) // .addArguments(localMavenRepo.toCliArgument(), "-Dmaven.repo=" + MavenRepo.dir()) // + .addArguments("-Dsnapshot.repo.url=" + mavenRepoProxy.getBaseUri()) // .addArguments("--update-snapshots", "--show-version", "--errors", "--batch-mode", "--file", variant, "test") // .setTimeout(TOOL_TIMEOUT); From 60da4915802e0669ecd2e566037d7216a9a94850 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 15 Nov 2024 17:12:22 +0100 Subject: [PATCH 284/611] Redirect instead of proxying --- .../tooling/support/tests/MavenRepoProxy.java | 59 ++----------------- 1 file changed, 5 insertions(+), 54 deletions(-) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenRepoProxy.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenRepoProxy.java index 7f2326e0dd0a..fa13d76b6ab5 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenRepoProxy.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenRepoProxy.java @@ -10,21 +10,12 @@ package platform.tooling.support.tests; -import static java.net.http.HttpRequest.BodyPublishers.noBody; -import static org.junit.jupiter.api.Assertions.assertAll; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - import java.io.IOException; -import java.io.InputStream; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.URI; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; import java.util.List; -import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpServer; public class MavenRepoProxy implements AutoCloseable { @@ -32,10 +23,7 @@ public class MavenRepoProxy implements AutoCloseable { // Forbid downloading JUnit artifacts since we want to use the local ones private static final List FORBIDDEN_PATHS = List.of("/org/junit"); - private static final List RESTRICTED_HEADER_NAMES = List.of("Connection", "Host"); - private final HttpServer httpServer; - private final HttpClient httpClient; @SuppressWarnings("unused") public MavenRepoProxy() throws IOException { @@ -48,7 +36,6 @@ public MavenRepoProxy(int port) throws IOException { } private MavenRepoProxy(String proxiedUrl, int port) throws IOException { - httpClient = HttpClient.newBuilder().followRedirects(HttpClient.Redirect.ALWAYS).build(); httpServer = HttpServer.create(new InetSocketAddress(InetAddress.getLoopbackAddress(), port), 0); httpServer.createContext("/", exchange -> { try (exchange) { @@ -57,17 +44,12 @@ private MavenRepoProxy(String proxiedUrl, int port) throws IOException { case "GET": if (FORBIDDEN_PATHS.stream().anyMatch( it -> exchange.getRequestURI().getPath().startsWith(it))) { - exchange.sendResponseHeaders(404, 0); + exchange.sendResponseHeaders(404, -1); break; } - var request = mapRequest(proxiedUrl, exchange); - try { - var response = httpClient.send(request, HttpResponse.BodyHandlers.ofInputStream()); - mapResponse(response, exchange); - } - catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } + var redirectUrl = proxiedUrl + exchange.getRequestURI().getPath(); + exchange.getResponseHeaders().add("Location", redirectUrl); + exchange.sendResponseHeaders(302, -1); break; default: exchange.sendResponseHeaders(405, -1); @@ -85,40 +67,9 @@ URI getBaseUri() { return URI.create("http://" + address.getAddress().getHostName() + ":" + address.getPort()); } - private static void mapResponse(HttpResponse response, HttpExchange exchange) throws IOException { - exchange.sendResponseHeaders(response.statusCode(), - response.headers().firstValueAsLong("Content-Length").orElse(0)); - response.headers().map().forEach((key, values) -> exchange.getResponseHeaders().put(key, values)); - try (InputStream body = response.body()) { - body.transferTo(exchange.getResponseBody()); - } - } - - private static HttpRequest mapRequest(String proxiedUrl, HttpExchange exchange) { - var request = HttpRequest.newBuilder().method(exchange.getRequestMethod(), noBody()) // - .uri(URI.create(proxiedUrl + exchange.getRequestURI().getPath())); - exchange.getRequestHeaders().entrySet().stream() // - .filter(entry -> RESTRICTED_HEADER_NAMES.stream().noneMatch(it -> it.equalsIgnoreCase(entry.getKey()))) // - .forEach(entry -> entry.getValue() // - .forEach(value -> request.header(entry.getKey(), value))); - return request.build(); - } - @Override public void close() { - assertAll( // - () -> assertDoesNotThrow(() -> httpServer.stop(0)), // - () -> assertDoesNotThrow(httpClient::close) // - ); + httpServer.stop(0); } - @SuppressWarnings("unused") - public static void main(String[] args) throws Exception { - try (var proxy = new MavenRepoProxy(12345)) { - System.out.println("Started proxy: " + proxy.getBaseUri()); - while (!Thread.interrupted()) { - Thread.onSpinWait(); - } - } - } } From 7ede5325867e9857b8832af711fa9d3c46cc615a Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 15 Nov 2024 18:00:07 +0100 Subject: [PATCH 285/611] Ignore missing checksums for local temp repo --- platform-tooling-support-tests/projects/java-versions/pom.xml | 2 ++ platform-tooling-support-tests/projects/maven-starter/pom.xml | 2 ++ .../projects/maven-surefire-compatibility/pom.xml | 2 ++ .../projects/multi-release-jar/default/pom.xml | 2 ++ platform-tooling-support-tests/projects/vintage/pom.xml | 2 ++ 5 files changed, 10 insertions(+) diff --git a/platform-tooling-support-tests/projects/java-versions/pom.xml b/platform-tooling-support-tests/projects/java-versions/pom.xml index a469343ded01..b71339842409 100644 --- a/platform-tooling-support-tests/projects/java-versions/pom.xml +++ b/platform-tooling-support-tests/projects/java-versions/pom.xml @@ -53,9 +53,11 @@ file://${maven.repo} true + ignore true + ignore diff --git a/platform-tooling-support-tests/projects/maven-starter/pom.xml b/platform-tooling-support-tests/projects/maven-starter/pom.xml index 31aaf42dfffe..68525c5f3c37 100644 --- a/platform-tooling-support-tests/projects/maven-starter/pom.xml +++ b/platform-tooling-support-tests/projects/maven-starter/pom.xml @@ -84,9 +84,11 @@ file://${maven.repo} true + ignore true + ignore diff --git a/platform-tooling-support-tests/projects/maven-surefire-compatibility/pom.xml b/platform-tooling-support-tests/projects/maven-surefire-compatibility/pom.xml index 5ad18aa4522b..087c319f5c44 100644 --- a/platform-tooling-support-tests/projects/maven-surefire-compatibility/pom.xml +++ b/platform-tooling-support-tests/projects/maven-surefire-compatibility/pom.xml @@ -60,9 +60,11 @@ file://${maven.repo} true + ignore true + ignore diff --git a/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml b/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml index 3f99b08745cf..599ad6302bef 100644 --- a/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml +++ b/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml @@ -63,9 +63,11 @@ file://${maven.repo} true + ignore true + ignore diff --git a/platform-tooling-support-tests/projects/vintage/pom.xml b/platform-tooling-support-tests/projects/vintage/pom.xml index d8f486bf8ba7..e87d42d8d728 100644 --- a/platform-tooling-support-tests/projects/vintage/pom.xml +++ b/platform-tooling-support-tests/projects/vintage/pom.xml @@ -54,9 +54,11 @@ file://${maven.repo} true + ignore true + ignore From eb4321336d717e35ddaea1a79df9f31edf117145 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 15 Nov 2024 18:03:28 +0100 Subject: [PATCH 286/611] Throw less generic exception --- .../reporting/open/xml/OpenTestReportGeneratingListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java index 898a2a203ab5..9381776a0d40 100644 --- a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java +++ b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java @@ -216,7 +216,7 @@ private static Process startProcess(String[] args) { process = Runtime.getRuntime().exec(args); } catch (IOException e) { - throw new RuntimeException(e); + throw new UncheckedIOException("Failed to start process", e); } return process; } From dd6bd41825139b3780263887edb1b96aafc34a02 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 15 Nov 2024 19:40:16 +0100 Subject: [PATCH 287/611] Disable configuration cache on CI due to Spotless issue Issue: diffplug/spotless#2318 --- .github/actions/main-build/action.yml | 2 +- .github/workflows/cross-version.yml | 4 ++-- .github/workflows/main.yml | 2 +- .github/workflows/reproducible-build.yml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/actions/main-build/action.yml b/.github/actions/main-build/action.yml index 95bf73979406..3419916b5013 100644 --- a/.github/actions/main-build/action.yml +++ b/.github/actions/main-build/action.yml @@ -4,7 +4,7 @@ inputs: arguments: required: true description: Gradle arguments - default: :platform-tooling-support-tests:test build --configuration-cache + default: :platform-tooling-support-tests:test build --no-configuration-cache # Disable configuration cache due to https://github.com/diffplug/spotless/issues/2318 encryptionKey: required: true description: Gradle cache encryption key diff --git a/.github/workflows/cross-version.yml b/.github/workflows/cross-version.yml index 9c6eabee0ab8..7fe30ec5d308 100644 --- a/.github/workflows/cross-version.yml +++ b/.github/workflows/cross-version.yml @@ -65,7 +65,7 @@ jobs: -PjavaToolchain.version=${{ matrix.jdk.version }} \ -Dscan.tag.JDK_${{ matrix.jdk.version }} \ build \ - --configuration-cache + --no-configuration-cache #Disable configuration cache due to https://github.com/diffplug/spotless/issues/2318 - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4 if: ${{ always() }} with: @@ -106,7 +106,7 @@ jobs: -Dscan.tag.JDK_${{ matrix.jdk }} \ -Dscan.tag.OpenJ9 \ build \ - --configuration-cache + --no-configuration-cache # Disable configuration cache due to https://github.com/diffplug/spotless/issues/2318 - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4 if: ${{ always() }} with: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0e969f1b5ed4..d6e39018cb83 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,7 +38,7 @@ jobs: :platform-tooling-support-tests:test \ build \ jacocoRootReport \ - --configuration-cache + --no-configuration-cache # Disable configuration cache due to https://github.com/diffplug/spotless/issues/2318 - name: Upload to Codecov.io uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4 with: diff --git a/.github/workflows/reproducible-build.yml b/.github/workflows/reproducible-build.yml index cd5af71feca7..0112a1162f59 100644 --- a/.github/workflows/reproducible-build.yml +++ b/.github/workflows/reproducible-build.yml @@ -29,7 +29,7 @@ jobs: encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} arguments: | --quiet \ - --configuration-cache + --no-configuration-cache # Disable configuration cache due to https://github.com/diffplug/spotless/issues/2318 - name: Build and compare checksums shell: bash run: | From a3eac5f4d1c4aa4d45e8fc754057a2ca568c36c9 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 15 Nov 2024 19:50:57 +0100 Subject: [PATCH 288/611] Disable open-test-reporting output for executions triggered from tests --- junit-vintage-engine/junit-vintage-engine.gradle.kts | 1 + .../src/test/resources/junit-platform.properties | 1 + jupiter-tests/jupiter-tests.gradle.kts | 1 + .../jupiter/engine/extension/ExtensionRegistryTests.java | 7 +++++-- jupiter-tests/src/test/resources/junit-platform.properties | 1 + 5 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 junit-vintage-engine/src/test/resources/junit-platform.properties create mode 100644 jupiter-tests/src/test/resources/junit-platform.properties diff --git a/junit-vintage-engine/junit-vintage-engine.gradle.kts b/junit-vintage-engine/junit-vintage-engine.gradle.kts index 950aed698a14..6aff8b8ad600 100644 --- a/junit-vintage-engine/junit-vintage-engine.gradle.kts +++ b/junit-vintage-engine/junit-vintage-engine.gradle.kts @@ -23,6 +23,7 @@ dependencies { testImplementation(projects.junitPlatformSuiteEngine) testImplementation(projects.junitPlatformTestkit) testImplementation(testFixtures(projects.junitJupiterApi)) + testImplementation(testFixtures(projects.junitPlatformReporting)) osgiVerification(projects.junitPlatformLauncher) } diff --git a/junit-vintage-engine/src/test/resources/junit-platform.properties b/junit-vintage-engine/src/test/resources/junit-platform.properties new file mode 100644 index 000000000000..6efc0d5e85ce --- /dev/null +++ b/junit-vintage-engine/src/test/resources/junit-platform.properties @@ -0,0 +1 @@ +junit.jupiter.extensions.autodetection.enabled=true diff --git a/jupiter-tests/jupiter-tests.gradle.kts b/jupiter-tests/jupiter-tests.gradle.kts index 3e55acc2371d..a6557280218c 100644 --- a/jupiter-tests/jupiter-tests.gradle.kts +++ b/jupiter-tests/jupiter-tests.gradle.kts @@ -23,6 +23,7 @@ dependencies { testImplementation(libs.memoryfilesystem) testImplementation(testFixtures(projects.junitJupiterApi)) testImplementation(testFixtures(projects.junitJupiterEngine)) + testImplementation(testFixtures(projects.junitPlatformReporting)) } tasks { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistryTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistryTests.java index 180592fd09ec..dd1babf69f0e 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistryTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistryTests.java @@ -39,7 +39,10 @@ */ class ExtensionRegistryTests { - private static final int NUM_DEFAULT_EXTENSIONS = 7; + private static final int NUM_CORE_EXTENSIONS = 7; + private static final int NUM_AUTO_REGISTERED_EXTENSIONS_IN_THIS_PROJECT = 1; // OpenTestReportGenerationSystemPropertyOverride + private static final int NUM_DEFAULT_EXTENSIONS = NUM_CORE_EXTENSIONS + + NUM_AUTO_REGISTERED_EXTENSIONS_IN_THIS_PROJECT; private final JupiterConfiguration configuration = mock(); @@ -49,7 +52,7 @@ class ExtensionRegistryTests { void newRegistryWithoutParentHasDefaultExtensions() { List extensions = registry.getExtensions(Extension.class); - assertEquals(NUM_DEFAULT_EXTENSIONS, extensions.size()); + assertEquals(NUM_CORE_EXTENSIONS, extensions.size()); assertDefaultGlobalExtensionsAreRegistered(); } diff --git a/jupiter-tests/src/test/resources/junit-platform.properties b/jupiter-tests/src/test/resources/junit-platform.properties new file mode 100644 index 000000000000..6efc0d5e85ce --- /dev/null +++ b/jupiter-tests/src/test/resources/junit-platform.properties @@ -0,0 +1 @@ +junit.jupiter.extensions.autodetection.enabled=true From bb7742672f67b0c09aeb7df80e4ba92169d7792c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 16 Nov 2024 18:07:59 +0000 Subject: [PATCH 289/611] Update plugin plantuml to v8.11 (#4132) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9f668709a414..64783d5e851a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -92,7 +92,7 @@ foojayResolver = { id = "org.gradle.toolchains.foojay-resolver", version = "0.8. gitPublish = { id = "org.ajoberstar.git-publish", version = "4.2.2" } jmh = { id = "me.champeau.jmh", version = "0.7.2" } nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" } -plantuml = { id = "io.freefair.plantuml", version = "8.10.2" } +plantuml = { id = "io.freefair.plantuml", version = "8.11" } shadow = { id = "com.gradleup.shadow", version = "8.3.5" } spotless = { id = "com.diffplug.spotless", version = "7.0.0.BETA4" } versions = { id = "com.github.ben-manes.versions", version = "0.51.0" } From 949239a99f2765942a45672f359a3fe7f2ccc63d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 16 Nov 2024 18:08:30 +0000 Subject: [PATCH 290/611] Update codecov/codecov-action action to v5 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d6e39018cb83..f275ac8521b4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,7 +40,7 @@ jobs: jacocoRootReport \ --no-configuration-cache # Disable configuration cache due to https://github.com/diffplug/spotless/issues/2318 - name: Upload to Codecov.io - uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4 + uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5 with: token: ${{ secrets.CODECOV_TOKEN }} From 60823366009d872d581e0cc682fbf27e593ac5e1 Mon Sep 17 00:00:00 2001 From: JonasJebing <34072795+JonasJebing@users.noreply.github.com> Date: Sun, 17 Nov 2024 17:06:38 +0100 Subject: [PATCH 291/611] Add ParameterizedTest#argumentCountValidation (#4045) This allows parameterized tests to fail when there are more arguments provided than declared by the test method. This is done in a backwards compatible way by only enabling that validation when the new `junit.jupiter.params.argumentCountValidation` configuration parameter is set to `strict` or `ParameterizedTest#argumentCountValidation` is set to `ArgumentCountValidationMode.STRICT`. Resolves #3708. --------- Co-authored-by: Marc Philipp --- .../release-notes-5.12.0-M1.adoc | 6 + .../asciidoc/user-guide/writing-tests.adoc | 23 ++++ .../java/example/ParameterizedTestDemo.java | 10 ++ .../params/ArgumentCountValidationMode.java | 52 ++++++++ .../params/ArgumentCountValidator.java | 111 ++++++++++++++++++ .../jupiter/params/ParameterizedTest.java | 18 +++ .../ParameterizedTestInvocationContext.java | 7 +- .../ParameterizedTestIntegrationTests.java | 86 ++++++++++++++ 8 files changed, 309 insertions(+), 4 deletions(-) create mode 100644 junit-jupiter-params/src/main/java/org/junit/jupiter/params/ArgumentCountValidationMode.java create mode 100644 junit-jupiter-params/src/main/java/org/junit/jupiter/params/ArgumentCountValidator.java diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index b5aa3793f508..92c97ce8dab6 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -95,6 +95,12 @@ JUnit repository on GitHub. a test-scoped `ExtensionContext` in `Extension` methods called during test class instantiation. This behavior will become the default in future versions of JUnit. * `@TempDir` is now supported on test class constructors. +* Parameterized tests now support argument count validation. + If the `junit.jupiter.params.argumentCountValidation=strict` configuration parameter + or the `@ParameterizedTest(argumentCountValidation = STRICT)` attribute is set, any + mismatch between the declared number of arguments and the number of arguments provided + by the arguments source will result in an error. By default, it's still only an error if + there are fewer arguments provided than declared. * The new `PreInterruptCallback` extension point defines the API for `Extensions` that wish to be called prior to invocations of `Thread#interrupt()` by the `@Timeout` extension. diff --git a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc index 0e597ae4ab0a..7b2914a95216 100644 --- a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc +++ b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc @@ -2020,6 +2020,29 @@ The following annotations are repeatable: * `@CsvFileSource` * `@ArgumentsSource` +[[writing-tests-parameterized-tests-argument-count-validation]] +==== Argument Count Validation + +WARNING: Argument count validation is currently an _experimental_ feature. You're invited to +give it a try and provide feedback to the JUnit team so they can improve and eventually +<> this feature. + +By default, when an arguments source provides more arguments than the test method needs, +those additional arguments are ignored and the test executes as usual. +This can lead to bugs where arguments are never passed to the parameterized test method. + +To prevent this, you can set argument count validation to 'strict'. +Then, any additional arguments will cause an error instead. + +To change this behavior for all tests, set the `junit.jupiter.params.argumentCountValidation` +<> to `strict`. +To change this behavior for a single test, +use the `argumentCountValidation` attribute of the `@ParameterizedTest` annotation: + +[source,java,indent=0] +---- +include::{testDir}/example/ParameterizedTestDemo.java[tags=argument_count_validation] +---- [[writing-tests-parameterized-tests-argument-conversion]] ==== Argument Conversion diff --git a/documentation/src/test/java/example/ParameterizedTestDemo.java b/documentation/src/test/java/example/ParameterizedTestDemo.java index 9027b86d67e4..894b7617761d 100644 --- a/documentation/src/test/java/example/ParameterizedTestDemo.java +++ b/documentation/src/test/java/example/ParameterizedTestDemo.java @@ -51,6 +51,7 @@ import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ParameterContext; import org.junit.jupiter.api.parallel.Execution; +import org.junit.jupiter.params.ArgumentCountValidationMode; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.aggregator.AggregateWith; import org.junit.jupiter.params.aggregator.ArgumentsAccessor; @@ -607,4 +608,13 @@ static Stream otherProvider() { return Stream.of("bar"); } // end::repeatable_annotations[] + + @extensions.ExpectToFail + // tag::argument_count_validation[] + @ParameterizedTest(argumentCountValidation = ArgumentCountValidationMode.STRICT) + @CsvSource({ "42, -666" }) + void testWithArgumentCountValidation(int number) { + assertTrue(number > 0); + } + // end::argument_count_validation[] } diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ArgumentCountValidationMode.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ArgumentCountValidationMode.java new file mode 100644 index 000000000000..38c9beb8982a --- /dev/null +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ArgumentCountValidationMode.java @@ -0,0 +1,52 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.params; + +import org.apiguardian.api.API; +import org.junit.jupiter.params.provider.ArgumentsSource; + +/** + * Enumeration of argument count validation modes for {@link ParameterizedTest @ParameterizedTest}. + * + *

    When an {@link ArgumentsSource} provides more arguments than declared by the test method, + * there might be a bug in the test method or the {@link ArgumentsSource}. + * By default, the additional arguments are ignored. + * {@link ArgumentCountValidationMode} allows you to control how additional arguments are handled. + * + * @since 5.12 + * @see ParameterizedTest + */ +@API(status = API.Status.EXPERIMENTAL, since = "5.12") +public enum ArgumentCountValidationMode { + /** + * Use the default validation mode. + * + *

    The default validation mode may be changed via the + * {@value ArgumentCountValidator#ARGUMENT_COUNT_VALIDATION_KEY} configuration parameter + * (see the User Guide for details on configuration parameters). + */ + DEFAULT, + + /** + * Use the "none" argument count validation mode. + * + *

    When there are more arguments provided than declared by the test method, + * these additional arguments are ignored. + */ + NONE, + + /** + * Use the strict argument count validation mode. + * + *

    When there are more arguments provided than declared by the test method, this raises an error. + */ + STRICT, +} diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ArgumentCountValidator.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ArgumentCountValidator.java new file mode 100644 index 000000000000..220825d9817a --- /dev/null +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ArgumentCountValidator.java @@ -0,0 +1,111 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.params; + +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.Optional; + +import org.junit.jupiter.api.extension.ExtensionConfigurationException; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.InvocationInterceptor; +import org.junit.jupiter.api.extension.ReflectiveInvocationContext; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.platform.commons.logging.Logger; +import org.junit.platform.commons.logging.LoggerFactory; +import org.junit.platform.commons.util.Preconditions; + +class ArgumentCountValidator implements InvocationInterceptor { + private static final Logger logger = LoggerFactory.getLogger(ArgumentCountValidator.class); + + static final String ARGUMENT_COUNT_VALIDATION_KEY = "junit.jupiter.params.argumentCountValidation"; + private static final ExtensionContext.Namespace NAMESPACE = ExtensionContext.Namespace.create( + ArgumentCountValidator.class); + + private final ParameterizedTestMethodContext methodContext; + private final Arguments arguments; + + ArgumentCountValidator(ParameterizedTestMethodContext methodContext, Arguments arguments) { + this.methodContext = methodContext; + this.arguments = arguments; + } + + @Override + public void interceptTestTemplateMethod(InvocationInterceptor.Invocation invocation, + ReflectiveInvocationContext invocationContext, ExtensionContext extensionContext) throws Throwable { + validateArgumentCount(extensionContext, arguments); + invocation.proceed(); + } + + private ExtensionContext.Store getStore(ExtensionContext context) { + return context.getRoot().getStore(NAMESPACE); + } + + private void validateArgumentCount(ExtensionContext extensionContext, Arguments arguments) { + ArgumentCountValidationMode argumentCountValidationMode = getArgumentCountValidationMode(extensionContext); + switch (argumentCountValidationMode) { + case DEFAULT: + case NONE: + return; + case STRICT: + int testParamCount = extensionContext.getRequiredTestMethod().getParameterCount(); + int argumentsCount = arguments.get().length; + Preconditions.condition(testParamCount == argumentsCount, () -> String.format( + "Configuration error: the @ParameterizedTest has %s argument(s) but there were %s argument(s) provided.%nNote: the provided arguments are %s", + testParamCount, argumentsCount, Arrays.toString(arguments.get()))); + break; + default: + throw new ExtensionConfigurationException( + "Unsupported argument count validation mode: " + argumentCountValidationMode); + } + } + + private ArgumentCountValidationMode getArgumentCountValidationMode(ExtensionContext extensionContext) { + ParameterizedTest parameterizedTest = methodContext.annotation; + if (parameterizedTest.argumentCountValidation() != ArgumentCountValidationMode.DEFAULT) { + return parameterizedTest.argumentCountValidation(); + } + else { + return getArgumentCountValidationModeConfiguration(extensionContext); + } + } + + private ArgumentCountValidationMode getArgumentCountValidationModeConfiguration(ExtensionContext extensionContext) { + String key = ARGUMENT_COUNT_VALIDATION_KEY; + ArgumentCountValidationMode fallback = ArgumentCountValidationMode.NONE; + ExtensionContext.Store store = getStore(extensionContext); + return store.getOrComputeIfAbsent(key, __ -> { + Optional optionalConfigValue = extensionContext.getConfigurationParameter(key); + if (optionalConfigValue.isPresent()) { + String configValue = optionalConfigValue.get(); + Optional enumValue = Arrays.stream( + ArgumentCountValidationMode.values()).filter( + mode -> mode.name().equalsIgnoreCase(configValue)).findFirst(); + if (enumValue.isPresent()) { + logger.config(() -> String.format( + "Using ArgumentCountValidationMode '%s' set via the '%s' configuration parameter.", + enumValue.get().name(), key)); + return enumValue.get(); + } + else { + logger.warn(() -> String.format( + "Invalid ArgumentCountValidationMode '%s' set via the '%s' configuration parameter. " + + "Falling back to the %s default value.", + configValue, key, fallback.name())); + return fallback; + } + } + else { + return fallback; + } + }, ArgumentCountValidationMode.class); + } +} diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java index 67296b5a4158..03741d19f1fd 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java @@ -22,6 +22,7 @@ import org.apiguardian.api.API; import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.params.provider.ArgumentsSource; /** * {@code @ParameterizedTest} is used to signal that the annotated method is a @@ -305,4 +306,21 @@ @API(status = EXPERIMENTAL, since = "5.12") boolean requireArguments() default true; + /** + * Configure how the number of arguments provided by an {@link ArgumentsSource} are validated. + * + *

    Defaults to {@link ArgumentCountValidationMode#DEFAULT}. + * + *

    When an {@link ArgumentsSource} provides more arguments than declared by the test method, + * there might be a bug in the test method or the {@link ArgumentsSource}. + * By default, the additional arguments are ignored. + * {@code argumentCountValidation} allows you to control how additional arguments are handled. + * The default can be configured via the {@value ArgumentCountValidator#ARGUMENT_COUNT_VALIDATION_KEY} + * configuration parameter (see the User Guide for details on configuration parameters). + * + * @since 5.12 + * @see ArgumentCountValidationMode + */ + @API(status = EXPERIMENTAL, since = "5.12") + ArgumentCountValidationMode argumentCountValidation() default ArgumentCountValidationMode.DEFAULT; } diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestInvocationContext.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestInvocationContext.java index c0ac83e78717..ab26b362c362 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestInvocationContext.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestInvocationContext.java @@ -10,8 +10,6 @@ package org.junit.jupiter.params; -import static java.util.Collections.singletonList; - import java.util.Arrays; import java.util.List; @@ -47,8 +45,9 @@ public String getDisplayName(int invocationIndex) { @Override public List getAdditionalExtensions() { - return singletonList( - new ParameterizedTestParameterResolver(this.methodContext, this.consumedArguments, this.invocationIndex)); + return Arrays.asList( + new ParameterizedTestParameterResolver(this.methodContext, this.consumedArguments, this.invocationIndex), + new ArgumentCountValidator(this.methodContext, this.arguments)); } private static Object[] consumedArguments(ParameterizedTestMethodContext methodContext, Object[] arguments) { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java index c80708edfae5..50c131c449b3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java @@ -116,6 +116,7 @@ import org.junit.platform.testkit.engine.EngineExecutionResults; import org.junit.platform.testkit.engine.EngineTestKit; import org.junit.platform.testkit.engine.Event; +import org.junit.platform.testkit.engine.EventConditions; import org.opentest4j.TestAbortedException; /** @@ -1112,6 +1113,74 @@ private EngineExecutionResults execute(String methodName, Class... methodPara } + @Nested + class UnusedArgumentsWithStrictArgumentsCountIntegrationTests { + @Test + void failsWithArgumentsSourceProvidingUnusedArguments() { + var results = execute(ArgumentCountValidationMode.STRICT, UnusedArgumentsTestCase.class, + "testWithTwoUnusedStringArgumentsProvider", String.class); + results.allEvents().assertThatEvents() // + .haveExactly(1, event(EventConditions.finishedWithFailure(message(String.format( + "Configuration error: the @ParameterizedTest has 1 argument(s) but there were 2 argument(s) provided.%nNote: the provided arguments are [foo, unused1]"))))); + } + + @Test + void failsWithMethodSourceProvidingUnusedArguments() { + var results = execute(ArgumentCountValidationMode.STRICT, UnusedArgumentsTestCase.class, + "testWithMethodSourceProvidingUnusedArguments", String.class); + results.allEvents().assertThatEvents() // + .haveExactly(1, event(EventConditions.finishedWithFailure(message(String.format( + "Configuration error: the @ParameterizedTest has 1 argument(s) but there were 2 argument(s) provided.%nNote: the provided arguments are [foo, unused1]"))))); + } + + @Test + void failsWithCsvSourceUnusedArgumentsAndStrictArgumentCountValidationAnnotationAttribute() { + var results = execute(ArgumentCountValidationMode.NONE, UnusedArgumentsTestCase.class, + "testWithStrictArgumentCountValidation", String.class); + results.allEvents().assertThatEvents() // + .haveExactly(1, event(EventConditions.finishedWithFailure(message(String.format( + "Configuration error: the @ParameterizedTest has 1 argument(s) but there were 2 argument(s) provided.%nNote: the provided arguments are [foo, unused1]"))))); + } + + @Test + void failsWithCsvSourceUnusedArgumentsButExecutesRemainingArgumentsWhereThereIsNoUnusedArgument() { + var results = execute(ArgumentCountValidationMode.STRICT, UnusedArgumentsTestCase.class, + "testWithCsvSourceContainingDifferentNumbersOfArguments", String.class); + results.allEvents().assertThatEvents() // + .haveExactly(1, event(EventConditions.finishedWithFailure(message(String.format( + "Configuration error: the @ParameterizedTest has 1 argument(s) but there were 2 argument(s) provided.%nNote: the provided arguments are [foo, unused1]"))))) // + .haveExactly(1, + event(test(), displayName("[2] argument=bar"), finishedWithFailure(message("bar")))); + } + + @Test + void executesWithCsvSourceUnusedArgumentsAndArgumentCountValidationAnnotationAttribute() { + var results = execute(ArgumentCountValidationMode.NONE, UnusedArgumentsTestCase.class, + "testWithNoneArgumentCountValidation", String.class); + results.allEvents().assertThatEvents() // + .haveExactly(1, + event(test(), displayName("[1] argument=foo"), finishedWithFailure(message("foo")))); + } + + @Test + void executesWithMethodSourceProvidingUnusedArguments() { + var results = execute(ArgumentCountValidationMode.STRICT, RepeatableSourcesTestCase.class, + "testWithRepeatableCsvSource", String.class); + results.allEvents().assertThatEvents() // + .haveExactly(1, event(test(), displayName("[1] argument=a"), finishedWithFailure(message("a")))) // + .haveExactly(1, event(test(), displayName("[2] argument=b"), finishedWithFailure(message("b")))); + } + + private EngineExecutionResults execute(ArgumentCountValidationMode configurationValue, Class javaClass, + String methodName, Class... methodParameterTypes) { + return EngineTestKit.engine(new JupiterTestEngine()) // + .selectors(selectMethod(javaClass, methodName, methodParameterTypes)) // + .configurationParameter(ArgumentCountValidator.ARGUMENT_COUNT_VALIDATION_KEY, + configurationValue.name().toLowerCase()) // + .execute(); + } + } + @Nested class RepeatableSourcesIntegrationTests { @@ -2028,6 +2097,23 @@ void testWithFieldSourceProvidingUnusedArguments(String argument) { static Supplier> unusedArgumentsProviderField = // () -> Stream.of(arguments("foo", "unused1"), arguments("bar", "unused2")); + @ParameterizedTest(argumentCountValidation = ArgumentCountValidationMode.STRICT) + @CsvSource({ "foo, unused1" }) + void testWithStrictArgumentCountValidation(String argument) { + fail(argument); + } + + @ParameterizedTest(argumentCountValidation = ArgumentCountValidationMode.NONE) + @CsvSource({ "foo, unused1" }) + void testWithNoneArgumentCountValidation(String argument) { + fail(argument); + } + + @ParameterizedTest + @CsvSource({ "foo, unused1", "bar" }) + void testWithCsvSourceContainingDifferentNumbersOfArguments(String argument) { + fail(argument); + } } static class LifecycleTestCase { From a9b0a129a1ed48c635bdc58d66f3bbfb2165ddf2 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 21 Oct 2024 15:30:27 +0200 Subject: [PATCH 292/611] Enable JaCoCo by default --- .github/workflows/cross-version.yml | 2 ++ .github/workflows/main.yml | 1 - README.md | 2 +- gradle/plugins/build-parameters/build.gradle.kts | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cross-version.yml b/.github/workflows/cross-version.yml index 7fe30ec5d308..d303d359437c 100644 --- a/.github/workflows/cross-version.yml +++ b/.github/workflows/cross-version.yml @@ -62,6 +62,7 @@ jobs: with: encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} arguments: | + -Ptesting.enableJaCoCo=false \ -PjavaToolchain.version=${{ matrix.jdk.version }} \ -Dscan.tag.JDK_${{ matrix.jdk.version }} \ build \ @@ -101,6 +102,7 @@ jobs: with: encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} arguments: | + -Ptesting.enableJaCoCo=false \ -PjavaToolchain.version=${{ matrix.jdk }} \ -PjavaToolchain.implementation=j9 \ -Dscan.tag.JDK_${{ matrix.jdk }} \ diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f275ac8521b4..ed22fcf21543 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,7 +34,6 @@ jobs: with: encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} arguments: | - -Ptesting.enableJaCoCo \ :platform-tooling-support-tests:test \ build \ jacocoRootReport \ diff --git a/README.md b/README.md index 42d127a29ca9..0e0b8a716e1f 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ builds of the next OpenJDK. Code coverage using [JaCoCo] for the latest build is available on [Codecov]. A code coverage report can also be generated locally via the [Gradle Wrapper] by -executing `./gradlew -Ptesting.enableJaCoCo clean jacocoRootReport`. The results will be available +executing `./gradlew clean jacocoRootReport`. The results will be available in `build/reports/jacoco/jacocoRootReport/html/index.html`. ## Develocity diff --git a/gradle/plugins/build-parameters/build.gradle.kts b/gradle/plugins/build-parameters/build.gradle.kts index 98b793a794d4..65d56b270e10 100644 --- a/gradle/plugins/build-parameters/build.gradle.kts +++ b/gradle/plugins/build-parameters/build.gradle.kts @@ -67,7 +67,7 @@ buildParameters { description = "Testing related parameters" bool("enableJaCoCo") { description = "Enables JaCoCo test coverage reporting" - defaultValue = false + defaultValue = true } bool("enableJFR") { description = "Enables Java Flight Recorder functionality" From 490e663244d506223d9e7b2aa1864576e44446cd Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 18 Nov 2024 11:34:29 +0100 Subject: [PATCH 293/611] Re-enable test disabled due to resolved JDK issue (#4133) Resolves #3594. --- .../open/xml/OpenTestReportGeneratingListenerTests.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java index 2c48f6feccf4..b1bf59ebffb1 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java @@ -13,7 +13,6 @@ import static java.util.Objects.requireNonNull; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.fail; -import static org.junit.jupiter.api.condition.JRE.JAVA_22; import static org.junit.jupiter.api.io.CleanupMode.ON_SUCCESS; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId; import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; @@ -27,7 +26,6 @@ import java.nio.file.Path; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledForJreRange; import org.junit.jupiter.api.io.TempDir; import org.junit.platform.engine.TestEngine; import org.junit.platform.engine.UniqueId; @@ -43,7 +41,6 @@ * * @since 1.9 */ -@DisabledForJreRange(min = JAVA_22, disabledReason = "https://github.com/junit-team/junit5/issues/3594") public class OpenTestReportGeneratingListenerTests { @TempDir(cleanup = ON_SUCCESS) From 4f675d6a4813f5fec9ce578e4c4550b5dba64c8e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 19:48:59 +0000 Subject: [PATCH 294/611] Update dependency gg.jte:jte to v3.1.15 (#4134) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 64783d5e851a..ad1adcf9aabe 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -45,7 +45,7 @@ jimfs = { module = "com.google.jimfs:jimfs", version = "1.3.0" } jmh-core = { module = "org.openjdk.jmh:jmh-core", version.ref = "jmh" } jmh-generator-annprocess = { module = "org.openjdk.jmh:jmh-generator-annprocess", version.ref = "jmh" } joox = { module = "org.jooq:joox", version = "2.0.1" } -jte = { module = "gg.jte:jte", version = "3.1.14" } +jte = { module = "gg.jte:jte", version = "3.1.15" } junit4 = { module = "junit:junit", version = { require = "[4.12,)", prefer = "4.13.2" } } kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.9.0" } log4j-core = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j" } From 81ddb74de9fe38162c9063f2b179f95be81d8969 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 19:49:21 +0000 Subject: [PATCH 295/611] Update gradle/actions digest to cc4fc85 --- .github/actions/run-gradle/action.yml | 2 +- .github/workflows/gradle-dependency-submission.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/run-gradle/action.yml b/.github/actions/run-gradle/action.yml index 6265705e57e6..d2c704f5ef4c 100644 --- a/.github/actions/run-gradle/action.yml +++ b/.github/actions/run-gradle/action.yml @@ -17,7 +17,7 @@ runs: distribution: temurin java-version: 21 check-latest: true - - uses: gradle/actions/setup-gradle@473878a77f1b98e2b5ac4af93489d1656a80a5ed # v4 + - uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4 with: cache-encryption-key: ${{ inputs.encryptionKey }} - shell: bash diff --git a/.github/workflows/gradle-dependency-submission.yml b/.github/workflows/gradle-dependency-submission.yml index bab2e20e114e..9c31d8bcbfbd 100644 --- a/.github/workflows/gradle-dependency-submission.yml +++ b/.github/workflows/gradle-dependency-submission.yml @@ -25,4 +25,4 @@ jobs: java-version: 21 check-latest: true - name: Generate and submit dependency graph - uses: gradle/actions/dependency-submission@473878a77f1b98e2b5ac4af93489d1656a80a5ed # v4 + uses: gradle/actions/dependency-submission@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4 From d9f9122099d69843655ea291e4ef9a822488f778 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 20 Nov 2024 15:51:56 +0100 Subject: [PATCH 296/611] Avoid JDK warning for dynamic agent due to using Mockito Reference: https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#0.3 --- gradle/libs.versions.toml | 4 +++- .../junitbuild.testing-conventions.gradle.kts | 24 ++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ad1adcf9aabe..6137ece2c17e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -14,6 +14,7 @@ junit4 = "4.13.2" junit4Min = "4.12" ktlint = "1.4.1" log4j = "2.24.1" +mockito = "5.14.2" opentest4j = "1.3.0" openTestReporting = "0.1.0-SNAPSHOT" surefire = "3.5.2" @@ -53,7 +54,8 @@ log4j-jul = { module = "org.apache.logging.log4j:log4j-jul", version.ref = "log4 maven = { module = "org.apache.maven:apache-maven", version = "3.9.9" } mavenSurefirePlugin = { module = "org.apache.maven.plugins:maven-surefire-plugin", version.ref = "surefire" } memoryfilesystem = { module = "com.github.marschall:memoryfilesystem", version = "2.8.1" } -mockito = { module = "org.mockito:mockito-junit-jupiter", version = "5.14.2" } +mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" } +mockito-junit-jupiter = { module = "org.mockito:mockito-junit-jupiter", version.ref = "mockito" } nohttp-checkstyle = { module = "io.spring.nohttp:nohttp-checkstyle", version = "0.0.11" } opentest4j = { module = "org.opentest4j:opentest4j", version.ref = "opentest4j" } openTestReporting-cli = { module = "org.opentest4j.reporting:open-test-reporting-cli", version.ref = "openTestReporting" } diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts index a89dd59b290e..882c0f8cbbf1 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts @@ -12,6 +12,11 @@ plugins { id("junitbuild.build-parameters") } +var javaAgent = configurations.dependencyScope("javaAgent") +var javaAgentClasspath = configurations.resolvable("javaAgentClasspath") { + extendsFrom(javaAgent.get()) +} + var openTestReportingCli = configurations.dependencyScope("openTestReportingCli") var openTestReportingCliClasspath = configurations.resolvable("openTestReportingCliClasspath") { extendsFrom(openTestReportingCli.get()) @@ -117,6 +122,10 @@ tasks.withType().configureEach { ) } + jvmArgumentProviders += objects.newInstance(JavaAgentArgumentProvider::class).apply { + classpath.from(javaAgentClasspath) + } + val reportFiles = objects.fileTree().from(reports.junitXml.outputLocation).matching { include("junit-platform-events-*.xml") } doFirst { reportFiles.files.forEach { @@ -129,7 +138,7 @@ tasks.withType().configureEach { dependencies { testImplementation(dependencyFromLibs("assertj")) - testImplementation(dependencyFromLibs("mockito")) + testImplementation(dependencyFromLibs("mockito-junit-jupiter")) testImplementation(dependencyFromLibs("testingAnnotations")) testImplementation(project(":junit-jupiter")) @@ -147,4 +156,17 @@ dependencies { openTestReportingCli(dependencyFromLibs("openTestReporting-cli")) openTestReportingCli(project(":junit-platform-reporting")) + + javaAgent(dependencyFromLibs("mockito-core")) { + isTransitive = false + } +} + +abstract class JavaAgentArgumentProvider : CommandLineArgumentProvider { + + @get:Classpath + abstract val classpath: ConfigurableFileCollection + + override fun asArguments() = listOf("-javaagent:${classpath.singleFile.absolutePath}") + } From 151cd367cfd6a419f4fd5bac178a4d22f94c9d08 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 20 Nov 2024 16:47:40 +0100 Subject: [PATCH 297/611] Resolve Gradle deprecation warnings in integration tests Moreover, tests will now fail when new deprecation warnings are emitted. --- .../gradle-kotlin-extensions/build.gradle.kts | 8 ++++++++ .../gradle-kotlin-extensions/gradle.properties | 1 + .../projects/gradle-missing-engine/build.gradle.kts | 6 ++++++ .../gradle-missing-engine/gradle.properties | 1 + .../projects/gradle-starter/build.gradle.kts | 13 +++++++------ .../projects/gradle-starter/gradle.properties | 1 + .../java/com/example/project/CalculatorTests.java | 6 ++++++ .../projects/reflection-tests/build.gradle.kts | 12 +++++++----- .../projects/reflection-tests/gradle.properties | 1 + .../src/test/java/ReflectionTestCase.java | 6 ++++++ .../projects/vintage/build.gradle.kts | 9 +++++++++ .../projects/vintage/gradle.properties | 1 + .../tooling/support/tests/GraalVmStarterTests.java | 3 ++- .../support/tests/GradleKotlinExtensionsTests.java | 4 ++-- .../support/tests/GradleMissingEngineTests.java | 4 ++-- .../tooling/support/tests/GradleStarterTests.java | 4 ++-- .../support/tests/ReflectionCompatibilityTests.java | 4 ++-- .../tests/VintageGradleIntegrationTests.java | 4 ++-- 18 files changed, 66 insertions(+), 22 deletions(-) create mode 100644 platform-tooling-support-tests/projects/gradle-kotlin-extensions/gradle.properties create mode 100644 platform-tooling-support-tests/projects/gradle-missing-engine/gradle.properties create mode 100644 platform-tooling-support-tests/projects/gradle-starter/gradle.properties create mode 100644 platform-tooling-support-tests/projects/reflection-tests/gradle.properties create mode 100644 platform-tooling-support-tests/projects/vintage/gradle.properties diff --git a/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts b/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts index ce55382514be..0f271d75bde1 100644 --- a/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts +++ b/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts @@ -11,10 +11,18 @@ repositories { // grab jupiter version from system environment val jupiterVersion = System.getenv("JUNIT_JUPITER_VERSION") +val platformVersion: String = System.getenv("JUNIT_PLATFORM_VERSION") dependencies { testImplementation(kotlin("stdlib-jdk8")) testImplementation("org.junit.jupiter:junit-jupiter:$jupiterVersion") + testRuntimeOnly("org.junit.platform:junit-platform-launcher:$platformVersion") +} + +java { + toolchain { + languageVersion = JavaLanguageVersion.of(8) + } } tasks.withType().configureEach { diff --git a/platform-tooling-support-tests/projects/gradle-kotlin-extensions/gradle.properties b/platform-tooling-support-tests/projects/gradle-kotlin-extensions/gradle.properties new file mode 100644 index 000000000000..79b428ebc70c --- /dev/null +++ b/platform-tooling-support-tests/projects/gradle-kotlin-extensions/gradle.properties @@ -0,0 +1 @@ +org.gradle.java.installations.fromEnv=JDK8 diff --git a/platform-tooling-support-tests/projects/gradle-missing-engine/build.gradle.kts b/platform-tooling-support-tests/projects/gradle-missing-engine/build.gradle.kts index 022b1d3a71eb..6eec5d884cae 100644 --- a/platform-tooling-support-tests/projects/gradle-missing-engine/build.gradle.kts +++ b/platform-tooling-support-tests/projects/gradle-missing-engine/build.gradle.kts @@ -31,6 +31,12 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter-api:$jupiterVersion") { exclude(group = "org.junit.jupiter", module = "junit-jupiter-engine") } + testRuntimeOnly("org.junit.platform:junit-platform-launcher:$platformVersion")} + +java { + toolchain { + languageVersion = JavaLanguageVersion.of(8) + } } tasks.test { diff --git a/platform-tooling-support-tests/projects/gradle-missing-engine/gradle.properties b/platform-tooling-support-tests/projects/gradle-missing-engine/gradle.properties new file mode 100644 index 000000000000..79b428ebc70c --- /dev/null +++ b/platform-tooling-support-tests/projects/gradle-missing-engine/gradle.properties @@ -0,0 +1 @@ +org.gradle.java.installations.fromEnv=JDK8 diff --git a/platform-tooling-support-tests/projects/gradle-starter/build.gradle.kts b/platform-tooling-support-tests/projects/gradle-starter/build.gradle.kts index e1053da535b7..c6957f5e185c 100644 --- a/platform-tooling-support-tests/projects/gradle-starter/build.gradle.kts +++ b/platform-tooling-support-tests/projects/gradle-starter/build.gradle.kts @@ -4,7 +4,6 @@ plugins { // grab jupiter version from system environment val jupiterVersion: String = System.getenv("JUNIT_JUPITER_VERSION") -val vintageVersion: String = System.getenv("JUNIT_VINTAGE_VERSION") val platformVersion: String = System.getenv("JUNIT_PLATFORM_VERSION") repositories { @@ -17,11 +16,17 @@ dependencies { testRuntimeOnly("org.junit.platform:junit-platform-reporting:$platformVersion") } +java { + toolchain { + languageVersion = JavaLanguageVersion.of(8) + } +} + tasks.test { useJUnitPlatform() testLogging { - events("passed", "skipped", "failed") + events("passed", "skipped", "failed", "standardOut") } reports { @@ -35,8 +40,4 @@ tasks.test { "-Djunit.platform.reporting.output.dir=${outputDir.get().asFile.absolutePath}" ) } - - doFirst { - println("Using Java version: ${JavaVersion.current()}") - } } diff --git a/platform-tooling-support-tests/projects/gradle-starter/gradle.properties b/platform-tooling-support-tests/projects/gradle-starter/gradle.properties new file mode 100644 index 000000000000..79b428ebc70c --- /dev/null +++ b/platform-tooling-support-tests/projects/gradle-starter/gradle.properties @@ -0,0 +1 @@ +org.gradle.java.installations.fromEnv=JDK8 diff --git a/platform-tooling-support-tests/projects/gradle-starter/src/test/java/com/example/project/CalculatorTests.java b/platform-tooling-support-tests/projects/gradle-starter/src/test/java/com/example/project/CalculatorTests.java index 0b0a25ab7fdc..06e73789b1af 100644 --- a/platform-tooling-support-tests/projects/gradle-starter/src/test/java/com/example/project/CalculatorTests.java +++ b/platform-tooling-support-tests/projects/gradle-starter/src/test/java/com/example/project/CalculatorTests.java @@ -12,6 +12,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -19,6 +20,11 @@ class CalculatorTests { + @BeforeAll + static void printJavaVersion() { + System.out.println("Using Java version: " + System.getProperty("java.specification.version")); + } + @Test @DisplayName("1 + 1 = 2") void addsTwoNumbers() { diff --git a/platform-tooling-support-tests/projects/reflection-tests/build.gradle.kts b/platform-tooling-support-tests/projects/reflection-tests/build.gradle.kts index 653257ae1042..23053cf355d4 100644 --- a/platform-tooling-support-tests/projects/reflection-tests/build.gradle.kts +++ b/platform-tooling-support-tests/projects/reflection-tests/build.gradle.kts @@ -18,11 +18,17 @@ dependencies { testRuntimeOnly("org.junit.platform:junit-platform-reporting:$platformVersion") } +java { + toolchain { + languageVersion = JavaLanguageVersion.of(8) + } +} + tasks.test { useJUnitPlatform() testLogging { - events("failed") + events("failed", "standardOut") } reports { @@ -36,8 +42,4 @@ tasks.test { "-Djunit.platform.reporting.output.dir=${outputDir.get().asFile.absolutePath}" ) } - - doFirst { - println("Using Java version: ${JavaVersion.current()}") - } } diff --git a/platform-tooling-support-tests/projects/reflection-tests/gradle.properties b/platform-tooling-support-tests/projects/reflection-tests/gradle.properties new file mode 100644 index 000000000000..79b428ebc70c --- /dev/null +++ b/platform-tooling-support-tests/projects/reflection-tests/gradle.properties @@ -0,0 +1 @@ +org.gradle.java.installations.fromEnv=JDK8 diff --git a/platform-tooling-support-tests/projects/reflection-tests/src/test/java/ReflectionTestCase.java b/platform-tooling-support-tests/projects/reflection-tests/src/test/java/ReflectionTestCase.java index 0692db43426b..a6df7c7dcfd7 100644 --- a/platform-tooling-support-tests/projects/reflection-tests/src/test/java/ReflectionTestCase.java +++ b/platform-tooling-support-tests/projects/reflection-tests/src/test/java/ReflectionTestCase.java @@ -17,6 +17,7 @@ import java.util.Arrays; import java.util.stream.Stream; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DynamicNode; import org.junit.jupiter.api.TestFactory; import org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor; @@ -31,6 +32,11 @@ class ReflectionTestCase { + @BeforeAll + static void printJavaVersion() { + System.out.println("Using Java version: " + System.getProperty("java.specification.version")); + } + @TestFactory Stream canReadParameters() { return Stream.of(JupiterTestDescriptor.class, ClassBasedTestDescriptor.class, ClassTestDescriptor.class, diff --git a/platform-tooling-support-tests/projects/vintage/build.gradle.kts b/platform-tooling-support-tests/projects/vintage/build.gradle.kts index b06aca00e221..80f15a7118e2 100644 --- a/platform-tooling-support-tests/projects/vintage/build.gradle.kts +++ b/platform-tooling-support-tests/projects/vintage/build.gradle.kts @@ -18,6 +18,15 @@ dependencies { exclude(group = "junit") because("we want to override it to test against different versions") } + + val platformVersion: String = System.getenv("JUNIT_PLATFORM_VERSION") + testRuntimeOnly("org.junit.platform:junit-platform-launcher:$platformVersion") +} + +java { + toolchain { + languageVersion = JavaLanguageVersion.of(8) + } } tasks.test { diff --git a/platform-tooling-support-tests/projects/vintage/gradle.properties b/platform-tooling-support-tests/projects/vintage/gradle.properties new file mode 100644 index 000000000000..79b428ebc70c --- /dev/null +++ b/platform-tooling-support-tests/projects/vintage/gradle.properties @@ -0,0 +1 @@ +org.gradle.java.installations.fromEnv=JDK8 diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java index 349d5d520b4d..71cadeedaf6c 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java @@ -43,7 +43,8 @@ void runsTestsInNativeImage() { .setTool(new GradleWrapper(Paths.get(".."))) // .setProject(Projects.GRAALVM_STARTER) // .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // - .addArguments("javaToolchains", "nativeTest", "--no-daemon", "--stacktrace", "--no-build-cache") // + .addArguments("javaToolchains", "nativeTest", "--no-daemon", "--stacktrace", "--no-build-cache", + "--warning-mode=fail") // .setTimeout(Duration.ofMinutes(10)) // .build(); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java index fee5e16082d0..6c3631c327bd 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java @@ -39,9 +39,9 @@ void gradle_wrapper() { .setTool(new GradleWrapper(Paths.get(".."))) // .setProject(Projects.GRADLE_KOTLIN_EXTENSIONS) // .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // - .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache") // + .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // .setTimeout(TOOL_TIMEOUT) // - .setJavaHome(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // + .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // .build() // .run(); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java index 69204b5a2a46..36d6f8630930 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java @@ -45,8 +45,8 @@ private void test(Tool gradle) { .setProject(Projects.GRADLE_MISSING_ENGINE) // .setTool(gradle) // .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // - .addArguments("build", "--no-daemon", "--debug", "--stacktrace", "--no-build-cache") // - .setJavaHome(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // + .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // + .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // .setTimeout(TOOL_TIMEOUT).build() // .run(); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java index 38c400ed79e8..ae13bc8e76aa 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java @@ -41,9 +41,9 @@ void gradle_wrapper() { .setTool(new GradleWrapper(Paths.get(".."))) // .setProject(Projects.GRADLE_STARTER) // .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // - .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache") // + .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // .setTimeout(TOOL_TIMEOUT) // - .setJavaHome(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // + .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // .build(); var result = request.run(); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java index 273a9a107111..82a73087ac4d 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java @@ -40,9 +40,9 @@ void gradle_wrapper() { .setTool(new GradleWrapper(Paths.get(".."))) // .setProject(Projects.REFLECTION_TESTS) // .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // - .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache") // + .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // .setTimeout(TOOL_TIMEOUT) // - .setJavaHome(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // + .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // .build(); var result = request.run(); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java index b655753eaa10..4112efadd0f3 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java @@ -57,10 +57,10 @@ void supportedVersions(String version) { private Result run(String version) { var result = Request.builder() // .setTool(new GradleWrapper(Paths.get(".."))) // - .setJavaHome(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // + .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // .setProject(Projects.VINTAGE) // .setWorkspace("vintage-gradle-" + version) // - .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache") // + .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("-Djunit4Version=" + version) // .setTimeout(TOOL_TIMEOUT) // From f44ae0111f8874d812bdeb585104e8d07b1172ac Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 20 Nov 2024 11:06:09 +0100 Subject: [PATCH 298/611] Fix test without relying on Gradle's --debug --- .../reporting/testutil/FileUtils.java | 31 +++++++++++++++++++ .../platform-tooling-support-tests.gradle.kts | 1 + .../tests/GradleMissingEngineTests.java | 29 +++++++++-------- 3 files changed, 46 insertions(+), 15 deletions(-) create mode 100644 junit-platform-reporting/src/testFixtures/java/org/junit/platform/reporting/testutil/FileUtils.java diff --git a/junit-platform-reporting/src/testFixtures/java/org/junit/platform/reporting/testutil/FileUtils.java b/junit-platform-reporting/src/testFixtures/java/org/junit/platform/reporting/testutil/FileUtils.java new file mode 100644 index 000000000000..503e792dafa6 --- /dev/null +++ b/junit-platform-reporting/src/testFixtures/java/org/junit/platform/reporting/testutil/FileUtils.java @@ -0,0 +1,31 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.reporting.testutil; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.Files; +import java.nio.file.Path; + +public class FileUtils { + + public static Path findPath(Path rootDir, String syntaxAndPattern) { + var matcher = rootDir.getFileSystem().getPathMatcher(syntaxAndPattern); + try (var files = Files.walk(rootDir)) { + return files.filter(matcher::matches).findFirst() // + .orElseThrow(() -> new AssertionError( + "Failed to find file matching '%s' in %s".formatted(syntaxAndPattern, rootDir))); + } + catch (IOException e) { + throw new UncheckedIOException(e); + } + } +} diff --git a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts index 605428191449..cb6238017390 100644 --- a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts +++ b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts @@ -71,6 +71,7 @@ dependencies { } testImplementation(libs.bundles.xmlunit) testImplementation(testFixtures(projects.junitJupiterApi)) + testImplementation(testFixtures(projects.junitPlatformReporting)) thirdPartyJars(libs.junit4) thirdPartyJars(libs.assertj) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java index 36d6f8630930..8f3a13bb4626 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java @@ -10,19 +10,19 @@ package platform.tooling.support.tests; +import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertLinesMatch; import static platform.tooling.support.Helper.TOOL_TIMEOUT; import java.nio.file.Paths; -import java.util.List; import de.sormuras.bartholdy.Tool; import de.sormuras.bartholdy.tool.GradleWrapper; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.parallel.ResourceLock; +import org.junit.platform.reporting.testutil.FileUtils; import org.opentest4j.TestAbortedException; import platform.tooling.support.Helper; @@ -41,27 +41,26 @@ void gradle_wrapper() { } private void test(Tool gradle) { - var result = Request.builder() // + var request = Request.builder() // .setProject(Projects.GRADLE_MISSING_ENGINE) // .setTool(gradle) // .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // - .setTimeout(TOOL_TIMEOUT).build() // - .run(); + .setTimeout(TOOL_TIMEOUT) // + .build(); + + var result = request.run(); assertFalse(result.isTimedOut(), () -> "tool timed out: " + result); assertEquals(1, result.getExitCode()); - assertLinesMatch(List.of( // - ">> HEAD >>", // - ".+DEBUG.+Cannot create Launcher without at least one TestEngine.+", // - ">> TAIL >>"), // - result.getOutputLines("out")); - assertLinesMatch(List.of( // - ">> HEAD >>", // - ".+ERROR.+FAILURE: Build failed with an exception.", // - ">> TAIL >>"), // - result.getOutputLines("err")); + assertThat(result.getOutputLines("err")) // + .contains("FAILURE: Build failed with an exception."); + + var htmlFile = FileUtils.findPath(Request.WORKSPACE.resolve(request.getWorkspace()), + "glob:**/build/reports/tests/test/classes/*.html"); + assertThat(htmlFile).content() // + .contains("Cannot create Launcher without at least one TestEngine"); } } From 108b69e6136ef8d3b05d5ac51441cfd846186fe2 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 20 Nov 2024 18:38:37 +0100 Subject: [PATCH 299/611] Use same Java version as main build to run Gradle in integration tests --- .../platform-tooling-support-tests.gradle.kts | 4 ++++ .../src/main/java/platform/tooling/support/Helper.java | 4 ++++ .../platform/tooling/support/tests/GraalVmStarterTests.java | 3 +++ .../tooling/support/tests/GradleKotlinExtensionsTests.java | 1 + .../tooling/support/tests/GradleMissingEngineTests.java | 1 + .../platform/tooling/support/tests/GradleStarterTests.java | 1 + .../tooling/support/tests/ReflectionCompatibilityTests.java | 1 + .../tooling/support/tests/VintageGradleIntegrationTests.java | 1 + 8 files changed, 16 insertions(+) diff --git a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts index cb6238017390..1b4ce951f443 100644 --- a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts +++ b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts @@ -170,6 +170,10 @@ tasks.test { } } jvmArgumentProviders += JavaHomeDir(project, 8, develocity.testDistribution.enabled) + + val gradleJavaVersion = JavaVersion.current().majorVersion.toInt() + jvmArgumentProviders += JavaHomeDir(project, gradleJavaVersion, develocity.testDistribution.enabled) + systemProperty("gradle.java.version", gradleJavaVersion) } class MavenRepo(project: Project, @get:Internal val repoDir: Provider) : CommandLineArgumentProvider { diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/Helper.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/Helper.java index 4bb2c6c73ad6..80867959a310 100644 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/Helper.java +++ b/platform-tooling-support-tests/src/main/java/platform/tooling/support/Helper.java @@ -114,6 +114,10 @@ public static List loadJarFiles() { return loadModuleDirectoryNames().stream().map(Helper::createJarFile).collect(Collectors.toList()); } + public static Optional getGradleJavaHome() { + return getJavaHome(System.getProperty("gradle.java.version")); + } + public static Optional getJavaHome(String version) { // First, try various system sources... var sources = Stream.of( // diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java index 71cadeedaf6c..7e17084628f4 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java @@ -24,7 +24,9 @@ import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; import org.junit.jupiter.api.extension.DisabledOnOpenJ9; import org.junit.jupiter.api.parallel.ResourceLock; +import org.opentest4j.TestAbortedException; +import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; import platform.tooling.support.Request; @@ -42,6 +44,7 @@ void runsTestsInNativeImage() { var request = Request.builder() // .setTool(new GradleWrapper(Paths.get(".."))) // .setProject(Projects.GRAALVM_STARTER) // + .setJavaHome(Helper.getGradleJavaHome().orElseThrow(TestAbortedException::new)) // .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("javaToolchains", "nativeTest", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java index 6c3631c327bd..672d1c031a4e 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java @@ -42,6 +42,7 @@ void gradle_wrapper() { .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // .setTimeout(TOOL_TIMEOUT) // .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // + .setJavaHome(Helper.getGradleJavaHome().orElseThrow(TestAbortedException::new)) // .build() // .run(); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java index 8f3a13bb4626..b78000f7b808 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java @@ -47,6 +47,7 @@ private void test(Tool gradle) { .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // + .setJavaHome(Helper.getGradleJavaHome().orElseThrow(TestAbortedException::new)) // .setTimeout(TOOL_TIMEOUT) // .build(); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java index ae13bc8e76aa..3b0cb3620040 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java @@ -44,6 +44,7 @@ void gradle_wrapper() { .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // .setTimeout(TOOL_TIMEOUT) // .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // + .setJavaHome(Helper.getGradleJavaHome().orElseThrow(TestAbortedException::new)) // .build(); var result = request.run(); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java index 82a73087ac4d..7744835cc548 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java @@ -43,6 +43,7 @@ void gradle_wrapper() { .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // .setTimeout(TOOL_TIMEOUT) // .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // + .setJavaHome(Helper.getGradleJavaHome().orElseThrow(TestAbortedException::new)) // .build(); var result = request.run(); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java index 4112efadd0f3..2028c9232d9d 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java @@ -58,6 +58,7 @@ private Result run(String version) { var result = Request.builder() // .setTool(new GradleWrapper(Paths.get(".."))) // .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // + .setJavaHome(Helper.getGradleJavaHome().orElseThrow(TestAbortedException::new)) // .setProject(Projects.VINTAGE) // .setWorkspace("vintage-gradle-" + version) // .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // From 0ebf125633ee12a57179bb69bfe0f7e97bd1fdd4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2024 17:48:11 +0000 Subject: [PATCH 300/611] Update codecov/codecov-action digest to 288befb (#4139) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ed22fcf21543..d7cf4cad52af 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,7 +39,7 @@ jobs: jacocoRootReport \ --no-configuration-cache # Disable configuration cache due to https://github.com/diffplug/spotless/issues/2318 - name: Upload to Codecov.io - uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5 + uses: codecov/codecov-action@288befbd1044bd1756afb0bdae077549e0ddb31f # v5 with: token: ${{ secrets.CODECOV_TOKEN }} From 1c2c637e3158a186af54a4c7d2d8926b2b52a81e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:29:29 +0000 Subject: [PATCH 301/611] Update github/codeql-action digest to f09c1c0 (#4141) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/ossf-scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 73559f7da546..e943e26bc2f6 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -34,7 +34,7 @@ jobs: - name: Check out repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Initialize CodeQL - uses: github/codeql-action/init@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3 + uses: github/codeql-action/init@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3 with: languages: ${{ matrix.language }} tools: linked @@ -47,4 +47,4 @@ jobs: -Dscan.tag.CodeQL \ allMainClasses - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3 + uses: github/codeql-action/analyze@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3 diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index 839051e5d1d0..ae94503b3b68 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard (optional). # Commenting out will disable upload of results to your repo's Code Scanning dashboard - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3 + uses: github/codeql-action/upload-sarif@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3 with: sarif_file: results.sarif From fc49cc13697f4379e8143506b1c8403cec8f2405 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 21 Nov 2024 00:44:19 +0000 Subject: [PATCH 302/611] Update dependency commons-io:commons-io to v2.18.0 (#4140) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6137ece2c17e..2240fcfd96af 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -34,7 +34,7 @@ bartholdy = { module = "de.sormuras:bartholdy", version = "0.2.3" } bndlib = { module = "biz.aQute.bnd:biz.aQute.bndlib", version.ref = "bnd" } checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checkstyle" } classgraph = { module = "io.github.classgraph:classgraph", version = "4.8.179" } -commons-io = { module = "commons-io:commons-io", version = "2.17.0" } +commons-io = { module = "commons-io:commons-io", version = "2.18.0" } groovy4 = { module = "org.apache.groovy:groovy", version = "4.0.24" } groovy2-bom = { module = "org.codehaus.groovy:groovy-bom", version = "2.5.23" } hamcrest = { module = "org.hamcrest:hamcrest", version = "3.0" } From 56fa6b96a86285aeb4176f1aefaf3ea95235d034 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 21 Nov 2024 08:51:58 +0000 Subject: [PATCH 303/611] Update codecov/codecov-action digest to 015f24e (#4143) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d7cf4cad52af..0db6c7784251 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,7 +39,7 @@ jobs: jacocoRootReport \ --no-configuration-cache # Disable configuration cache due to https://github.com/diffplug/spotless/issues/2318 - name: Upload to Codecov.io - uses: codecov/codecov-action@288befbd1044bd1756afb0bdae077549e0ddb31f # v5 + uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5 with: token: ${{ secrets.CODECOV_TOKEN }} From 5769444e993a18359399eafd790606a05ef08d71 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 21 Nov 2024 09:01:08 +0000 Subject: [PATCH 304/611] Update dependency gradle to v8.11.1 --- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 82dd18b2043e..eb1a55be0e15 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=57dafb5c2622c6cc08b993c85b7c06956a2f53536432a30ead46166dbca0f1e9 -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip +distributionSha256Sum=f397b287023acdba1e9f6fc5ea72d22dd63669d59ed4a289a29b1a76eee151c6 +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME From ad0ef2e6c492aaa0bae21c46cf03fdcd087e27df Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 22 Nov 2024 15:44:25 +0000 Subject: [PATCH 305/611] Update log4j2 monorepo to v2.24.2 (#4145) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2240fcfd96af..fdc57f292dab 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -13,7 +13,7 @@ jmh = "1.37" junit4 = "4.13.2" junit4Min = "4.12" ktlint = "1.4.1" -log4j = "2.24.1" +log4j = "2.24.2" mockito = "5.14.2" opentest4j = "1.3.0" openTestReporting = "0.1.0-SNAPSHOT" From 0ce9aca2a47f4496e537ad2e516a7634f8c0e8f9 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sat, 23 Nov 2024 13:01:47 +0100 Subject: [PATCH 306/611] Configure toolchain repositories to avoid deprecation warning --- .../projects/graalvm-starter/settings.gradle.kts | 4 ++++ .../projects/gradle-kotlin-extensions/settings.gradle.kts | 4 ++++ .../projects/gradle-missing-engine/settings.gradle.kts | 4 ++++ .../projects/gradle-starter/settings.gradle.kts | 4 ++++ .../projects/reflection-tests/settings.gradle.kts | 4 ++++ .../projects/vintage/settings.gradle.kts | 4 ++++ 6 files changed, 24 insertions(+) diff --git a/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts b/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts index ef491d025954..6b9636ea6529 100644 --- a/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts +++ b/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts @@ -8,4 +8,8 @@ pluginManagement { } } +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" +} + rootProject.name = "graalvm-starter" diff --git a/platform-tooling-support-tests/projects/gradle-kotlin-extensions/settings.gradle.kts b/platform-tooling-support-tests/projects/gradle-kotlin-extensions/settings.gradle.kts index 7a052453781c..7836e6f5ba89 100644 --- a/platform-tooling-support-tests/projects/gradle-kotlin-extensions/settings.gradle.kts +++ b/platform-tooling-support-tests/projects/gradle-kotlin-extensions/settings.gradle.kts @@ -1 +1,5 @@ +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" +} + rootProject.name = "gradle-kotlin-extensions" diff --git a/platform-tooling-support-tests/projects/gradle-missing-engine/settings.gradle.kts b/platform-tooling-support-tests/projects/gradle-missing-engine/settings.gradle.kts index c68450bb3bf5..366bca2588d1 100644 --- a/platform-tooling-support-tests/projects/gradle-missing-engine/settings.gradle.kts +++ b/platform-tooling-support-tests/projects/gradle-missing-engine/settings.gradle.kts @@ -1 +1,5 @@ +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" +} + rootProject.name = "gradle-missing-engine" diff --git a/platform-tooling-support-tests/projects/gradle-starter/settings.gradle.kts b/platform-tooling-support-tests/projects/gradle-starter/settings.gradle.kts index 481940859cf9..e818a8e04116 100644 --- a/platform-tooling-support-tests/projects/gradle-starter/settings.gradle.kts +++ b/platform-tooling-support-tests/projects/gradle-starter/settings.gradle.kts @@ -1 +1,5 @@ +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" +} + rootProject.name = "gradle-starter" diff --git a/platform-tooling-support-tests/projects/reflection-tests/settings.gradle.kts b/platform-tooling-support-tests/projects/reflection-tests/settings.gradle.kts index af17e8f41649..38c95bf52810 100644 --- a/platform-tooling-support-tests/projects/reflection-tests/settings.gradle.kts +++ b/platform-tooling-support-tests/projects/reflection-tests/settings.gradle.kts @@ -1 +1,5 @@ +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" +} + rootProject.name = "reflection-tests" diff --git a/platform-tooling-support-tests/projects/vintage/settings.gradle.kts b/platform-tooling-support-tests/projects/vintage/settings.gradle.kts index f073959d096e..3674c8832dca 100644 --- a/platform-tooling-support-tests/projects/vintage/settings.gradle.kts +++ b/platform-tooling-support-tests/projects/vintage/settings.gradle.kts @@ -1 +1,5 @@ +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" +} + rootProject.name = "vintage" From 967e798c1079339a976641648fd264a4693dd200 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sat, 23 Nov 2024 13:57:39 +0100 Subject: [PATCH 307/611] Avoid trying to generate HTML reports when no tests have been run --- documentation/documentation.gradle.kts | 1 + .../main/kotlin/junitbuild.testing-conventions.gradle.kts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/documentation/documentation.gradle.kts b/documentation/documentation.gradle.kts index 2f1cff759cd1..45a5e949bdbd 100644 --- a/documentation/documentation.gradle.kts +++ b/documentation/documentation.gradle.kts @@ -176,6 +176,7 @@ tasks { generateOpenTestHtmlReport { mustRunAfter(consoleLauncherTest) + inputs.files(consoleLauncherTestEventXmlFiles).withPathSensitivity(RELATIVE).skipWhenEmpty() argumentProviders += CommandLineArgumentProvider { consoleLauncherTestEventXmlFiles.files.map { it.absolutePath }.toList() } diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts index 882c0f8cbbf1..e87b590297d7 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts @@ -1,7 +1,7 @@ import com.gradle.develocity.agent.gradle.internal.test.PredictiveTestSelectionConfigurationInternal import com.gradle.develocity.agent.gradle.test.PredictiveTestSelectionMode -import org.gradle.api.tasks.PathSensitivity.NONE +import org.gradle.api.tasks.PathSensitivity.RELATIVE import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL import org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED import org.gradle.internal.os.OperatingSystem @@ -41,7 +41,8 @@ val generateOpenTestHtmlReport by tasks.registering(JavaExec::class) { abstract class HtmlReportParameters : CommandLineArgumentProvider { @get:InputFiles - @get:PathSensitive(NONE) + @get:PathSensitive(RELATIVE) + @get:SkipWhenEmpty abstract val eventXmlFiles: ConfigurableFileCollection @get:OutputFile From c96feb2cfa26e7377cc2e3b9de2b57d1d1a2356c Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 18 Nov 2024 11:13:48 +0100 Subject: [PATCH 308/611] Update open-test-reporting dependency to 0.2.0-SNAPSHOT --- gradle/libs.versions.toml | 2 +- .../platform/reporting/open/xml/JUnitContributorTests.java | 2 +- .../open/xml/OpenTestReportGeneratingListenerTests.java | 6 +++--- .../java/platform/tooling/support/tests/XmlAssertions.java | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fdc57f292dab..2494b410f2e8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -16,7 +16,7 @@ ktlint = "1.4.1" log4j = "2.24.2" mockito = "5.14.2" opentest4j = "1.3.0" -openTestReporting = "0.1.0-SNAPSHOT" +openTestReporting = "0.2.0-SNAPSHOT" surefire = "3.5.2" xmlunit = "2.10.0" diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/JUnitContributorTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/JUnitContributorTests.java index 33fe331527a4..1bf1ee6fb0cc 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/JUnitContributorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/JUnitContributorTests.java @@ -26,7 +26,7 @@ public class JUnitContributorTests { void contributesJUnitSpecificMetadata(@TempDir Path tempDir) throws Exception { var xmlFile = Files.writeString(tempDir.resolve("report.xml"), """ - diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java index b1bf59ebffb1..466de4d072b4 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java @@ -61,9 +61,9 @@ void writesValidXmlReport() throws Exception { assertThat(validate(xmlFile)).isEmpty(); var expected = """ - diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java index 7e0987860245..916682afff79 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java @@ -34,8 +34,8 @@ static void verifyContainsExpectedStartedOpenTestReport(Path testResultsDir) { private static void verifyContent(Path xmlFile) { var expected = """ - From 3d731443ec95de8c27f6b72774440896412f8efa Mon Sep 17 00:00:00 2001 From: Hendrik <30866028+ky0n@users.noreply.github.com> Date: Sat, 23 Nov 2024 15:55:16 +0100 Subject: [PATCH 309/611] Fix test to allow Git origin URLs starting with `git@` (#4152) This occurred when using the SSH option to clone the repository. --- .../xml/OpenTestReportGeneratingListenerTests.java | 10 ++++++---- .../platform/tooling/support/tests/XmlAssertions.java | 8 +++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java index 466de4d072b4..eb4a1df8cb2a 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java @@ -24,6 +24,7 @@ import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; +import java.util.regex.Pattern; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; @@ -75,9 +76,9 @@ void writesValidXmlReport() throws Exception { ${xmlunit.ignore} ${xmlunit.ignore} - + ${xmlunit.ignore} - ${xmlunit.matchesRegex([0-9a-f]{40})} + ${xmlunit.matchesRegex#[0-9a-f]{40}#} ${xmlunit.ignore} @@ -104,7 +105,7 @@ void writesValidXmlReport() throws Exception { - ${xmlunit.matchesRegex(org\\.opentest4j\\.AssertionFailedError: failure message)} + ${xmlunit.matchesRegex#org\\.opentest4j\\.AssertionFailedError: failure message#} @@ -115,7 +116,8 @@ void writesValidXmlReport() throws Exception { """; XmlAssert.assertThat(xmlFile).and(expected) // - .withDifferenceEvaluator(new PlaceholderDifferenceEvaluator()) // + .withDifferenceEvaluator(new PlaceholderDifferenceEvaluator(Pattern.quote("${"), Pattern.quote("}"), + Pattern.quote("#"), Pattern.quote("#"), ",")) // .ignoreWhitespace() // .areIdentical(); } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java index 916682afff79..3f56478ef293 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java @@ -14,6 +14,7 @@ import java.io.UncheckedIOException; import java.nio.file.Files; import java.nio.file.Path; +import java.util.regex.Pattern; import org.xmlunit.assertj3.XmlAssert; import org.xmlunit.placeholder.PlaceholderDifferenceEvaluator; @@ -46,9 +47,9 @@ private static void verifyContent(Path xmlFile) { ${xmlunit.ignore} ${xmlunit.ignore} - + ${xmlunit.ignore} - ${xmlunit.matchesRegex([0-9a-f]{40})} + ${xmlunit.matchesRegex#[0-9a-f]{40}#} ${xmlunit.ignore} @@ -156,7 +157,8 @@ private static void verifyContent(Path xmlFile) { """; XmlAssert.assertThat(xmlFile).and(expected) // - .withDifferenceEvaluator(new PlaceholderDifferenceEvaluator()) // + .withDifferenceEvaluator(new PlaceholderDifferenceEvaluator(Pattern.quote("${"), Pattern.quote("}"), + Pattern.quote("#"), Pattern.quote("#"), ",")) // .ignoreWhitespace() // .areIdentical(); } From 945e4b9873ea554cdf7a932ac8a3c924bd6278db Mon Sep 17 00:00:00 2001 From: Filip Hrisafov Date: Sat, 23 Nov 2024 16:13:45 +0100 Subject: [PATCH 310/611] Remove JAVA_TOOL_OPTIONS when running platform tooling supports tests When a user has the JAVA_TOOL_OPTIONS set in their environment, java will print "Picked up JAVA_TOOL_OPTIONS: ..." on the error stream This leads to failure in some of the Platform Tooling Tests Co-authored-by: Marc Philipp --- .../platform-tooling-support-tests.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts index 1b4ce951f443..8e4ca649887c 100644 --- a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts +++ b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts @@ -140,6 +140,7 @@ tasks.test { dependsOn(normalizeMavenRepo) jvmArgumentProviders += MavenRepo(project, normalizeMavenRepo.map { it.destinationDir }) } + environment.remove("JAVA_TOOL_OPTIONS") jvmArgumentProviders += JarPath(project, thirdPartyJarsClasspath.get(), "thirdPartyJars") jvmArgumentProviders += JarPath(project, antJarsClasspath.get(), "antJars") From 65276137a8a84c3f9effdf8dd38f9b472511accb Mon Sep 17 00:00:00 2001 From: Ana-GNM <81617975+Anmavel@users.noreply.github.com> Date: Sat, 23 Nov 2024 16:38:02 +0100 Subject: [PATCH 311/611] Rename `requireArguments` to `allowZeroInvocations` (#4149) --- .../asciidoc/release-notes/release-notes-5.12.0-M1.adoc | 2 +- .../java/org/junit/jupiter/params/ParameterizedTest.java | 8 ++++---- .../junit/jupiter/params/ParameterizedTestExtension.java | 4 ++-- .../jupiter/params/ParameterizedTestExtensionTests.java | 2 +- .../jupiter/params/ParameterizedTestIntegrationTests.java | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 92c97ce8dab6..559a9a288649 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -85,7 +85,7 @@ JUnit repository on GitHub. * Extensions based on `TestTemplateInvocationContextProvider` can now allow returning zero invocation contexts by overriding the new `mayReturnZeroTestTemplateInvocationContexts` method. -* The new `@ParameterizedTest(requireArguments = false)` attribute allows to specify that +* The new `@ParameterizedTest(allowZeroInvocations = true)` attribute allows to specify that the absence of arguments is expected in some cases and should not cause a test failure. * Allow determining "shared resources" at runtime via the new `@ResourceLock#providers` attribute that accepts implementations of `ResourceLocksProvider`. diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java index 03741d19f1fd..a14309deb7eb 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java @@ -293,18 +293,18 @@ boolean autoCloseArguments() default true; /** - * Configure whether at least one set of arguments is required for this + * Configure whether zero invocations are allowed for this * parameterized test. * - *

    Set this attribute to {@code false} if the absence of arguments is + *

    Set this attribute to {@code true} if the absence of arguments is * expected in some cases and should not cause a test failure. * - *

    Defaults to {@code true}. + *

    Defaults to {@code false}. * * @since 5.12 */ @API(status = EXPERIMENTAL, since = "5.12") - boolean requireArguments() default true; + boolean allowZeroInvocations() default false; /** * Configure how the number of arguments provided by an {@link ArgumentsSource} are validated. diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java index 74ff653e15cc..8aed7644f2d8 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java @@ -86,7 +86,7 @@ public Stream provideTestTemplateInvocationContex return createInvocationContext(formatter, methodContext, arguments, invocationCount.intValue()); }) .onClose(() -> - Preconditions.condition(invocationCount.get() > 0 || !methodContext.annotation.requireArguments(), + Preconditions.condition(invocationCount.get() > 0 || methodContext.annotation.allowZeroInvocations(), "Configuration error: You must configure at least one set of arguments for this @ParameterizedTest")); // @formatter:on } @@ -94,7 +94,7 @@ public Stream provideTestTemplateInvocationContex @Override public boolean mayReturnZeroTestTemplateInvocationContexts(ExtensionContext extensionContext) { ParameterizedTestMethodContext methodContext = getMethodContext(extensionContext); - return !methodContext.annotation.requireArguments(); + return methodContext.annotation.allowZeroInvocations(); } private ParameterizedTestMethodContext getMethodContext(ExtensionContext extensionContext) { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java index f8d6dee01831..fcdd5a0a7583 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java @@ -325,7 +325,7 @@ void method() { static class TestCaseAllowNoArgumentsMethod { - @ParameterizedTest(requireArguments = false) + @ParameterizedTest(allowZeroInvocations = true) void method() { } } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java index 50c131c449b3..13739ea4e018 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java @@ -2422,7 +2422,7 @@ void testThatRequiresArguments(String argument) { fail("This test should not be executed, because no arguments are provided."); } - @ParameterizedTest(requireArguments = false) + @ParameterizedTest(allowZeroInvocations = true) @MethodSource("zeroArgumentsProvider") void testThatDoesNotRequireArguments(String argument) { fail("This test should not be executed, because no arguments are provided."); From 7bafb7e96f942a2fc31a817eaf839e71562d7b17 Mon Sep 17 00:00:00 2001 From: Juliette de Rancourt Date: Sat, 23 Nov 2024 16:41:23 +0100 Subject: [PATCH 312/611] Update documentation wording --- .../docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc | 2 +- .../main/java/org/junit/jupiter/params/ParameterizedTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 559a9a288649..e3802369cccc 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -86,7 +86,7 @@ JUnit repository on GitHub. invocation contexts by overriding the new `mayReturnZeroTestTemplateInvocationContexts` method. * The new `@ParameterizedTest(allowZeroInvocations = true)` attribute allows to specify that - the absence of arguments is expected in some cases and should not cause a test failure. + the absence of invocations is expected in some cases and should not cause a test failure. * Allow determining "shared resources" at runtime via the new `@ResourceLock#providers` attribute that accepts implementations of `ResourceLocksProvider`. * Extensions that implement `TestInstancePreConstructCallback`, `TestInstanceFactory`, diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java index a14309deb7eb..5dc2c3a88ad9 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java @@ -296,7 +296,7 @@ * Configure whether zero invocations are allowed for this * parameterized test. * - *

    Set this attribute to {@code true} if the absence of arguments is + *

    Set this attribute to {@code true} if the absence of invocations is * expected in some cases and should not cause a test failure. * *

    Defaults to {@code false}. From de40dbe56ab3fee1f77727055bda18bbf9bd8db3 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 25 Nov 2024 09:53:50 +0100 Subject: [PATCH 313/611] Ignore asdf configuration file --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index aa4aae75cc61..612c29c09076 100644 --- a/.gitignore +++ b/.gitignore @@ -31,5 +31,6 @@ gradle-app.setting coverage.db* .metadata /.sdkmanrc +/.tool-versions checksums* From b8b5dc462c6b56527e69576001b41f1ef73a8786 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 26 Nov 2024 08:55:08 +0100 Subject: [PATCH 314/611] Enable auto-flushing of output to fix `testfeed` details mode (#4153) Prior to this commit, `ConsoleLauncher` created `PrintWriters` that wouldn't flush automatically when `println` is called which stopped the `testfeed` details mode from being useful. Moreover, it didn't initialized them with the right `Charsets`. Now, we rely on Picocli's initialization again which does both correctly. --- .../release-notes-5.12.0-M1.adoc | 2 ++ .../junitbuild/exec/RunConsoleLauncher.kt | 18 ++++++++-- .../platform/console/ConsoleLauncher.java | 27 +++------------ .../console/options/CommandFacade.java | 18 ++++++++-- .../platform/console/options/MainCommand.java | 26 ++++++-------- .../console/options/OutputStreamConfig.java | 34 +++++++++++++++++++ .../console/ConsoleLauncherTests.java | 19 ++++------- .../console/ConsoleLauncherWrapper.java | 11 +++--- 8 files changed, 95 insertions(+), 60 deletions(-) create mode 100644 junit-platform-console/src/main/java/org/junit/platform/console/options/OutputStreamConfig.java diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index e3802369cccc..f5b6fda0ff31 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -18,6 +18,8 @@ JUnit repository on GitHub. * Fix support for disabling ANSI colors on the console when the `NO_COLOR` environment variable is available. +* Enable auto-flushing of output in the `ConsoleLauncher` to fix issues with buffering, + in particular when using the `--details=testfeed` option. [[release-notes-5.12.0-M1-junit-platform-deprecations-and-breaking-changes]] ==== Deprecations and Breaking Changes diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild/exec/RunConsoleLauncher.kt b/gradle/plugins/common/src/main/kotlin/junitbuild/exec/RunConsoleLauncher.kt index a92f31195ad2..896e76090c6f 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild/exec/RunConsoleLauncher.kt +++ b/gradle/plugins/common/src/main/kotlin/junitbuild/exec/RunConsoleLauncher.kt @@ -6,7 +6,13 @@ import org.gradle.api.file.ConfigurableFileCollection import org.gradle.api.plugins.JavaPluginExtension import org.gradle.api.provider.ListProperty import org.gradle.api.provider.Property -import org.gradle.api.tasks.* +import org.gradle.api.tasks.CacheableTask +import org.gradle.api.tasks.Classpath +import org.gradle.api.tasks.Input +import org.gradle.api.tasks.Internal +import org.gradle.api.tasks.Nested +import org.gradle.api.tasks.SourceSetContainer +import org.gradle.api.tasks.TaskAction import org.gradle.api.tasks.options.Option import org.gradle.jvm.toolchain.JavaLauncher import org.gradle.jvm.toolchain.JavaToolchainService @@ -16,7 +22,6 @@ import org.gradle.process.CommandLineArgumentProvider import org.gradle.process.ExecOperations import trackOperationSystemAsInput import java.io.ByteArrayOutputStream -import java.util.* import javax.inject.Inject @CacheableTask @@ -97,4 +102,13 @@ abstract class RunConsoleLauncher @Inject constructor(private val execOperations debugging.set(enabled) } + @Suppress("unused") + @Option( + option = "show-output", + description = "Show output" + ) + fun setShowOutput(showOutput: Boolean) { + hideOutput.set(!showOutput) + } + } diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/ConsoleLauncher.java b/junit-platform-console/src/main/java/org/junit/platform/console/ConsoleLauncher.java index 6ffd9ebefa5d..54345f061e2e 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/ConsoleLauncher.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/ConsoleLauncher.java @@ -30,36 +30,17 @@ public class ConsoleLauncher { public static void main(String... args) { - PrintWriter out = new PrintWriter(System.out); - PrintWriter err = new PrintWriter(System.err); - CommandResult result = run(out, err, args); + CommandResult result = newCommandFacade().run(args); System.exit(result.getExitCode()); } @API(status = INTERNAL, since = "1.0") public static CommandResult run(PrintWriter out, PrintWriter err, String... args) { - ConsoleLauncher consoleLauncher = new ConsoleLauncher(ConsoleTestExecutor::new, out, err); - return consoleLauncher.run(args); + return newCommandFacade().run(args, out, err); } - private final ConsoleTestExecutor.Factory consoleTestExecutorFactory; - private final PrintWriter out; - private final PrintWriter err; - - ConsoleLauncher(ConsoleTestExecutor.Factory consoleTestExecutorFactory, PrintWriter out, PrintWriter err) { - this.consoleTestExecutorFactory = consoleTestExecutorFactory; - this.out = out; - this.err = err; - } - - CommandResult run(String... args) { - try { - return new CommandFacade(consoleTestExecutorFactory).run(out, err, args); - } - finally { - out.flush(); - err.flush(); - } + private static CommandFacade newCommandFacade() { + return new CommandFacade(ConsoleTestExecutor::new); } } diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/CommandFacade.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/CommandFacade.java index a591a59abb70..b1690e279c96 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/CommandFacade.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/CommandFacade.java @@ -33,10 +33,24 @@ public CommandFacade(ConsoleTestExecutor.Factory consoleTestExecutorFactory) { this.consoleTestExecutorFactory = consoleTestExecutorFactory; } - public CommandResult run(PrintWriter out, PrintWriter err, String[] args) { + public CommandResult run(String[] args) { + return run(args, Optional.empty()); + } + + public CommandResult run(String[] args, PrintWriter out, PrintWriter err) { + try { + return run(args, Optional.of(new OutputStreamConfig(out, err))); + } + finally { + out.flush(); + err.flush(); + } + } + + private CommandResult run(String[] args, Optional outputStreamConfig) { Optional version = ManifestVersionProvider.getImplementationVersion(); System.setProperty("junit.docs.version", version.map(it -> it.endsWith("-SNAPSHOT") ? "snapshot" : it).orElse("current")); - return new MainCommand(consoleTestExecutorFactory).run(out, err, args); + return new MainCommand(consoleTestExecutorFactory).run(args, outputStreamConfig); } } diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/MainCommand.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/MainCommand.java index d4a86e807785..941a4976ea3e 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/MainCommand.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/MainCommand.java @@ -103,10 +103,11 @@ private Object runCommand(String subcommand, Optional triggeringOption) List args = new ArrayList<>(commandLine.getParseResult().expandedArgs()); triggeringOption.ifPresent(args::remove); - CommandResult result = runCommand(commandLine.getOut(), // - commandLine.getErr(), // + CommandResult result = runCommand( // + new CommandLine(command), // args.toArray(new String[0]), // - command); + Optional.of(new OutputStreamConfig(commandLine)) // + ); this.commandResult = result; printDeprecationWarning(subcommand, triggeringOption, commandLine); @@ -130,24 +131,19 @@ private static void printDeprecationWarning(String subcommand, Optional err.flush(); } - CommandResult run(PrintWriter out, PrintWriter err, String[] args) { + CommandResult run(String[] args, Optional outputStreamConfig) { CommandLine commandLine = new CommandLine(this) // .addSubcommand(new DiscoverTestsCommand(consoleTestExecutorFactory)) // .addSubcommand(new ExecuteTestsCommand(consoleTestExecutorFactory)) // .addSubcommand(new ListTestEnginesCommand()); - return runCommand(out, err, args, commandLine); + return runCommand(commandLine, args, outputStreamConfig); } - private static CommandResult runCommand(PrintWriter out, PrintWriter err, String[] args, Object command) { - return runCommand(out, err, args, new CommandLine(command)); - } - - private static CommandResult runCommand(PrintWriter out, PrintWriter err, String[] args, - CommandLine commandLine) { - int exitCode = BaseCommand.initialize(commandLine) // - .setOut(out) // - .setErr(err) // - .execute(args); + private static CommandResult runCommand(CommandLine commandLine, String[] args, + Optional outputStreamConfig) { + BaseCommand.initialize(commandLine); + outputStreamConfig.ifPresent(it -> it.applyTo(commandLine)); + int exitCode = commandLine.execute(args); return CommandResult.create(exitCode, getLikelyExecutedCommand(commandLine).getExecutionResult()); } diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/OutputStreamConfig.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/OutputStreamConfig.java new file mode 100644 index 000000000000..dd72ed9e9f0b --- /dev/null +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/OutputStreamConfig.java @@ -0,0 +1,34 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.console.options; + +import java.io.PrintWriter; + +import picocli.CommandLine; + +class OutputStreamConfig { + + private final PrintWriter out; + private final PrintWriter err; + + OutputStreamConfig(CommandLine commandLine) { + this(commandLine.getOut(), commandLine.getErr()); + } + + OutputStreamConfig(PrintWriter out, PrintWriter err) { + this.out = out; + this.err = err; + } + + void applyTo(CommandLine commandLine) { + commandLine.setOut(out).setErr(err); + } +} diff --git a/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherTests.java b/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherTests.java index ef30a6d3db59..f4fb02f4a935 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherTests.java @@ -22,7 +22,6 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.EmptySource; import org.junit.jupiter.params.provider.MethodSource; -import org.junit.platform.console.tasks.ConsoleTestExecutor; /** * @since 1.0 @@ -36,8 +35,7 @@ class ConsoleLauncherTests { @EmptySource @MethodSource("commandsWithEmptyOptionExitCodes") void displayHelp(String command) { - var consoleLauncher = new ConsoleLauncher(ConsoleTestExecutor::new, printSink, printSink); - var exitCode = consoleLauncher.run(command, "--help").getExitCode(); + var exitCode = ConsoleLauncher.run(printSink, printSink, command, "--help").getExitCode(); assertEquals(0, exitCode); assertThat(output()).contains("--help"); @@ -47,8 +45,7 @@ void displayHelp(String command) { @EmptySource @MethodSource("commandsWithEmptyOptionExitCodes") void displayVersion(String command) { - var consoleLauncher = new ConsoleLauncher(ConsoleTestExecutor::new, printSink, printSink); - var exitCode = consoleLauncher.run(command, "--version").getExitCode(); + var exitCode = ConsoleLauncher.run(printSink, printSink, command, "--version").getExitCode(); assertEquals(0, exitCode); assertThat(output()).contains("JUnit Platform Console Launcher"); @@ -57,8 +54,7 @@ void displayVersion(String command) { @ParameterizedTest(name = "{0}") @MethodSource("commandsWithEmptyOptionExitCodes") void displayBanner(String command) { - var consoleLauncher = new ConsoleLauncher(ConsoleTestExecutor::new, printSink, printSink); - consoleLauncher.run(command); + ConsoleLauncher.run(printSink, printSink, command); assertThat(output()).contains("Thanks for using JUnit!"); } @@ -66,8 +62,7 @@ void displayBanner(String command) { @ParameterizedTest(name = "{0}") @MethodSource("commandsWithEmptyOptionExitCodes") void disableBanner(String command, int expectedExitCode) { - var consoleLauncher = new ConsoleLauncher(ConsoleTestExecutor::new, printSink, printSink); - var exitCode = consoleLauncher.run(command, "--disable-banner").getExitCode(); + var exitCode = ConsoleLauncher.run(printSink, printSink, command, "--disable-banner").getExitCode(); assertEquals(expectedExitCode, exitCode); assertThat(output()).doesNotContain("Thanks for using JUnit!"); @@ -76,8 +71,7 @@ void disableBanner(String command, int expectedExitCode) { @ParameterizedTest(name = "{0}") @MethodSource("commandsWithEmptyOptionExitCodes") void executeWithUnknownCommandLineOption(String command) { - var consoleLauncher = new ConsoleLauncher(ConsoleTestExecutor::new, printSink, printSink); - var exitCode = consoleLauncher.run(command, "--all").getExitCode(); + var exitCode = ConsoleLauncher.run(printSink, printSink, command, "--all").getExitCode(); assertEquals(-1, exitCode); assertThat(output()).contains("Unknown option: '--all'").contains("Usage:"); @@ -90,8 +84,7 @@ private String output() { @ParameterizedTest(name = "{0}") @MethodSource("commandsWithEmptyOptionExitCodes") void executeWithoutCommandLineOptions(String command, int expectedExitCode) { - var consoleLauncher = new ConsoleLauncher(ConsoleTestExecutor::new, printSink, printSink); - var actualExitCode = consoleLauncher.run(command).getExitCode(); + var actualExitCode = ConsoleLauncher.run(printSink, printSink, command).getExitCode(); assertEquals(expectedExitCode, actualExitCode); } diff --git a/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherWrapper.java b/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherWrapper.java index 7ae6ba8fd921..0d2c240d8ea3 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherWrapper.java +++ b/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherWrapper.java @@ -17,6 +17,7 @@ import java.io.StringWriter; import java.util.Optional; +import org.junit.platform.console.options.CommandFacade; import org.junit.platform.console.tasks.ConsoleTestExecutor; /** @@ -26,16 +27,14 @@ class ConsoleLauncherWrapper { private final StringWriter out = new StringWriter(); private final StringWriter err = new StringWriter(); - private final ConsoleLauncher consoleLauncher; + private final ConsoleTestExecutor.Factory consoleTestExecutorFactory; ConsoleLauncherWrapper() { this(ConsoleTestExecutor::new); } private ConsoleLauncherWrapper(ConsoleTestExecutor.Factory consoleTestExecutorFactory) { - var outWriter = new PrintWriter(out, false); - var errWriter = new PrintWriter(err, false); - this.consoleLauncher = new ConsoleLauncher(consoleTestExecutorFactory, outWriter, errWriter); + this.consoleTestExecutorFactory = consoleTestExecutorFactory; } public ConsoleLauncherWrapperResult execute(String... args) { @@ -47,7 +46,9 @@ public ConsoleLauncherWrapperResult execute(int expectedExitCode, String... args } public ConsoleLauncherWrapperResult execute(Optional expectedCode, String... args) { - var result = consoleLauncher.run(args); + var outWriter = new PrintWriter(out, false); + var errWriter = new PrintWriter(err, false); + var result = new CommandFacade(consoleTestExecutorFactory).run(args, outWriter, errWriter); var code = result.getExitCode(); var outText = out.toString(); var errText = err.toString(); From af6b502e373a7f80150433e95aed5cd6af39e87b Mon Sep 17 00:00:00 2001 From: Vladimir Dmitrienko Date: Tue, 26 Nov 2024 09:28:19 +0100 Subject: [PATCH 315/611] Allow declaring exclusive resources for child nodes (#4151) Allow declaring "shared resources" for direct child nodes via the new `@ResourceLock(target = CHILDREN)` attribute. Using the `@ResourceLock(target = CHILDREN)` in a class-level annotation has the same semantics as adding an annotation with the same value and mode to each test method and nested test class declared in this class. This may improve parallelization when a test class declares a `READ` lock, but only a few methods hold a `READ_WRITE` lock. Resolves #3102. --------- Co-authored-by: Marc Philipp --- .../src/docs/asciidoc/link-attributes.adoc | 1 + .../release-notes-5.12.0-M1.adoc | 3 + .../asciidoc/user-guide/writing-tests.adoc | 24 +- .../ChildrenSharedResourcesDemo.java | 54 ++++ .../jupiter/api/parallel/ResourceLock.java | 39 ++- .../api/parallel/ResourceLockTarget.java | 49 ++++ .../ExclusiveResourceCollector.java | 11 +- .../descriptor/MethodBasedTestDescriptor.java | 12 +- .../engine/descriptor/ResourceLockAware.java | 8 +- .../ResourceLockAnnotationTests.java | 245 ++++++++++++++---- 10 files changed, 385 insertions(+), 61 deletions(-) create mode 100644 documentation/src/test/java/example/sharedresources/ChildrenSharedResourcesDemo.java create mode 100644 junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLockTarget.java diff --git a/documentation/src/docs/asciidoc/link-attributes.adoc b/documentation/src/docs/asciidoc/link-attributes.adoc index 46da6e279efd..33fb2881d2b5 100644 --- a/documentation/src/docs/asciidoc/link-attributes.adoc +++ b/documentation/src/docs/asciidoc/link-attributes.adoc @@ -128,6 +128,7 @@ endif::[] :Execution: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/parallel/Execution.html[@Execution] :Isolated: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/parallel/Isolated.html[@Isolated] :ResourceLock: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/parallel/ResourceLock.html[@ResourceLock] +:ResourceLockTarget: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/parallel/ResourceLockTarget.html[ResourceLockTarget] :ResourceLocksProvider: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/parallel/ResourceLocksProvider.html[ResourceLocksProvider] :Resources: {javadoc-root}/org.junit.jupiter.api/org/junit/jupiter/api/parallel/Resources.html[Resources] // Jupiter Extension APIs diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index f5b6fda0ff31..cd9cc2eab135 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -91,6 +91,9 @@ JUnit repository on GitHub. the absence of invocations is expected in some cases and should not cause a test failure. * Allow determining "shared resources" at runtime via the new `@ResourceLock#providers` attribute that accepts implementations of `ResourceLocksProvider`. +* Allow declaring "shared resources" for _direct_ child nodes via the new + `@ResourceLock(target = CHILDREN)` attribute. This may improve parallelization when + a test class declares a `READ` lock, but only a few methods hold a `READ_WRITE` lock. * Extensions that implement `TestInstancePreConstructCallback`, `TestInstanceFactory`, `TestInstancePostProcessor`, `ParameterResolver`, or `InvocationInterceptor` may override the `getTestInstantiationExtensionContextScope()` method to enable receiving diff --git a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc index 7b2914a95216..200673894b7a 100644 --- a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc +++ b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc @@ -2992,7 +2992,7 @@ Note that resources declared statically with `{ResourceLock}` annotation are com resources added dynamically by `{ResourceLocksProvider}` implementations. If the tests in the following example were run in parallel _without_ the use of -{ResourceLock}, they would be _flaky_. Sometimes they would pass, and at other times they +`{ResourceLock}`, they would be _flaky_. Sometimes they would pass, and at other times they would fail due to the inherent race condition of writing and then reading the same JVM System Property. @@ -3029,6 +3029,28 @@ include::{testDir}/example/sharedresources/StaticSharedResourcesDemo.java[tags=u include::{testDir}/example/sharedresources/DynamicSharedResourcesDemo.java[tags=user_guide] ---- +Also, "static" shared resources can be declared for _direct_ child nodes via the `target` +attribute in the `{ResourceLock}` annotation, the attribute accepts a value from +the `{ResourceLockTarget}` enum. + +Specifying `target = CHILDREN` in a class-level `{ResourceLock}` annotation +has the same semantics as adding an annotation with the same `value` and `mode` +to each test method and nested test class declared in this class. + +This may improve parallelization when a test class declares a `READ` lock, +but only a few methods hold a `READ_WRITE` lock. + +Tests in the following example would run in the `SAME_THREAD` if the `{ResourceLock}` +didn't have `target = CHILDREN`. This is because the test class declares a `READ` +shared resource, but one test method holds a `READ_WRITE` lock, +which would force the `SAME_THREAD` execution mode for all the test methods. + +[source,java] +.Declaring shared resources for child nodes with `target` attribute +---- +include::{testDir}/example/sharedresources/ChildrenSharedResourcesDemo.java[tags=user_guide] +---- + [[writing-tests-built-in-extensions]] === Built-in Extensions diff --git a/documentation/src/test/java/example/sharedresources/ChildrenSharedResourcesDemo.java b/documentation/src/test/java/example/sharedresources/ChildrenSharedResourcesDemo.java new file mode 100644 index 000000000000..5350b9ff02a0 --- /dev/null +++ b/documentation/src/test/java/example/sharedresources/ChildrenSharedResourcesDemo.java @@ -0,0 +1,54 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package example.sharedresources; + +import static org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT; +import static org.junit.jupiter.api.parallel.ResourceAccessMode.READ; +import static org.junit.jupiter.api.parallel.ResourceAccessMode.READ_WRITE; +import static org.junit.jupiter.api.parallel.ResourceLockTarget.CHILDREN; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.parallel.Execution; +import org.junit.jupiter.api.parallel.ResourceLock; + +// tag::user_guide[] +@Execution(CONCURRENT) +@ResourceLock(value = "a", mode = READ, target = CHILDREN) +public class ChildrenSharedResourcesDemo { + + @ResourceLock(value = "a", mode = READ_WRITE) + @Test + void test1() throws InterruptedException { + Thread.sleep(2000L); + } + + @Test + void test2() throws InterruptedException { + Thread.sleep(2000L); + } + + @Test + void test3() throws InterruptedException { + Thread.sleep(2000L); + } + + @Test + void test4() throws InterruptedException { + Thread.sleep(2000L); + } + + @Test + void test5() throws InterruptedException { + Thread.sleep(2000L); + } + +} +// end::user_guide[] diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLock.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLock.java index f32012e6871e..e78abdcb647d 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLock.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLock.java @@ -46,11 +46,14 @@ * *

    This annotation can be repeated to declare the use of multiple shared resources. * + *

    Uniqueness of a shared resource is identified by both {@link #value()} and + * {@link #mode()}. Duplicated shared resources do not cause errors. + * *

    Since JUnit Jupiter 5.4, this annotation is {@linkplain Inherited inherited} * within class hierarchies. * *

    Since JUnit Jupiter 5.12, this annotation supports adding shared resources - * dynamically at runtime via {@link ResourceLock#providers}. + * dynamically at runtime via {@link #providers}. * *

    Resources declared "statically" using {@link #value()} and {@link #mode()} * are combined with "dynamic" resources added via {@link #providers()}. @@ -58,9 +61,29 @@ * and resource "B" via a provider returning {@code new Lock("B")} will result * in two shared resources "A" and "B". * + *

    Since JUnit Jupiter 5.12, this annotation supports declaring "static" + * shared resources for direct child nodes via the {@link #target()} + * attribute. + * + *

    Using the {@link ResourceLockTarget#CHILDREN} in a class-level + * annotation has the same semantics as adding an annotation with the same + * {@link #value()} and {@link #mode()} to each test method and nested test + * class declared in this class. + * + *

    This may improve parallelization when a test class declares a + * {@link ResourceAccessMode#READ READ} lock, but only a few methods hold + * {@link ResourceAccessMode#READ_WRITE READ_WRITE} lock. + * + *

    Note that the {@code target = CHILDREN} means that + * {@link #value()} and {@link #mode()} no longer apply to a node + * declaring the annotation. However, the {@link #providers()} attribute + * remains applicable, and the target of "dynamic" shared resources + * added via implementations of {@link ResourceLocksProvider} is not changed. + * * @see Isolated * @see Resources * @see ResourceAccessMode + * @see ResourceLockTarget * @see ResourceLocks * @see ResourceLocksProvider * @since 5.3 @@ -92,6 +115,20 @@ */ ResourceAccessMode mode() default ResourceAccessMode.READ_WRITE; + /** + * The target of a resource created from {@link #value()} and {@link #mode()}. + * + *

    Defaults to {@link ResourceLockTarget#SELF SELF}. + * + *

    Note that using {@link ResourceLockTarget#CHILDREN} in + * a method-level annotation results in an exception. + * + * @see ResourceLockTarget + * @since 5.12 + */ + @API(status = EXPERIMENTAL, since = "5.12") + ResourceLockTarget target() default ResourceLockTarget.SELF; + /** * An array of one or more classes implementing {@link ResourceLocksProvider}. * diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLockTarget.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLockTarget.java new file mode 100644 index 000000000000..89aa97a67bf1 --- /dev/null +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLockTarget.java @@ -0,0 +1,49 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.api.parallel; + +import static org.apiguardian.api.API.Status.EXPERIMENTAL; + +import org.apiguardian.api.API; + +/** + * {@code ResourceLockTarget} is used to define the target of a shared resource. + * + * @since 5.12 + * @see ResourceLock#target() + */ +@API(status = EXPERIMENTAL, since = "5.12") +public enum ResourceLockTarget { + + /** + * Add a shared resource to the current node. + */ + SELF, + + /** + * Add a shared resource to the direct children of the current node. + * + *

    Examples of "parent - child" relationship in the context of + * {@link ResourceLockTarget}: + *

      + *
    • a test class + * - test methods and nested test classes declared in the class.
    • + *
    • a nested test class + * - test methods and nested test classes declared in the nested class. + *
    • + *
    • a test method + * - considered to have no children. Using {@code CHILDREN} for + * a test method results in an exception.
    • + *
    + */ + CHILDREN + +} diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExclusiveResourceCollector.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExclusiveResourceCollector.java index 42b1295b2221..53757a4be9e6 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExclusiveResourceCollector.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExclusiveResourceCollector.java @@ -10,6 +10,7 @@ package org.junit.jupiter.engine.descriptor; +import static org.junit.jupiter.api.parallel.ResourceLockTarget.SELF; import static org.junit.platform.commons.support.AnnotationSupport.findRepeatableAnnotations; import static org.junit.platform.commons.util.CollectionUtils.toUnmodifiableList; @@ -22,6 +23,7 @@ import org.junit.jupiter.api.parallel.ResourceAccessMode; import org.junit.jupiter.api.parallel.ResourceLock; +import org.junit.jupiter.api.parallel.ResourceLockTarget; import org.junit.jupiter.api.parallel.ResourceLocksProvider; import org.junit.platform.commons.JUnitException; import org.junit.platform.commons.util.ReflectionUtils; @@ -42,7 +44,7 @@ Stream getAllExclusiveResources( } @Override - public Stream getStaticResources() { + Stream getStaticResourcesFor(ResourceLockTarget target) { return Stream.empty(); } @@ -55,10 +57,10 @@ Stream getDynamicResources( Stream getAllExclusiveResources( Function> providerToLocks) { - return Stream.concat(getStaticResources(), getDynamicResources(providerToLocks)); + return Stream.concat(getStaticResourcesFor(SELF), getDynamicResources(providerToLocks)); } - abstract Stream getStaticResources(); + abstract Stream getStaticResourcesFor(ResourceLockTarget target); abstract Stream getDynamicResources( Function> providerToLocks); @@ -78,9 +80,10 @@ private static class DefaultExclusiveResourceCollector extends ExclusiveResource } @Override - public Stream getStaticResources() { + Stream getStaticResourcesFor(ResourceLockTarget target) { return annotations.stream() // .filter(annotation -> StringUtils.isNotBlank(annotation.value())) // + .filter(annotation -> annotation.target() == target) // .map(annotation -> new ExclusiveResource(annotation.value(), toLockMode(annotation.mode()))); } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodBasedTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodBasedTestDescriptor.java index 9c8e4bcb1ce3..95d9ecbf6035 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodBasedTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodBasedTestDescriptor.java @@ -11,6 +11,7 @@ package org.junit.jupiter.engine.descriptor; import static org.apiguardian.api.API.Status.INTERNAL; +import static org.junit.jupiter.api.parallel.ResourceLockTarget.CHILDREN; import static org.junit.jupiter.engine.descriptor.DisplayNameUtils.determineDisplayNameForMethod; import static org.junit.platform.commons.util.CollectionUtils.forEachInReverseOrder; @@ -27,6 +28,7 @@ import org.junit.jupiter.api.parallel.ResourceLocksProvider; import org.junit.jupiter.engine.config.JupiterConfiguration; import org.junit.jupiter.engine.execution.JupiterEngineExecutionContext; +import org.junit.platform.commons.JUnitException; import org.junit.platform.commons.logging.Logger; import org.junit.platform.commons.logging.LoggerFactory; import org.junit.platform.commons.util.ClassUtils; @@ -82,7 +84,15 @@ public final Set getTags() { @Override public ExclusiveResourceCollector getExclusiveResourceCollector() { // There's no need to cache this as this method should only be called once - return ExclusiveResourceCollector.from(getTestMethod()); + ExclusiveResourceCollector collector = ExclusiveResourceCollector.from(getTestMethod()); + + if (collector.getStaticResourcesFor(CHILDREN).findAny().isPresent()) { + String message = "'ResourceLockTarget.CHILDREN' is not supported for methods." + // + " Invalid method: " + getTestMethod(); + throw new JUnitException(message); + } + + return collector; } @Override diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ResourceLockAware.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ResourceLockAware.java index 858644d48520..8c50b188d0d2 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ResourceLockAware.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ResourceLockAware.java @@ -10,6 +10,8 @@ package org.junit.jupiter.engine.descriptor; +import static org.junit.jupiter.api.parallel.ResourceLockTarget.CHILDREN; + import java.util.ArrayDeque; import java.util.Deque; import java.util.Set; @@ -37,11 +39,15 @@ default Stream determineExclusiveResources() { return determineOwnExclusiveResources(); } + Stream parentStaticResourcesForChildren = ancestors.getLast() // + .getExclusiveResourceCollector().getStaticResourcesFor(CHILDREN); + Stream ancestorDynamicResources = ancestors.stream() // .map(ResourceLockAware::getExclusiveResourceCollector) // .flatMap(collector -> collector.getDynamicResources(this::evaluateResourceLocksProvider)); - return Stream.concat(ancestorDynamicResources, determineOwnExclusiveResources()); + return Stream.of(ancestorDynamicResources, parentStaticResourcesForChildren, determineOwnExclusiveResources())// + .flatMap(s -> s); } default Stream determineOwnExclusiveResources() { diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLockAnnotationTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLockAnnotationTests.java index e5f3d65fb099..6ba68bac7677 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLockAnnotationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLockAnnotationTests.java @@ -11,27 +11,46 @@ package org.junit.platform.engine.support.descriptor; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.util.Throwables.getRootCause; import static org.junit.platform.engine.support.hierarchical.ExclusiveResource.LockMode; +import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; +import static org.junit.platform.testkit.engine.EventConditions.finishedWithFailure; +import static org.junit.platform.testkit.engine.TestExecutionResultConditions.instanceOf; +import static org.junit.platform.testkit.engine.TestExecutionResultConditions.message; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.lang.reflect.Method; import java.util.Set; +import java.util.stream.Stream; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayNameGenerator; +import org.junit.jupiter.api.DynamicTest; import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.RepeatedTest; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestFactory; import org.junit.jupiter.api.parallel.ExecutionMode; import org.junit.jupiter.api.parallel.ResourceAccessMode; import org.junit.jupiter.api.parallel.ResourceLock; +import org.junit.jupiter.api.parallel.ResourceLockTarget; import org.junit.jupiter.api.parallel.ResourceLocksProvider; import org.junit.jupiter.engine.config.JupiterConfiguration; import org.junit.jupiter.engine.descriptor.ClassTestDescriptor; import org.junit.jupiter.engine.descriptor.NestedClassTestDescriptor; import org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +import org.junit.jupiter.params.provider.ValueSource; +import org.junit.platform.commons.JUnitException; +import org.junit.platform.engine.TestExecutionResult; import org.junit.platform.engine.UniqueId; +import org.junit.platform.engine.discovery.DiscoverySelectors; import org.junit.platform.engine.support.hierarchical.ExclusiveResource; +import org.junit.platform.testkit.engine.EngineTestKit; +import org.junit.platform.testkit.engine.Event; +import org.junit.platform.testkit.engine.Events; /** * Integration tests for {@link ResourceLock} and {@link ResourceLocksProvider}. @@ -64,7 +83,6 @@ void noSharedResources() { assertThat(methodResources).isEmpty(); var nestedClassResources = getNestedClassResources( - NoSharedResourcesTestCase.class, NoSharedResourcesTestCase.NestedClass.class ); assertThat(nestedClassResources).isEmpty(); @@ -86,16 +104,23 @@ void addSharedResourcesViaAnnotationValue() { SharedResourcesViaAnnotationValueTestCase.class ); assertThat(methodResources).containsExactlyInAnyOrder( + new ExclusiveResource("a3", LockMode.READ_WRITE), new ExclusiveResource("b1", LockMode.READ), new ExclusiveResource("b2", LockMode.READ_WRITE) ); var nestedClassResources = getNestedClassResources( - SharedResourcesViaAnnotationValueTestCase.class, SharedResourcesViaAnnotationValueTestCase.NestedClass.class ); assertThat(nestedClassResources).containsExactlyInAnyOrder( - new ExclusiveResource("c1", LockMode.READ), + new ExclusiveResource("a3", LockMode.READ_WRITE), + new ExclusiveResource("c1", LockMode.READ) + ); + + var nestedClassMethodResources = getMethodResources( + SharedResourcesViaAnnotationValueTestCase.NestedClass.class + ); + assertThat(nestedClassMethodResources).containsExactlyInAnyOrder( new ExclusiveResource("c2", LockMode.READ) ); // @formatter:on @@ -121,7 +146,6 @@ void addSharedResourcesViaAnnotationProviders() { ); var nestedClassResources = getNestedClassResources( - SharedResourcesViaAnnotationProvidersTestCase.class, SharedResourcesViaAnnotationProvidersTestCase.NestedClass.class ); assertThat(nestedClassResources).containsExactlyInAnyOrder( @@ -139,22 +163,23 @@ void addSharedResourcesViaAnnotationValueAndProviders() { ); assertThat(classResources).containsExactlyInAnyOrder( new ExclusiveResource("a1", LockMode.READ_WRITE), - new ExclusiveResource("a2", LockMode.READ) + new ExclusiveResource("a3", LockMode.READ) ); var methodResources = getMethodResources( SharedResourcesViaAnnotationValueAndProvidersTestCase.class ); assertThat(methodResources).containsExactlyInAnyOrder( + new ExclusiveResource("a2", LockMode.READ_WRITE), new ExclusiveResource("b1", LockMode.READ), new ExclusiveResource("b2", LockMode.READ) ); var nestedClassResources = getNestedClassResources( - SharedResourcesViaAnnotationValueAndProvidersTestCase.class, SharedResourcesViaAnnotationValueAndProvidersTestCase.NestedClass.class ); assertThat(nestedClassResources).containsExactlyInAnyOrder( + new ExclusiveResource("a2", LockMode.READ_WRITE), new ExclusiveResource("c1", LockMode.READ_WRITE), new ExclusiveResource("c2", LockMode.READ_WRITE), new ExclusiveResource("c3", LockMode.READ_WRITE) @@ -162,6 +187,52 @@ void addSharedResourcesViaAnnotationValueAndProviders() { // @formatter:on } + @Test + void sharedResourcesHavingTheSameValueAndModeAreDeduplicated() { + // @formatter:off + var methodResources = getMethodResources( + SharedResourcesHavingTheSameValueAndModeAreDeduplicatedTestCase.class + ); + assertThat(methodResources).containsExactlyInAnyOrder( + new ExclusiveResource("a1", LockMode.READ_WRITE) + ); + // @formatter:on + } + + @Test + void sharedResourcesHavingTheSameValueButDifferentModeAreNotDeduplicated() { + // @formatter:off + var methodResources = getMethodResources( + SharedResourcesHavingTheSameValueButDifferentModeAreNotDeduplicatedTestCase.class + ); + assertThat(methodResources).containsExactlyInAnyOrder( + new ExclusiveResource("a1", LockMode.READ), + new ExclusiveResource("a1", LockMode.READ_WRITE) + ); + // @formatter:on + } + + static Stream> testMethodsCanNotDeclareSharedResourcesForChildrenArguments() { + // @formatter:off + return Stream.of( + TestCanNotDeclareSharedResourcesForChildrenTestCase.class, + ParameterizedTestCanNotDeclareSharedResourcesForChildrenTestCase.class, + RepeatedTestCanNotDeclareSharedResourcesForChildrenTestCase.class, + TestFactoryCanNotDeclareSharedResourcesForChildrenTestCase.class + ); + // @formatter:on + } + + @ParameterizedTest + @MethodSource("testMethodsCanNotDeclareSharedResourcesForChildrenArguments") + void testMethodsCanNotDeclareSharedResourcesForChildren(Class testClass) { + var messageTemplate = "'ResourceLockTarget.CHILDREN' is not supported for methods. Invalid method: %s"; + assertThrowsJunitExceptionWithMessage( // + testClass, // + messageTemplate.formatted(getDeclaredTestMethod(testClass)) // + ); + } + @Test void emptyAnnotation() { // @formatter:off @@ -176,7 +247,6 @@ void emptyAnnotation() { assertThat(methodResources).isEmpty(); var nestedClassResources = getNestedClassResources( - EmptyAnnotationTestCase.class, EmptyAnnotationTestCase.NestedClass.class ); assertThat(nestedClassResources).isEmpty(); @@ -192,26 +262,49 @@ private ClassTestDescriptor getClassTestDescriptor(Class testClass) { } private Set getMethodResources(Class testClass) { + var descriptor = new TestMethodTestDescriptor( // + uniqueId, testClass, getDeclaredTestMethod(testClass), configuration // + ); + descriptor.setParent(getClassTestDescriptor(testClass)); + return descriptor.getExclusiveResources(); + } + + private static Method getDeclaredTestMethod(Class testClass) { try { - // @formatter:off - var descriptor = new TestMethodTestDescriptor( - uniqueId, testClass, testClass.getDeclaredMethod("test"), configuration - ); - // @formatter:on - descriptor.setParent(getClassTestDescriptor(testClass)); - return descriptor.getExclusiveResources(); + return testClass.getDeclaredMethod("test"); } catch (NoSuchMethodException e) { throw new RuntimeException(e); } } - private Set getNestedClassResources(Class testClass, Class nestedClass) { - var descriptor = new NestedClassTestDescriptor(uniqueId, nestedClass, configuration); - descriptor.setParent(getClassTestDescriptor(testClass)); + private Set getNestedClassResources(Class testClass) { + var descriptor = new NestedClassTestDescriptor(uniqueId, testClass, configuration); + descriptor.setParent(getClassTestDescriptor(testClass.getEnclosingClass())); return descriptor.getExclusiveResources(); } + private static void assertThrowsJunitExceptionWithMessage(Class testClass, String message) { + // @formatter:off + var events = execute(testClass); + assertThat(events.filter(finishedWithFailure(instanceOf(JUnitException.class))::matches)) + .hasSize(1) + .map(Event::getPayload) + .map(payload -> (TestExecutionResult) payload.orElseThrow()) + .map(payload -> getRootCause(payload.getThrowable().orElseThrow())) + .first() + .is(instanceOf(JUnitException.class)) + .has(message(message)); + // @formatter:on + } + + private static Events execute(Class testCase) { + var discoveryRequests = request() // + .selectors(DiscoverySelectors.selectClass(testCase)) // + .build(); + return EngineTestKit.execute("junit-jupiter", discoveryRequests).allEvents(); + } + // ------------------------------------------------------------------------- @SuppressWarnings("JUnitMalformedDeclaration") @@ -229,18 +322,23 @@ class NestedClass { @SuppressWarnings("JUnitMalformedDeclaration") @ResourceLock("a1") @ResourceLock(value = "a2", mode = ResourceAccessMode.READ_WRITE) + @ResourceLock(value = "a3", mode = ResourceAccessMode.READ_WRITE, target = ResourceLockTarget.CHILDREN) static class SharedResourcesViaAnnotationValueTestCase { @Test @ResourceLock(value = "b1", mode = ResourceAccessMode.READ) - @ResourceLock("b2") + @ResourceLock(value = "b2", target = ResourceLockTarget.SELF) void test() { } @Nested @ResourceLock(value = "c1", mode = ResourceAccessMode.READ) - @ResourceLock(value = "c2", mode = ResourceAccessMode.READ) + @ResourceLock(value = "c2", mode = ResourceAccessMode.READ, target = ResourceLockTarget.CHILDREN) class NestedClass { + + @Test + void test() { + } } } @@ -302,8 +400,12 @@ public Set provideForNestedClass(Class testClass) { @SuppressWarnings("JUnitMalformedDeclaration") @ResourceLock( // value = "a1", // - mode = ResourceAccessMode.READ_WRITE, // - providers = SharedResourcesViaAnnotationValueAndProvidersTestCase.ClassLevelProvider.class // + providers = SharedResourcesViaAnnotationValueAndProvidersTestCase.FirstClassLevelProvider.class // + ) + @ResourceLock( // + value = "a2", // + target = ResourceLockTarget.CHILDREN, // + providers = SharedResourcesViaAnnotationValueAndProvidersTestCase.SecondClassLevelProvider.class // ) static class SharedResourcesViaAnnotationValueAndProvidersTestCase { @@ -318,12 +420,15 @@ void test() { class NestedClass { } - static class ClassLevelProvider implements ResourceLocksProvider { + static class FirstClassLevelProvider implements ResourceLocksProvider { @Override public Set provideForClass(Class testClass) { - return Set.of(new Lock("a2", ResourceAccessMode.READ)); + return Set.of(new Lock("a3", ResourceAccessMode.READ)); } + } + + static class SecondClassLevelProvider implements ResourceLocksProvider { @Override public Set provideForMethod(Class testClass, Method testMethod) { @@ -346,51 +451,85 @@ public Set provideForNestedClass(Class testClass) { } @SuppressWarnings("JUnitMalformedDeclaration") - @ResourceLock - static class EmptyAnnotationTestCase { + @ResourceLock( // + value = "a1", // + target = ResourceLockTarget.CHILDREN, // + providers = SharedResourcesHavingTheSameValueAndModeAreDeduplicatedTestCase.Provider.class // + ) + static class SharedResourcesHavingTheSameValueAndModeAreDeduplicatedTestCase { @Test - @ResourceLock + @ResourceLock(value = "a1") void test() { } - @Nested - @ResourceLock - class NestedClass { + static class Provider implements ResourceLocksProvider { + + @Override + public Set provideForMethod(Class testClass, Method testMethod) { + return Set.of(new Lock("a1")); + } } } - static class NestedNestedTestCase { + @SuppressWarnings("JUnitMalformedDeclaration") + @ResourceLock(value = "a1", mode = ResourceAccessMode.READ_WRITE, target = ResourceLockTarget.CHILDREN) + static class SharedResourcesHavingTheSameValueButDifferentModeAreNotDeduplicatedTestCase { - @SuppressWarnings("JUnitMalformedDeclaration") - @Nested - @ResourceLock(providers = NestedNestedTestCase.Provider.class) - static class NestedClass { + @Test + @ResourceLock(value = "a1", mode = ResourceAccessMode.READ) + void test() { + } + } - @Nested - class NestedClassTwo { + @SuppressWarnings("JUnitMalformedDeclaration") + static class TestCanNotDeclareSharedResourcesForChildrenTestCase { - @Test - void test() { - } - } + @Test + @ResourceLock(value = "a1", target = ResourceLockTarget.CHILDREN) + void test() { } + } - static class Provider implements ResourceLocksProvider { - @Override - public Set provideForClass(Class testClass) { - return ResourceLocksProvider.super.provideForClass(testClass); - } + static class ParameterizedTestCanNotDeclareSharedResourcesForChildrenTestCase { - @Override - public Set provideForNestedClass(Class testClass) { - return ResourceLocksProvider.super.provideForNestedClass(testClass); - } + @ParameterizedTest + @ValueSource(ints = { 1, 2, 3 }) + @ResourceLock(value = "a1", target = ResourceLockTarget.CHILDREN) + void test() { + } + } - @Override - public Set provideForMethod(Class testClass, Method testMethod) { - return ResourceLocksProvider.super.provideForMethod(testClass, testMethod); - } + static class RepeatedTestCanNotDeclareSharedResourcesForChildrenTestCase { + + @RepeatedTest(5) + @ResourceLock(value = "a1", target = ResourceLockTarget.CHILDREN) + void test() { + } + } + + static class TestFactoryCanNotDeclareSharedResourcesForChildrenTestCase { + + @TestFactory + @ResourceLock(value = "a1", target = ResourceLockTarget.CHILDREN) + Stream test() { + return Stream.of(DynamicTest.dynamicTest("Dynamic test", () -> { + })); + } + } + + @SuppressWarnings("JUnitMalformedDeclaration") + @ResourceLock + static class EmptyAnnotationTestCase { + + @Test + @ResourceLock + void test() { + } + + @Nested + @ResourceLock + class NestedClass { } } From f7c8d66d1de442ae0ee8b9cfcdd779a0b89ef64c Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 26 Nov 2024 09:09:40 +0100 Subject: [PATCH 316/611] Simplify EngineTestKit usage --- .../descriptor/ResourceLockAnnotationTests.java | 11 +++++------ .../descriptor/ResourceLocksProviderTests.java | 14 +++++--------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLockAnnotationTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLockAnnotationTests.java index 6ba68bac7677..e6bfb813044f 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLockAnnotationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLockAnnotationTests.java @@ -12,8 +12,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.util.Throwables.getRootCause; +import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; import static org.junit.platform.engine.support.hierarchical.ExclusiveResource.LockMode; -import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; import static org.junit.platform.testkit.engine.EventConditions.finishedWithFailure; import static org.junit.platform.testkit.engine.TestExecutionResultConditions.instanceOf; import static org.junit.platform.testkit.engine.TestExecutionResultConditions.message; @@ -46,7 +46,6 @@ import org.junit.platform.commons.JUnitException; import org.junit.platform.engine.TestExecutionResult; import org.junit.platform.engine.UniqueId; -import org.junit.platform.engine.discovery.DiscoverySelectors; import org.junit.platform.engine.support.hierarchical.ExclusiveResource; import org.junit.platform.testkit.engine.EngineTestKit; import org.junit.platform.testkit.engine.Event; @@ -299,10 +298,10 @@ private static void assertThrowsJunitExceptionWithMessage(Class testClass, St } private static Events execute(Class testCase) { - var discoveryRequests = request() // - .selectors(DiscoverySelectors.selectClass(testCase)) // - .build(); - return EngineTestKit.execute("junit-jupiter", discoveryRequests).allEvents(); + return EngineTestKit.engine("junit-jupiter") // + .selectors(selectClass(testCase)) // + .execute() // + .allEvents(); } // ------------------------------------------------------------------------- diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLocksProviderTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLocksProviderTests.java index 3b60bc75569a..54bc7b1f45b6 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLocksProviderTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLocksProviderTests.java @@ -15,7 +15,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; -import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; +import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; import static org.junit.platform.testkit.engine.EventConditions.event; import static org.junit.platform.testkit.engine.EventConditions.finishedSuccessfully; import static org.junit.platform.testkit.engine.EventConditions.test; @@ -29,7 +29,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.parallel.ResourceLock; import org.junit.jupiter.api.parallel.ResourceLocksProvider; -import org.junit.platform.engine.discovery.DiscoverySelectors; import org.junit.platform.testkit.engine.EngineTestKit; import org.junit.platform.testkit.engine.Event; @@ -65,14 +64,11 @@ void methodLevelProviderInNestedClass() { } private Stream execute(Class testCase) { - // @formatter:off - var discoveryRequest = request() - .selectors(Stream.of(testCase).map(DiscoverySelectors::selectClass).toList()) - .build(); - return EngineTestKit.execute("junit-jupiter", discoveryRequest) - .allEvents() + return EngineTestKit.engine("junit-jupiter") // + .selectors(selectClass(testCase)) // + .execute() // + .allEvents() // .stream(); - // @formatter:on } // ------------------------------------------------------------------------- From c1a976e652e2e30bc7a8a6309bf2497ce96dbd16 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 26 Nov 2024 09:19:55 +0100 Subject: [PATCH 317/611] Move Jupiter-specific tests to jupiter-tests project --- .../junit-jupiter-api.gradle.kts | 2 ++ .../api}/AbstractEqualsAndHashCodeTests.java | 2 +- .../jupiter/api/parallel}/LockTests.java | 4 ++-- .../ResourceLockAnnotationTests.java | 24 ++++--------------- .../parallel}/ResourceLocksProviderTests.java | 15 ++++-------- .../engine/discovery/ClassSelectorTests.java | 2 +- .../ClasspathResourceSelectorTests.java | 2 +- .../discovery/ClasspathRootSelectorTests.java | 2 +- .../discovery/DirectorySelectorTests.java | 2 +- .../engine/discovery/FilePositionTests.java | 2 +- .../engine/discovery/FileSelectorTests.java | 2 +- .../engine/discovery/MethodSelectorTests.java | 2 +- .../engine/discovery/ModuleSelectorTests.java | 2 +- .../discovery/NestedClassSelectorTests.java | 2 +- .../discovery/NestedMethodSelectorTests.java | 2 +- .../discovery/PackageSelectorTests.java | 2 +- .../discovery/UniqueIdSelectorTests.java | 2 +- .../engine/discovery/UriSelectorTests.java | 2 +- .../descriptor/AbstractTestSourceTests.java | 2 +- 19 files changed, 28 insertions(+), 47 deletions(-) rename {platform-tests/src/test/java/org/junit/platform => junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api}/AbstractEqualsAndHashCodeTests.java (97%) rename {platform-tests/src/test/java/org/junit/platform/engine/support/descriptor => jupiter-tests/src/test/java/org/junit/jupiter/api/parallel}/LockTests.java (91%) rename {platform-tests/src/test/java/org/junit/platform/engine/support/descriptor => jupiter-tests/src/test/java/org/junit/jupiter/api/parallel}/ResourceLockAnnotationTests.java (94%) rename {platform-tests/src/test/java/org/junit/platform/engine/support/descriptor => jupiter-tests/src/test/java/org/junit/jupiter/api/parallel}/ResourceLocksProviderTests.java (94%) diff --git a/junit-jupiter-api/junit-jupiter-api.gradle.kts b/junit-jupiter-api/junit-jupiter-api.gradle.kts index bdf4c359550f..402b5323eb57 100644 --- a/junit-jupiter-api/junit-jupiter-api.gradle.kts +++ b/junit-jupiter-api/junit-jupiter-api.gradle.kts @@ -15,6 +15,8 @@ dependencies { compileOnly(kotlin("stdlib")) + testFixturesImplementation(libs.assertj) + osgiVerification(projects.junitJupiterEngine) osgiVerification(projects.junitPlatformLauncher) } diff --git a/platform-tests/src/test/java/org/junit/platform/AbstractEqualsAndHashCodeTests.java b/junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/AbstractEqualsAndHashCodeTests.java similarity index 97% rename from platform-tests/src/test/java/org/junit/platform/AbstractEqualsAndHashCodeTests.java rename to junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/AbstractEqualsAndHashCodeTests.java index d5693baaea2f..dde247cf8cdd 100644 --- a/platform-tests/src/test/java/org/junit/platform/AbstractEqualsAndHashCodeTests.java +++ b/junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/AbstractEqualsAndHashCodeTests.java @@ -8,7 +8,7 @@ * https://www.eclipse.org/legal/epl-v20.html */ -package org.junit.platform; +package org.junit.jupiter.api; import static org.assertj.core.api.Assertions.assertThat; diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/LockTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/LockTests.java similarity index 91% rename from platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/LockTests.java rename to jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/LockTests.java index c0cc1d0c3a7c..edfa5a2dffca 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/LockTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/LockTests.java @@ -8,15 +8,15 @@ * https://www.eclipse.org/legal/epl-v20.html */ -package org.junit.platform.engine.support.descriptor; +package org.junit.jupiter.api.parallel; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.parallel.ResourceAccessMode.READ; import static org.junit.jupiter.api.parallel.ResourceAccessMode.READ_WRITE; import static org.junit.jupiter.api.parallel.ResourceLocksProvider.Lock; +import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.Test; -import org.junit.platform.AbstractEqualsAndHashCodeTests; /** * Unit tests for {@link Lock}. diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLockAnnotationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/ResourceLockAnnotationTests.java similarity index 94% rename from platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLockAnnotationTests.java rename to jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/ResourceLockAnnotationTests.java index e6bfb813044f..16af5783e41c 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLockAnnotationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/ResourceLockAnnotationTests.java @@ -8,11 +8,10 @@ * https://www.eclipse.org/legal/epl-v20.html */ -package org.junit.platform.engine.support.descriptor; +package org.junit.jupiter.api.parallel; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.util.Throwables.getRootCause; -import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; import static org.junit.platform.engine.support.hierarchical.ExclusiveResource.LockMode; import static org.junit.platform.testkit.engine.EventConditions.finishedWithFailure; import static org.junit.platform.testkit.engine.TestExecutionResultConditions.instanceOf; @@ -31,11 +30,7 @@ import org.junit.jupiter.api.RepeatedTest; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestFactory; -import org.junit.jupiter.api.parallel.ExecutionMode; -import org.junit.jupiter.api.parallel.ResourceAccessMode; -import org.junit.jupiter.api.parallel.ResourceLock; -import org.junit.jupiter.api.parallel.ResourceLockTarget; -import org.junit.jupiter.api.parallel.ResourceLocksProvider; +import org.junit.jupiter.engine.AbstractJupiterTestEngineTests; import org.junit.jupiter.engine.config.JupiterConfiguration; import org.junit.jupiter.engine.descriptor.ClassTestDescriptor; import org.junit.jupiter.engine.descriptor.NestedClassTestDescriptor; @@ -47,16 +42,14 @@ import org.junit.platform.engine.TestExecutionResult; import org.junit.platform.engine.UniqueId; import org.junit.platform.engine.support.hierarchical.ExclusiveResource; -import org.junit.platform.testkit.engine.EngineTestKit; import org.junit.platform.testkit.engine.Event; -import org.junit.platform.testkit.engine.Events; /** * Integration tests for {@link ResourceLock} and {@link ResourceLocksProvider}. * * @since 5.12 */ -class ResourceLockAnnotationTests { +class ResourceLockAnnotationTests extends AbstractJupiterTestEngineTests { private static final UniqueId uniqueId = UniqueId.root("enigma", "foo"); @@ -283,9 +276,9 @@ private Set getNestedClassResources(Class testClass) { return descriptor.getExclusiveResources(); } - private static void assertThrowsJunitExceptionWithMessage(Class testClass, String message) { + private void assertThrowsJunitExceptionWithMessage(Class testClass, String message) { // @formatter:off - var events = execute(testClass); + var events = executeTestsForClass(testClass).allEvents(); assertThat(events.filter(finishedWithFailure(instanceOf(JUnitException.class))::matches)) .hasSize(1) .map(Event::getPayload) @@ -297,13 +290,6 @@ private static void assertThrowsJunitExceptionWithMessage(Class testClass, St // @formatter:on } - private static Events execute(Class testCase) { - return EngineTestKit.engine("junit-jupiter") // - .selectors(selectClass(testCase)) // - .execute() // - .allEvents(); - } - // ------------------------------------------------------------------------- @SuppressWarnings("JUnitMalformedDeclaration") diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLocksProviderTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/ResourceLocksProviderTests.java similarity index 94% rename from platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLocksProviderTests.java rename to jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/ResourceLocksProviderTests.java index 54bc7b1f45b6..4fcf6a5012ad 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ResourceLocksProviderTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/ResourceLocksProviderTests.java @@ -8,14 +8,13 @@ * https://www.eclipse.org/legal/epl-v20.html */ -package org.junit.platform.engine.support.descriptor; +package org.junit.jupiter.api.parallel; import static java.util.Collections.emptySet; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; -import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; import static org.junit.platform.testkit.engine.EventConditions.event; import static org.junit.platform.testkit.engine.EventConditions.finishedSuccessfully; import static org.junit.platform.testkit.engine.EventConditions.test; @@ -27,9 +26,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.parallel.ResourceLock; -import org.junit.jupiter.api.parallel.ResourceLocksProvider; -import org.junit.platform.testkit.engine.EngineTestKit; +import org.junit.jupiter.engine.AbstractJupiterTestEngineTests; import org.junit.platform.testkit.engine.Event; /** @@ -37,7 +34,7 @@ * * @since 5.12 */ -class ResourceLocksProviderTests { +class ResourceLocksProviderTests extends AbstractJupiterTestEngineTests { @Test void classLevelProvider() { @@ -64,11 +61,7 @@ void methodLevelProviderInNestedClass() { } private Stream execute(Class testCase) { - return EngineTestKit.engine("junit-jupiter") // - .selectors(selectClass(testCase)) // - .execute() // - .allEvents() // - .stream(); + return executeTestsForClass(testCase).allEvents().stream(); } // ------------------------------------------------------------------------- diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClassSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClassSelectorTests.java index 8799c8bf5a89..38ecc8de4058 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClassSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClassSelectorTests.java @@ -13,8 +13,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; +import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.Test; -import org.junit.platform.AbstractEqualsAndHashCodeTests; import org.junit.platform.commons.PreconditionViolationException; /** diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathResourceSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathResourceSelectorTests.java index ae696da1de20..a40e6d403e33 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathResourceSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathResourceSelectorTests.java @@ -10,8 +10,8 @@ package org.junit.platform.engine.discovery; +import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.Test; -import org.junit.platform.AbstractEqualsAndHashCodeTests; /** * Unit tests for {@link ClasspathResourceSelector}. diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathRootSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathRootSelectorTests.java index bfdb69c072e1..3060d2e02677 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathRootSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathRootSelectorTests.java @@ -12,8 +12,8 @@ import java.net.URI; +import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.Test; -import org.junit.platform.AbstractEqualsAndHashCodeTests; /** * Unit tests for {@link ClasspathRootSelector}. diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/DirectorySelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/DirectorySelectorTests.java index 1ae830d99289..d2af7189efb0 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/DirectorySelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/DirectorySelectorTests.java @@ -10,8 +10,8 @@ package org.junit.platform.engine.discovery; +import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.Test; -import org.junit.platform.AbstractEqualsAndHashCodeTests; /** * Unit tests for {@link DirectorySelector}. diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/FilePositionTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/FilePositionTests.java index e39acbeedf4d..96372167854a 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/FilePositionTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/FilePositionTests.java @@ -17,12 +17,12 @@ import java.util.stream.Stream; +import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import org.junit.platform.AbstractEqualsAndHashCodeTests; import org.junit.platform.commons.PreconditionViolationException; /** diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/FileSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/FileSelectorTests.java index 7c167b6bb966..1f22f64ca952 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/FileSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/FileSelectorTests.java @@ -10,8 +10,8 @@ package org.junit.platform.engine.discovery; +import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.Test; -import org.junit.platform.AbstractEqualsAndHashCodeTests; /** * Unit tests for {@link FileSelector}. diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/MethodSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/MethodSelectorTests.java index 21dafc77214a..8f4e15ec9123 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/MethodSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/MethodSelectorTests.java @@ -15,8 +15,8 @@ import java.util.stream.Stream; +import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.Test; -import org.junit.platform.AbstractEqualsAndHashCodeTests; import org.junit.platform.commons.JUnitException; import org.junit.platform.commons.PreconditionViolationException; diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ModuleSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ModuleSelectorTests.java index 9ea129728212..dddc6dd95a79 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ModuleSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ModuleSelectorTests.java @@ -10,8 +10,8 @@ package org.junit.platform.engine.discovery; +import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.Test; -import org.junit.platform.AbstractEqualsAndHashCodeTests; /** * Unit tests for {@link ModuleSelector}. diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedClassSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedClassSelectorTests.java index 4f73cb36ea5f..9f0610fbaefe 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedClassSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedClassSelectorTests.java @@ -15,8 +15,8 @@ import java.util.List; +import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.Test; -import org.junit.platform.AbstractEqualsAndHashCodeTests; import org.junit.platform.commons.PreconditionViolationException; /** diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedMethodSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedMethodSelectorTests.java index 33235ed769d8..abef6bdd12db 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedMethodSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedMethodSelectorTests.java @@ -15,8 +15,8 @@ import java.util.List; +import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.Test; -import org.junit.platform.AbstractEqualsAndHashCodeTests; import org.junit.platform.commons.PreconditionViolationException; /** diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/PackageSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/PackageSelectorTests.java index cff34011791a..c19dc147207b 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/PackageSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/PackageSelectorTests.java @@ -10,8 +10,8 @@ package org.junit.platform.engine.discovery; +import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.Test; -import org.junit.platform.AbstractEqualsAndHashCodeTests; /** * Unit tests for {@link PackageSelector}. diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/UniqueIdSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/UniqueIdSelectorTests.java index 98dedf083850..e765ea9e258f 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/UniqueIdSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/UniqueIdSelectorTests.java @@ -10,8 +10,8 @@ package org.junit.platform.engine.discovery; +import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.Test; -import org.junit.platform.AbstractEqualsAndHashCodeTests; import org.junit.platform.engine.UniqueId; /** diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/UriSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/UriSelectorTests.java index 76def76ec775..8e70e83d24da 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/UriSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/UriSelectorTests.java @@ -12,8 +12,8 @@ import java.net.URI; +import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.Test; -import org.junit.platform.AbstractEqualsAndHashCodeTests; /** * Unit tests for {@link UriSelector}. diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/AbstractTestSourceTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/AbstractTestSourceTests.java index 9ce87b9b47f2..ef290b46890a 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/AbstractTestSourceTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/AbstractTestSourceTests.java @@ -23,9 +23,9 @@ import java.io.Serializable; import java.util.stream.Stream; +import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.DynamicTest; import org.junit.jupiter.api.TestFactory; -import org.junit.platform.AbstractEqualsAndHashCodeTests; import org.junit.platform.engine.TestSource; /** From e3f2a099efc8044ee44c9a7576e10aa5e5994a12 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 26 Nov 2024 09:29:54 +0100 Subject: [PATCH 318/611] Convert test base class to custom assertion to promote best practices --- ...CodeTests.java => EqualsAndHashCodeAssertions.java} | 10 +++++++--- .../java/org/junit/jupiter/api/parallel/LockTests.java | 4 ++-- .../platform/engine/discovery/ClassSelectorTests.java | 4 ++-- .../discovery/ClasspathResourceSelectorTests.java | 5 +++-- .../engine/discovery/ClasspathRootSelectorTests.java | 5 +++-- .../engine/discovery/DirectorySelectorTests.java | 5 +++-- .../platform/engine/discovery/FilePositionTests.java | 4 ++-- .../platform/engine/discovery/FileSelectorTests.java | 5 +++-- .../platform/engine/discovery/MethodSelectorTests.java | 4 ++-- .../platform/engine/discovery/ModuleSelectorTests.java | 5 +++-- .../engine/discovery/NestedClassSelectorTests.java | 4 ++-- .../engine/discovery/NestedMethodSelectorTests.java | 4 ++-- .../engine/discovery/PackageSelectorTests.java | 5 +++-- .../engine/discovery/UniqueIdSelectorTests.java | 5 +++-- .../platform/engine/discovery/UriSelectorTests.java | 5 +++-- .../support/descriptor/AbstractTestSourceTests.java | 3 +-- .../engine/support/descriptor/ClassSourceTests.java | 1 + .../descriptor/ClasspathResourceSourceTests.java | 1 + .../support/descriptor/CompositeTestSourceTests.java | 1 + .../support/descriptor/DefaultUriSourceTests.java | 1 + .../engine/support/descriptor/FilePositionTests.java | 1 + .../support/descriptor/FileSystemSourceTests.java | 1 + .../engine/support/descriptor/MethodSourceTests.java | 1 + .../engine/support/descriptor/PackageSourceTests.java | 1 + 24 files changed, 52 insertions(+), 33 deletions(-) rename junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/{AbstractEqualsAndHashCodeTests.java => EqualsAndHashCodeAssertions.java} (81%) diff --git a/junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/AbstractEqualsAndHashCodeTests.java b/junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/EqualsAndHashCodeAssertions.java similarity index 81% rename from junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/AbstractEqualsAndHashCodeTests.java rename to junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/EqualsAndHashCodeAssertions.java index dde247cf8cdd..735f2425cc84 100644 --- a/junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/AbstractEqualsAndHashCodeTests.java +++ b/junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/EqualsAndHashCodeAssertions.java @@ -13,14 +13,18 @@ import static org.assertj.core.api.Assertions.assertThat; /** - * Abstract base class for unit tests that wish to test + * Assertions for unit tests that wish to test * {@link Object#equals(Object)} and {@link Object#hashCode()}. * * @since 1.3 */ -public abstract class AbstractEqualsAndHashCodeTests { +public class EqualsAndHashCodeAssertions { - protected final void assertEqualsAndHashCode(T equal1, T equal2, T different) { + private EqualsAndHashCodeAssertions() { + } + + @SuppressWarnings("EqualsWithItself") + public static void assertEqualsAndHashCode(T equal1, T equal2, T different) { assertThat(equal1).isNotNull(); assertThat(equal2).isNotNull(); assertThat(different).isNotNull(); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/LockTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/LockTests.java index edfa5a2dffca..3c61edfeecc6 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/LockTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/LockTests.java @@ -11,11 +11,11 @@ package org.junit.jupiter.api.parallel; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.EqualsAndHashCodeAssertions.assertEqualsAndHashCode; import static org.junit.jupiter.api.parallel.ResourceAccessMode.READ; import static org.junit.jupiter.api.parallel.ResourceAccessMode.READ_WRITE; import static org.junit.jupiter.api.parallel.ResourceLocksProvider.Lock; -import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.Test; /** @@ -23,7 +23,7 @@ * * @since 5.12 */ -class LockTests extends AbstractEqualsAndHashCodeTests { +class LockTests { @Test void readWriteModeSetByDefault() { diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClassSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClassSelectorTests.java index 38ecc8de4058..01d39c02d5a8 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClassSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClassSelectorTests.java @@ -12,8 +12,8 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.EqualsAndHashCodeAssertions.assertEqualsAndHashCode; -import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.Test; import org.junit.platform.commons.PreconditionViolationException; @@ -23,7 +23,7 @@ * @since 1.3 * @see DiscoverySelectorsTests */ -class ClassSelectorTests extends AbstractEqualsAndHashCodeTests { +class ClassSelectorTests { @Test void equalsAndHashCode() { diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathResourceSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathResourceSelectorTests.java index a40e6d403e33..a3b842048deb 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathResourceSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathResourceSelectorTests.java @@ -10,7 +10,8 @@ package org.junit.platform.engine.discovery; -import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; +import static org.junit.jupiter.api.EqualsAndHashCodeAssertions.assertEqualsAndHashCode; + import org.junit.jupiter.api.Test; /** @@ -19,7 +20,7 @@ * @since 1.3 * @see DiscoverySelectorsTests */ -class ClasspathResourceSelectorTests extends AbstractEqualsAndHashCodeTests { +class ClasspathResourceSelectorTests { @Test void equalsAndHashCode() { diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathRootSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathRootSelectorTests.java index 3060d2e02677..e9fef4739978 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathRootSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathRootSelectorTests.java @@ -10,9 +10,10 @@ package org.junit.platform.engine.discovery; +import static org.junit.jupiter.api.EqualsAndHashCodeAssertions.assertEqualsAndHashCode; + import java.net.URI; -import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.Test; /** @@ -21,7 +22,7 @@ * @since 1.3 * @see DiscoverySelectorsTests */ -class ClasspathRootSelectorTests extends AbstractEqualsAndHashCodeTests { +class ClasspathRootSelectorTests { @Test void equalsAndHashCode() throws Exception { diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/DirectorySelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/DirectorySelectorTests.java index d2af7189efb0..35d4d630b2ce 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/DirectorySelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/DirectorySelectorTests.java @@ -10,7 +10,8 @@ package org.junit.platform.engine.discovery; -import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; +import static org.junit.jupiter.api.EqualsAndHashCodeAssertions.assertEqualsAndHashCode; + import org.junit.jupiter.api.Test; /** @@ -19,7 +20,7 @@ * @since 1.3 * @see DiscoverySelectorsTests */ -class DirectorySelectorTests extends AbstractEqualsAndHashCodeTests { +class DirectorySelectorTests { @Test void equalsAndHashCode() { diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/FilePositionTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/FilePositionTests.java index 96372167854a..fe080a0eb816 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/FilePositionTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/FilePositionTests.java @@ -13,11 +13,11 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.EqualsAndHashCodeAssertions.assertEqualsAndHashCode; import static org.junit.jupiter.params.provider.Arguments.arguments; import java.util.stream.Stream; -import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -31,7 +31,7 @@ * @since 1.7 */ @DisplayName("FilePosition unit tests") -class FilePositionTests extends AbstractEqualsAndHashCodeTests { +class FilePositionTests { @Test @DisplayName("factory method preconditions") diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/FileSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/FileSelectorTests.java index 1f22f64ca952..a3f1fa718a64 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/FileSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/FileSelectorTests.java @@ -10,7 +10,8 @@ package org.junit.platform.engine.discovery; -import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; +import static org.junit.jupiter.api.EqualsAndHashCodeAssertions.assertEqualsAndHashCode; + import org.junit.jupiter.api.Test; /** @@ -19,7 +20,7 @@ * @since 1.3 * @see DiscoverySelectorsTests */ -class FileSelectorTests extends AbstractEqualsAndHashCodeTests { +class FileSelectorTests { @Test void equalsAndHashCode() { diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/MethodSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/MethodSelectorTests.java index 8f4e15ec9123..699073145f1c 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/MethodSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/MethodSelectorTests.java @@ -12,10 +12,10 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; +import static org.junit.jupiter.api.EqualsAndHashCodeAssertions.assertEqualsAndHashCode; import java.util.stream.Stream; -import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.Test; import org.junit.platform.commons.JUnitException; import org.junit.platform.commons.PreconditionViolationException; @@ -26,7 +26,7 @@ * @since 1.3 * @see DiscoverySelectorsTests */ -class MethodSelectorTests extends AbstractEqualsAndHashCodeTests { +class MethodSelectorTests { private static final String TEST_CASE_NAME = TestCase.class.getName(); diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ModuleSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ModuleSelectorTests.java index dddc6dd95a79..4ffc796b0c66 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ModuleSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ModuleSelectorTests.java @@ -10,7 +10,8 @@ package org.junit.platform.engine.discovery; -import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; +import static org.junit.jupiter.api.EqualsAndHashCodeAssertions.assertEqualsAndHashCode; + import org.junit.jupiter.api.Test; /** @@ -19,7 +20,7 @@ * @since 1.3 * @see DiscoverySelectorsTests */ -class ModuleSelectorTests extends AbstractEqualsAndHashCodeTests { +class ModuleSelectorTests { @Test void equalsAndHashCode() { diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedClassSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedClassSelectorTests.java index 9f0610fbaefe..42dd2baf1793 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedClassSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedClassSelectorTests.java @@ -12,10 +12,10 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.EqualsAndHashCodeAssertions.assertEqualsAndHashCode; import java.util.List; -import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.Test; import org.junit.platform.commons.PreconditionViolationException; @@ -25,7 +25,7 @@ * @since 1.6 * @see DiscoverySelectorsTests */ -class NestedClassSelectorTests extends AbstractEqualsAndHashCodeTests { +class NestedClassSelectorTests { @Test void equalsAndHashCode() { diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedMethodSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedMethodSelectorTests.java index abef6bdd12db..a351b90114fc 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedMethodSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedMethodSelectorTests.java @@ -12,10 +12,10 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.EqualsAndHashCodeAssertions.assertEqualsAndHashCode; import java.util.List; -import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.Test; import org.junit.platform.commons.PreconditionViolationException; @@ -25,7 +25,7 @@ * @since 1.6 * @see DiscoverySelectorsTests */ -class NestedMethodSelectorTests extends AbstractEqualsAndHashCodeTests { +class NestedMethodSelectorTests { @Test void equalsAndHashCode() { diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/PackageSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/PackageSelectorTests.java index c19dc147207b..72907ae2b931 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/PackageSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/PackageSelectorTests.java @@ -10,7 +10,8 @@ package org.junit.platform.engine.discovery; -import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; +import static org.junit.jupiter.api.EqualsAndHashCodeAssertions.assertEqualsAndHashCode; + import org.junit.jupiter.api.Test; /** @@ -19,7 +20,7 @@ * @since 1.3 * @see DiscoverySelectorsTests */ -class PackageSelectorTests extends AbstractEqualsAndHashCodeTests { +class PackageSelectorTests { @Test void equalsAndHashCode() { diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/UniqueIdSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/UniqueIdSelectorTests.java index e765ea9e258f..7266b1833832 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/UniqueIdSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/UniqueIdSelectorTests.java @@ -10,7 +10,8 @@ package org.junit.platform.engine.discovery; -import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; +import static org.junit.jupiter.api.EqualsAndHashCodeAssertions.assertEqualsAndHashCode; + import org.junit.jupiter.api.Test; import org.junit.platform.engine.UniqueId; @@ -20,7 +21,7 @@ * @since 1.3 * @see DiscoverySelectorsTests */ -class UniqueIdSelectorTests extends AbstractEqualsAndHashCodeTests { +class UniqueIdSelectorTests { @Test void equalsAndHashCode() { diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/UriSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/UriSelectorTests.java index 8e70e83d24da..179963809b6b 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/UriSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/UriSelectorTests.java @@ -10,9 +10,10 @@ package org.junit.platform.engine.discovery; +import static org.junit.jupiter.api.EqualsAndHashCodeAssertions.assertEqualsAndHashCode; + import java.net.URI; -import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.Test; /** @@ -21,7 +22,7 @@ * @since 1.3 * @see DiscoverySelectorsTests */ -class UriSelectorTests extends AbstractEqualsAndHashCodeTests { +class UriSelectorTests { @Test void equalsAndHashCode() throws Exception { diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/AbstractTestSourceTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/AbstractTestSourceTests.java index ef290b46890a..a2af378fadd6 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/AbstractTestSourceTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/AbstractTestSourceTests.java @@ -23,7 +23,6 @@ import java.io.Serializable; import java.util.stream.Stream; -import org.junit.jupiter.api.AbstractEqualsAndHashCodeTests; import org.junit.jupiter.api.DynamicTest; import org.junit.jupiter.api.TestFactory; import org.junit.platform.engine.TestSource; @@ -34,7 +33,7 @@ * * @since 1.0 */ -abstract class AbstractTestSourceTests extends AbstractEqualsAndHashCodeTests { +abstract class AbstractTestSourceTests { abstract Stream createSerializableInstances() throws Exception; diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ClassSourceTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ClassSourceTests.java index ef8b2b8d9a91..2915946c54b0 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ClassSourceTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ClassSourceTests.java @@ -12,6 +12,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.EqualsAndHashCodeAssertions.assertEqualsAndHashCode; import java.io.Serializable; import java.net.URI; diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ClasspathResourceSourceTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ClasspathResourceSourceTests.java index 1b861208a4ea..90335c81dbef 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ClasspathResourceSourceTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ClasspathResourceSourceTests.java @@ -12,6 +12,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.EqualsAndHashCodeAssertions.assertEqualsAndHashCode; import static org.junit.platform.engine.support.descriptor.ClasspathResourceSource.CLASSPATH_SCHEME; import java.net.URI; diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/CompositeTestSourceTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/CompositeTestSourceTests.java index 121000e5c961..2b32f485df8e 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/CompositeTestSourceTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/CompositeTestSourceTests.java @@ -12,6 +12,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.EqualsAndHashCodeAssertions.assertEqualsAndHashCode; import java.io.File; import java.util.ArrayList; diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DefaultUriSourceTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DefaultUriSourceTests.java index 1fe34b233a90..e67431ac93bd 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DefaultUriSourceTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DefaultUriSourceTests.java @@ -13,6 +13,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.EqualsAndHashCodeAssertions.assertEqualsAndHashCode; import java.net.URI; import java.util.stream.Stream; diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/FilePositionTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/FilePositionTests.java index af5562bc8f57..b50fd31d7e4b 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/FilePositionTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/FilePositionTests.java @@ -13,6 +13,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.EqualsAndHashCodeAssertions.assertEqualsAndHashCode; import static org.junit.jupiter.params.provider.Arguments.arguments; import java.util.stream.Stream; diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/FileSystemSourceTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/FileSystemSourceTests.java index fd205bc2c6dd..43a1bd9aae85 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/FileSystemSourceTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/FileSystemSourceTests.java @@ -12,6 +12,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.EqualsAndHashCodeAssertions.assertEqualsAndHashCode; import java.io.File; import java.util.stream.Stream; diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/MethodSourceTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/MethodSourceTests.java index 3b8984829a61..37df1266425f 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/MethodSourceTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/MethodSourceTests.java @@ -14,6 +14,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.EqualsAndHashCodeAssertions.assertEqualsAndHashCode; import java.io.Serializable; import java.lang.reflect.Method; diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/PackageSourceTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/PackageSourceTests.java index c9a752ca5a68..5bf3f8fd2a0b 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/PackageSourceTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/PackageSourceTests.java @@ -12,6 +12,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.EqualsAndHashCodeAssertions.assertEqualsAndHashCode; import java.io.Serializable; import java.util.stream.Stream; From dbd4e2ea28f94337385df74b8b37755428c3581c Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 26 Nov 2024 14:30:29 +0100 Subject: [PATCH 319/611] Allow attaching files to test results (#4138) Being able to attach files such as screenshots or extra log files to a test is useful to diagnose the outcome of tests. This PR adds an API for Jupiter test authors to do so (`TestReporter.publishFile`) and includes it when writing the Open Test Reporting XML output (in `OpenTestReportGeneratingListener`) via a new method on `TestExecutionListener`. Moreover, it adds `OutputDirectoryProvider` to `EngineDiscoveryRequest` so other engines can also attach files and write them to the same output directory and makes it available to `TestExecutionListener` implementations via `TestPlan`. The default location of the XML output is changed from `OUTPUT_DIR/junit-platform-events-*.xml` to `OUTPUT_DIR/open-test-report.xml`. The output directory can be made unique by using the `{uniqueNumber}` placeholder in the `junit.platform.reporting.output.dir` configuration parameter. --- documentation/documentation.gradle.kts | 3 +- .../src/docs/asciidoc/link-attributes.adoc | 2 + .../release-notes-5.12.0-M1.adoc | 7 ++ .../junit-platform-reporting.adoc | 49 +++++++---- .../asciidoc/user-guide/writing-tests.adoc | 5 +- .../test/java/example/TestReporterDemo.java | 18 ++++ .../junitbuild.testing-conventions.gradle.kts | 13 +-- .../org/junit/jupiter/api/TestReporter.java | 37 +++++++++ .../api/extension/ExtensionContext.java | 19 +++++ .../jupiter/engine/JupiterTestEngine.java | 4 +- .../config/CachingJupiterConfiguration.java | 6 ++ .../config/DefaultJupiterConfiguration.java | 11 ++- .../engine/config/JupiterConfiguration.java | 2 + .../descriptor/AbstractExtensionContext.java | 24 ++++++ .../engine/extension/DefaultTestReporter.java | 40 +++++++++ .../TestReporterParameterResolver.java | 2 +- .../console/tasks/ConsoleTestExecutor.java | 11 ++- .../tasks/DiscoveryRequestCreator.java | 15 ++-- .../console/tasks/FlatPrintingListener.java | 7 ++ .../platform/console/tasks/TreeNode.java | 7 ++ .../platform/console/tasks/TreePrinter.java | 10 +++ .../console/tasks/TreePrintingListener.java | 6 ++ .../tasks/VerboseTreePrintingListener.java | 6 ++ .../engine/EngineDiscoveryRequest.java | 18 +++- .../engine/EngineExecutionListener.java | 22 +++++ .../platform/engine/ExecutionRequest.java | 2 - .../platform/engine/reporting/FileEntry.java | 74 +++++++++++++++++ .../reporting/OutputDirectoryProvider.java | 47 +++++++++++ .../engine/reporting/ReportEntry.java | 4 +- .../jfr/FlightRecordingExecutionListener.java | 19 +++++ .../platform/launcher/LauncherConstants.java | 28 +++++++ .../launcher/TestExecutionListener.java | 13 +++ .../org/junit/platform/launcher/TestPlan.java | 25 +++++- .../CompositeEngineExecutionListener.java | 8 ++ .../core/CompositeTestExecutionListener.java | 8 ++ .../core/DefaultDiscoveryRequest.java | 13 ++- .../DelegatingEngineExecutionListener.java | 5 ++ .../core/EngineDiscoveryOrchestrator.java | 12 +-- .../core/EngineExecutionOrchestrator.java | 2 +- .../core/ExecutionListenerAdapter.java | 6 ++ .../HierarchicalOutputDirectoryProvider.java | 71 ++++++++++++++++ .../launcher/core/InternalTestPlan.java | 4 +- .../core/LauncherDiscoveryRequestBuilder.java | 39 ++++++++- .../core/LauncherDiscoveryResult.java | 18 ++-- .../launcher/listeners/OutputDir.java | 50 +++++++---- .../core/OutputDirectoryProviders.java | 29 +++++++ .../xml/OpenTestReportGeneratingListener.java | 17 +++- .../runner/JUnitPlatformRunnerListener.java | 6 ++ .../SuiteLauncherDiscoveryRequestBuilder.java | 7 ++ .../suite/engine/ClassSelectorResolver.java | 7 +- .../engine/DiscoverySelectorResolver.java | 3 +- .../suite/engine/SuiteTestDescriptor.java | 7 +- .../testkit/engine/EngineTestKit.java | 49 ++++++++++- .../junit/platform/testkit/engine/Event.java | 19 +++++ .../testkit/engine/EventConditions.java | 17 ++++ .../testkit/engine/EventStatistics.java | 15 ++++ .../platform/testkit/engine/EventType.java | 13 ++- .../junit/platform/testkit/engine/Events.java | 13 +++ .../testkit/engine/ExecutionRecorder.java | 13 +++ .../VintageTestEngineExecutionTests.java | 11 +-- jupiter-tests/jupiter-tests.gradle.kts | 1 + .../AbstractJupiterTestEngineTests.java | 6 +- .../junit/jupiter/engine/ReportingTests.java | 65 ++++++++++++--- .../DefaultJupiterConfigurationTests.java | 25 ++++-- .../descriptor/ExtensionContextTests.java | 4 +- .../TestInstanceLifecycleUtilsTests.java | 19 +++-- .../engine/extension/CloseablePathTests.java | 2 +- .../extension/DefaultTestReporterTests.java | 80 ++++++++++++++++++ .../ParameterizedTestExtensionTests.java | 6 ++ .../console/tasks/ColorPaletteTests.java | 3 +- .../tasks/DiscoveryRequestCreatorTests.java | 3 +- .../tasks/FlatPrintingListenerTests.java | 15 ++++ .../tasks/TestFeedPrintingListenerTests.java | 3 +- .../console/tasks/TreePrinterTests.java | 6 +- ... => VerboseTreePrintingListenerTests.java} | 13 ++- .../HierarchicalTestExecutorTests.java | 2 +- ...dingExecutionListenerIntegrationTests.java | 14 +++- .../platform/launcher/TestPlanTests.java | 10 ++- ...CompositeEngineExecutionListenerTests.java | 6 ++ .../CompositeTestExecutionListenerTests.java | 3 +- .../core/ExecutionListenerAdapterTests.java | 4 +- ...rarchicalOutputDirectoryProviderTests.java | 83 +++++++++++++++++++ .../launcher/listeners/OutputDirTests.java | 65 +++++++++------ .../listeners/SummaryGenerationTests.java | 3 +- .../legacy/LegacyReportingUtilsTests.java | 5 +- ...egacyXmlReportGeneratingListenerTests.java | 8 +- .../legacy/xml/XmlReportDataTests.java | 7 +- .../legacy/xml/XmlReportWriterTests.java | 19 +++-- ...OpenTestReportGeneratingListenerTests.java | 22 +++-- .../runner/JUnitPlatformRunnerTests.java | 13 +-- .../suite/engine/SuiteEngineTests.java | 30 +++++++ .../engine/SuiteTestDescriptorTests.java | 10 ++- .../engine/testcases/SingleTestTestCase.java | 6 +- .../uidtracking/gradle/groovy/build.gradle | 1 - .../groovy/sub-project/sub-project.gradle | 1 - .../gradle/kotlin/build.gradle.kts | 1 - .../kotlin/sub-project/sub-project.gradle.kts | 1 - .../listeners/uidtracking/maven/pom.xml | 1 - .../projects/graalvm-starter/build.gradle.kts | 2 + .../tooling/support/tests/XmlAssertions.java | 23 ++--- 100 files changed, 1376 insertions(+), 233 deletions(-) create mode 100644 junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultTestReporter.java create mode 100644 junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/FileEntry.java create mode 100644 junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/OutputDirectoryProvider.java create mode 100644 junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/HierarchicalOutputDirectoryProvider.java create mode 100644 junit-platform-launcher/src/testFixtures/java/org/junit/platform/launcher/core/OutputDirectoryProviders.java create mode 100644 jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/DefaultTestReporterTests.java rename platform-tests/src/test/java/org/junit/platform/console/tasks/{VerboseTreeListenerTests.java => VerboseTreePrintingListenerTests.java} (87%) create mode 100644 platform-tests/src/test/java/org/junit/platform/launcher/core/HierarchicalOutputDirectoryProviderTests.java delete mode 100644 platform-tests/src/test/resources/listeners/uidtracking/gradle/groovy/build.gradle delete mode 100644 platform-tests/src/test/resources/listeners/uidtracking/gradle/groovy/sub-project/sub-project.gradle delete mode 100644 platform-tests/src/test/resources/listeners/uidtracking/gradle/kotlin/build.gradle.kts delete mode 100644 platform-tests/src/test/resources/listeners/uidtracking/gradle/kotlin/sub-project/sub-project.gradle.kts delete mode 100644 platform-tests/src/test/resources/listeners/uidtracking/maven/pom.xml diff --git a/documentation/documentation.gradle.kts b/documentation/documentation.gradle.kts index 45a5e949bdbd..feeab7ed25f5 100644 --- a/documentation/documentation.gradle.kts +++ b/documentation/documentation.gradle.kts @@ -147,7 +147,7 @@ tasks { val consoleLauncherTestReportsDir = project.layout.buildDirectory.dir("console-launcher-test-results") val consoleLauncherTestEventXmlFiles = - files(consoleLauncherTestReportsDir.map { it.asFileTree.matching { include("junit-platform-events-*.xml") } }) + files(consoleLauncherTestReportsDir.map { it.asFileTree.matching { include("**/open-test-report.xml") } }) val consoleLauncherTest by registering(RunConsoleLauncher::class) { args.addAll("execute") @@ -157,7 +157,6 @@ tasks { argumentProviders.add(CommandLineArgumentProvider { listOf( "--reports-dir=${consoleLauncherTestReportsDir.get()}", - "--config=junit.platform.reporting.output.dir=${consoleLauncherTestReportsDir.get()}", ) }) args.addAll("--include-classname", ".*Tests") diff --git a/documentation/src/docs/asciidoc/link-attributes.adoc b/documentation/src/docs/asciidoc/link-attributes.adoc index 33fb2881d2b5..4010e54b7085 100644 --- a/documentation/src/docs/asciidoc/link-attributes.adoc +++ b/documentation/src/docs/asciidoc/link-attributes.adoc @@ -40,6 +40,7 @@ endif::[] :DiscoverySelectors_selectPackage: {javadoc-root}/org.junit.platform.engine/org/junit/platform/engine/discovery/DiscoverySelectors.html#selectPackage(java.lang.String)[selectPackage] :DiscoverySelectors_selectUniqueId: {javadoc-root}/org.junit.platform.engine/org/junit/platform/engine/discovery/DiscoverySelectors.html#selectUniqueId(java.lang.String)[selectUniqueId] :DiscoverySelectors_selectUri: {javadoc-root}/org.junit.platform.engine/org/junit/platform/engine/discovery/DiscoverySelectors.html#selectUri(java.lang.String)[selectUri] +:EngineDiscoveryRequest: {javadoc-root}/org.junit.platform.engine/org/junit/platform/engine/EngineDiscoveryRequest.html[EngineDiscoveryRequest] :FileSelector: {javadoc-root}/org.junit.platform.engine/org/junit/platform/engine/discovery/FileSelector.html[FileSelector] :HierarchicalTestEngine: {javadoc-root}/org.junit.platform.engine/org/junit/platform/engine/support/hierarchical/HierarchicalTestEngine.html[HierarchicalTestEngine] :IterationSelector: {javadoc-root}/org.junit.platform.engine/org/junit/platform/engine/discovery/IterationSelector.html[IterationSelector] @@ -47,6 +48,7 @@ endif::[] :ModuleSelector: {javadoc-root}/org.junit.platform.engine/org/junit/platform/engine/discovery/ModuleSelector.html[ModuleSelector] :NestedClassSelector: {javadoc-root}/org.junit.platform.engine/org/junit/platform/engine/discovery/NestedClassSelector.html[NestedClassSelector] :NestedMethodSelector: {javadoc-root}/org.junit.platform.engine/org/junit/platform/engine/discovery/NestedMethodSelector.html[NestedMethodSelector] +:OutputDirectoryProvider: {javadoc-root}/org.junit.platform.engine/org/junit/platform/engine/reporting/OutputDirectoryProvider.html[OutputDirectoryProvider] :PackageSelector: {javadoc-root}/org.junit.platform.engine/org/junit/platform/engine/discovery/PackageSelector.html[PackageSelector] :ParallelExecutionConfigurationStrategy: {javadoc-root}/org.junit.platform.engine/org/junit/platform/engine/support/hierarchical/ParallelExecutionConfigurationStrategy.html[ParallelExecutionConfigurationStrategy] :UniqueIdSelector: {javadoc-root}/org.junit.platform.engine/org/junit/platform/engine/discovery/UniqueIdSelector.html[UniqueIdSelector] diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index cd9cc2eab135..fe84142c29d7 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -40,11 +40,16 @@ JUnit repository on GitHub. `--select-file` and `--select-resource`. * `ConsoleLauncher` now accepts multiple values for all `--select` options. * Add `--select-unique-id` support to ConsoleLauncher. +* Add `getOutputDirectoryProvider()` method to `EngineDiscoveryRequest` and `TestPlan` to + allow test engines to publish/attach files to containers and tests by calling + `EngineExecutionListener.fileEntryPublished(...)`. Registered `TestExecutionListeners` + can then access these files by overriding the `fileEntryPublished(...)` method. * The following improvements have been made to the open-test-reporting XML output: - Information about the Git repository, the current branch, the commit hash, and the current worktree status are now included in the XML report, if applicable. - A section containing JUnit-specific metadata about each test/container to the HTML report is now written by open-test-reporting when added to the classpath/module path + - Information about published files is now included as attachments. [[release-notes-5.12.0-M1-junit-jupiter]] @@ -112,6 +117,8 @@ JUnit repository on GitHub. * When enabled via the `junit.jupiter.execution.timeout.threaddump.enabled` configuration parameter, an implementation of `PreInterruptCallback` is registered that writes a thread dump to `System.out` prior to interrupting a test thread due to a timeout. +* `TestReporter` now allows publishing files for a test method or test class which can be + used to include them in test reports, such as the Open Test Reporting format. [[release-notes-5.12.0-M1-junit-vintage]] diff --git a/documentation/src/docs/asciidoc/user-guide/advanced-topics/junit-platform-reporting.adoc b/documentation/src/docs/asciidoc/user-guide/advanced-topics/junit-platform-reporting.adoc index 287917904eea..310788bd1812 100644 --- a/documentation/src/docs/asciidoc/user-guide/advanced-topics/junit-platform-reporting.adoc +++ b/documentation/src/docs/asciidoc/user-guide/advanced-topics/junit-platform-reporting.adoc @@ -3,41 +3,46 @@ The `junit-platform-reporting` artifact contains `{TestExecutionListener}` implementations that generate XML test reports in two flavors: -<> and -<>. +<> and +<>. NOTE: The module also contains other `TestExecutionListener` implementations that can be used to build custom reporting. See <> for details. -[[junit-platform-reporting-legacy-xml]] -==== Legacy XML format +[[junit-platform-reporting-output-directory]] +==== Output Directory -`{LegacyXmlReportGeneratingListener}` generates a separate XML report for each root in the -`{TestPlan}`. Note that the generated XML format is compatible with the de facto standard -for JUnit 4 based test reports that was made popular by the Ant build system. +The JUnit Platform provides an `{OutputDirectoryProvider}` via +`{EngineDiscoveryRequest}` and `{TestPlan}` to registered <> +and <>, respectively. Its root directory can be +configured via the following <>: -The `LegacyXmlReportGeneratingListener` is used by the <> -as well. +`junit.platform.reporting.output.dir=`:: + Configure the output directory for reporting. By default, `build` is used if a Gradle + build script is found, and `target` if a Maven POM is found; otherwise, the current + working directory is used. + +To create a unique output directory per test run, you can use the `\{uniqueNumber}` +placeholder in the path. For example, `reports/junit-\{uniqueNumber}` will create +directories like `reports/junit-8803697269315188212`. This can be useful when using +Gradle's or Maven's parallel execution capabilities which create multiple JVM forks +that run concurrently. [[junit-platform-reporting-open-test-reporting]] -==== Open Test Reporting XML format +==== Open Test Reporting `{OpenTestReportGeneratingListener}` writes an XML report for the entire execution in the event-based format specified by {OpenTestReporting} which supports all features of the JUnit Platform such as hierarchical test structures, display names, tags, etc. The listener is auto-registered and can be configured via the following -<>: +<>: `junit.platform.reporting.open.xml.enabled=true|false`:: Enable/disable writing the report. -`junit.platform.reporting.output.dir=`:: - Configure the output directory for the reports. By default, `build` is used if a Gradle - build script is found, and `target` if a Maven POM is found; otherwise, the current - working directory is used. -If enabled, the listener creates an XML report file named -`junit-platform-events-.xml` per test run in the configured output directory. +If enabled, the listener creates an XML report file named `open-test-report.xml` in the +configured <>. TIP: The {OpenTestReportingCliTool} can be used to convert from the event-based format to the hierarchical format which is more human-readable. @@ -145,3 +150,13 @@ via the `--config-resource` option: $ java -jar junit-platform-console-standalone-{platform-version}.jar \ --config-resource=configuration.properties ---- + +[[junit-platform-reporting-legacy-xml]] +==== Legacy XML format + +`{LegacyXmlReportGeneratingListener}` generates a separate XML report for each root in the +`{TestPlan}`. Note that the generated XML format is compatible with the de facto standard +for JUnit 4 based test reports that was made popular by the Ant build system. + +The `LegacyXmlReportGeneratingListener` is used by the <> +as well. diff --git a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc index 200673894b7a..25a442d6c295 100644 --- a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc +++ b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc @@ -1077,8 +1077,9 @@ include::{testDir}/example/TestInfoDemo.java[tags=user_guide] * `{TestReporterParameterResolver}`: if a constructor or method parameter is of type `{TestReporter}`, the `TestReporterParameterResolver` will supply an instance of `TestReporter`. The `TestReporter` can be used to publish additional data about the - current test run. The data can be consumed via the `reportingEntryPublished()` method in - a `{TestExecutionListener}`, allowing it to be viewed in IDEs or included in reports. + current test run or attach files to it. The data can be consumed in a + `{TestExecutionListener}` via the `reportingEntryPublished()` or `fileEntryPublished()` + method, respectively. This allows them to be viewed in IDEs or included in reports. + In JUnit Jupiter you should use `TestReporter` where you used to print information to `stdout` or `stderr` in JUnit 4. Using `@RunWith(JUnitPlatform.class)` will output all diff --git a/documentation/src/test/java/example/TestReporterDemo.java b/documentation/src/test/java/example/TestReporterDemo.java index 7d9a3f35c206..bafc00f83a3e 100644 --- a/documentation/src/test/java/example/TestReporterDemo.java +++ b/documentation/src/test/java/example/TestReporterDemo.java @@ -10,11 +10,16 @@ package example; +import static java.util.Collections.singletonList; + +import java.nio.file.Files; +import java.nio.file.Path; import java.util.HashMap; import java.util.Map; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestReporter; +import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.api.parallel.Execution; import org.junit.jupiter.api.parallel.ExecutionMode; @@ -41,5 +46,18 @@ void reportMultipleKeyValuePairs(TestReporter testReporter) { testReporter.publishEntry(values); } + @Test + void reportFiles(TestReporter testReporter, @TempDir Path tempDir) throws Exception { + + testReporter.publishFile("test1.txt", file -> Files.write(file, singletonList("Test 1"))); + + Path existingFile = Files.write(tempDir.resolve("test2.txt"), singletonList("Test 2")); + testReporter.publishFile(existingFile); + + testReporter.publishFile("test3", dir -> { + Path nestedFile = Files.createDirectory(dir).resolve("nested.txt"); + Files.write(nestedFile, singletonList("Nested content")); + }); + } } // end::user_guide[] diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts index e87b590297d7..169d5756a10c 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts @@ -5,7 +5,6 @@ import org.gradle.api.tasks.PathSensitivity.RELATIVE import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL import org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED import org.gradle.internal.os.OperatingSystem -import java.nio.file.Files plugins { `java-library` @@ -31,7 +30,7 @@ val generateOpenTestHtmlReport by tasks.registering(JavaExec::class) { eventXmlFiles.from(tasks.withType().map { objects.fileTree() .from(it.reports.junitXml.outputLocation) - .include("junit-platform-events-*.xml") + .include("junit-*/open-test-report.xml") }) outputLocation = layout.buildDirectory.file("reports/open-test-report.html") } @@ -119,7 +118,7 @@ tasks.withType().configureEach { jvmArgumentProviders += CommandLineArgumentProvider { listOf( "-Djunit.platform.reporting.open.xml.enabled=true", - "-Djunit.platform.reporting.output.dir=${reports.junitXml.outputLocation.get().asFile.absolutePath}" + "-Djunit.platform.reporting.output.dir=${reports.junitXml.outputLocation.get().asFile.absolutePath}/junit-{uniqueNumber}", ) } @@ -127,10 +126,12 @@ tasks.withType().configureEach { classpath.from(javaAgentClasspath) } - val reportFiles = objects.fileTree().from(reports.junitXml.outputLocation).matching { include("junit-platform-events-*.xml") } + val reportDirTree = objects.fileTree().from(reports.junitXml.outputLocation) doFirst { - reportFiles.files.forEach { - Files.delete(it.toPath()) + reportDirTree.visit { + if (name.startsWith("junit-")) { + file.deleteRecursively() + } } } diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestReporter.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestReporter.java index ffcf580603ff..3039692b083f 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestReporter.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestReporter.java @@ -10,12 +10,17 @@ package org.junit.jupiter.api; +import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.STABLE; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.Collections; import java.util.Map; import org.apiguardian.api.API; +import org.junit.jupiter.api.function.ThrowingConsumer; /** * Parameters of type {@code TestReporter} can be injected into @@ -77,4 +82,36 @@ default void publishEntry(String value) { this.publishEntry("value", value); } + /** + * Publish the supplied file and attach it to the current test or container. + *

    + * The file will be copied to the report output directory replacing any + * potentially existing file with the same name. + * + * @param file the file to be attached; never {@code null} or blank + * @since 5.12 + */ + @API(status = EXPERIMENTAL, since = "5.12") + default void publishFile(Path file) { + publishFile(file.getFileName().toString(), path -> Files.copy(file, path, REPLACE_EXISTING)); + } + + /** + * Publish a file with the supplied name written by the supplied action and + * attach it to the current test or container. + *

    + * The {@link Path} passed to the supplied action will be relative to the + * report output directory, but it's up to the action to write the file or + * directory. + * + * @param fileName the name of the file to be attached; never {@code null} or blank + * and must not contain any path separators + * @param action the action to be executed to write the file; never {@code null} + * @since 5.12 + */ + @API(status = EXPERIMENTAL, since = "5.12") + default void publishFile(String fileName, ThrowingConsumer action) { + throw new UnsupportedOperationException(); + } + } diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtensionContext.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtensionContext.java index 44a3447a4e7b..36ef064bc17b 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtensionContext.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtensionContext.java @@ -10,10 +10,12 @@ package org.junit.jupiter.api.extension; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.STABLE; import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; +import java.nio.file.Path; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -25,6 +27,7 @@ import org.apiguardian.api.API; import org.junit.jupiter.api.TestInstance.Lifecycle; +import org.junit.jupiter.api.function.ThrowingConsumer; import org.junit.jupiter.api.parallel.ExecutionMode; import org.junit.platform.commons.PreconditionViolationException; import org.junit.platform.commons.support.ReflectionSupport; @@ -364,6 +367,22 @@ default void publishReportEntry(String value) { this.publishReportEntry("value", value); } + /** + * Publish a file with the supplied name written by the supplied action and + * attach it to the current test or container. + *

    + * The file will be resolved in the report output directory prior to + * invoking the supplied action. + * + * @param fileName the name of the file to be attached; never {@code null} or blank + * and must not contain any path separators + * @param action the action to be executed to write the file; never {@code null} + * @since 5.12 + * @see org.junit.platform.engine.EngineExecutionListener#fileEntryPublished + */ + @API(status = EXPERIMENTAL, since = "5.12") + void publishFile(String fileName, ThrowingConsumer action); + /** * Get the {@link Store} for the supplied {@link Namespace}. * diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/JupiterTestEngine.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/JupiterTestEngine.java index 94b13afd4548..a4f5ac7fa454 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/JupiterTestEngine.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/JupiterTestEngine.java @@ -63,8 +63,8 @@ public Optional getArtifactId() { @Override public TestDescriptor discover(EngineDiscoveryRequest discoveryRequest, UniqueId uniqueId) { - JupiterConfiguration configuration = new CachingJupiterConfiguration( - new DefaultJupiterConfiguration(discoveryRequest.getConfigurationParameters())); + JupiterConfiguration configuration = new CachingJupiterConfiguration(new DefaultJupiterConfiguration( + discoveryRequest.getConfigurationParameters(), discoveryRequest.getOutputDirectoryProvider())); JupiterEngineDescriptor engineDescriptor = new JupiterEngineDescriptor(uniqueId, configuration); new DiscoverySelectorResolver().resolveSelectors(discoveryRequest, engineDescriptor); return engineDescriptor; diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/CachingJupiterConfiguration.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/CachingJupiterConfiguration.java index f2e24ba494dc..09a98cd3e4ef 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/CachingJupiterConfiguration.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/CachingJupiterConfiguration.java @@ -30,6 +30,7 @@ import org.junit.jupiter.api.io.CleanupMode; import org.junit.jupiter.api.io.TempDirFactory; import org.junit.jupiter.api.parallel.ExecutionMode; +import org.junit.platform.engine.reporting.OutputDirectoryProvider; /** * Caching implementation of the {@link JupiterConfiguration} API. @@ -138,4 +139,9 @@ public ExtensionContextScope getDefaultTestInstantiationExtensionContextScope() DEFAULT_TEST_INSTANTIATION_EXTENSION_CONTEXT_SCOPE_PROPERTY_NAME, __ -> delegate.getDefaultTestInstantiationExtensionContextScope()); } + + @Override + public OutputDirectoryProvider getOutputDirectoryProvider() { + return delegate.getOutputDirectoryProvider(); + } } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/DefaultJupiterConfiguration.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/DefaultJupiterConfiguration.java index b72b0362e638..11d4e46d0c9c 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/DefaultJupiterConfiguration.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/DefaultJupiterConfiguration.java @@ -33,6 +33,7 @@ import org.junit.platform.commons.util.ClassNamePatternFilterUtils; import org.junit.platform.commons.util.Preconditions; import org.junit.platform.engine.ConfigurationParameters; +import org.junit.platform.engine.reporting.OutputDirectoryProvider; /** * Default implementation of the {@link JupiterConfiguration} API. @@ -67,10 +68,13 @@ public class DefaultJupiterConfiguration implements JupiterConfiguration { new EnumConfigurationParameterConverter<>(ExtensionContextScope.class, "extension context scope"); private final ConfigurationParameters configurationParameters; + private final OutputDirectoryProvider outputDirectoryProvider; - public DefaultJupiterConfiguration(ConfigurationParameters configurationParameters) { + public DefaultJupiterConfiguration(ConfigurationParameters configurationParameters, + OutputDirectoryProvider outputDirectoryProvider) { this.configurationParameters = Preconditions.notNull(configurationParameters, "ConfigurationParameters must not be null"); + this.outputDirectoryProvider = outputDirectoryProvider; } @Override @@ -156,4 +160,9 @@ public ExtensionContextScope getDefaultTestInstantiationExtensionContextScope() return extensionContextScopeConverter.get(configurationParameters, DEFAULT_TEST_INSTANTIATION_EXTENSION_CONTEXT_SCOPE_PROPERTY_NAME, ExtensionContextScope.DEFAULT); } + + @Override + public OutputDirectoryProvider getOutputDirectoryProvider() { + return outputDirectoryProvider; + } } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java index b342054c5cbf..ebfe5939e6ca 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java @@ -29,6 +29,7 @@ import org.junit.jupiter.api.io.TempDirFactory; import org.junit.jupiter.api.parallel.Execution; import org.junit.jupiter.api.parallel.ExecutionMode; +import org.junit.platform.engine.reporting.OutputDirectoryProvider; /** * @since 5.4 @@ -78,4 +79,5 @@ public interface JupiterConfiguration { ExtensionContextScope getDefaultTestInstantiationExtensionContextScope(); + OutputDirectoryProvider getOutputDirectoryProvider(); } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/AbstractExtensionContext.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/AbstractExtensionContext.java index 4ff9573a32b6..32fc7339582e 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/AbstractExtensionContext.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/AbstractExtensionContext.java @@ -13,6 +13,8 @@ import static java.util.stream.Collectors.collectingAndThen; import static java.util.stream.Collectors.toCollection; +import java.io.IOException; +import java.nio.file.Path; import java.util.Collections; import java.util.LinkedHashSet; import java.util.List; @@ -25,6 +27,7 @@ import org.junit.jupiter.api.extension.Extension; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource; +import org.junit.jupiter.api.function.ThrowingConsumer; import org.junit.jupiter.api.parallel.ExecutionMode; import org.junit.jupiter.engine.config.JupiterConfiguration; import org.junit.jupiter.engine.execution.DefaultExecutableInvoker; @@ -33,9 +36,11 @@ import org.junit.jupiter.engine.extension.ExtensionRegistry; import org.junit.platform.commons.JUnitException; import org.junit.platform.commons.util.Preconditions; +import org.junit.platform.commons.util.UnrecoverableExceptions; import org.junit.platform.engine.EngineExecutionListener; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.TestTag; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; import org.junit.platform.engine.support.hierarchical.Node; import org.junit.platform.engine.support.store.NamespacedHierarchicalStore; @@ -109,6 +114,25 @@ public void publishReportEntry(Map values) { this.engineExecutionListener.reportingEntryPublished(this.testDescriptor, ReportEntry.from(values)); } + @Override + public void publishFile(String fileName, ThrowingConsumer action) { + try { + Path dir = configuration.getOutputDirectoryProvider().createOutputDirectory(this.testDescriptor); + try { + Path file = dir.resolve(fileName); + action.accept(file); + this.engineExecutionListener.fileEntryPublished(this.testDescriptor, FileEntry.from(file)); + } + catch (Throwable t) { + UnrecoverableExceptions.rethrowIfUnrecoverable(t); + throw new JUnitException("Failed to publish file", t); + } + } + catch (IOException e) { + throw new JUnitException("Failed to create output directory", e); + } + } + @Override public Optional getParent() { return Optional.ofNullable(this.parent); diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultTestReporter.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultTestReporter.java new file mode 100644 index 000000000000..b776a0fe3b94 --- /dev/null +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultTestReporter.java @@ -0,0 +1,40 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.engine.extension; + +import java.nio.file.Path; +import java.util.Map; + +import org.junit.jupiter.api.TestReporter; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.function.ThrowingConsumer; + +/** + * @since 1.12 + */ +class DefaultTestReporter implements TestReporter { + + private final ExtensionContext extensionContext; + + DefaultTestReporter(ExtensionContext extensionContext) { + this.extensionContext = extensionContext; + } + + @Override + public void publishEntry(Map map) { + extensionContext.publishReportEntry(map); + } + + @Override + public void publishFile(String fileName, ThrowingConsumer action) { + extensionContext.publishFile(fileName, action); + } +} diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TestReporterParameterResolver.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TestReporterParameterResolver.java index c06536d448dc..5427d8029cf9 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TestReporterParameterResolver.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TestReporterParameterResolver.java @@ -34,7 +34,7 @@ public boolean supportsParameter(ParameterContext parameterContext, ExtensionCon @Override public TestReporter resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) { - return extensionContext::publishReportEntry; + return new DefaultTestReporter(extensionContext); } } diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/ConsoleTestExecutor.java b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/ConsoleTestExecutor.java index 1cdddf814e10..d7dc8f8aacff 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/ConsoleTestExecutor.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/ConsoleTestExecutor.java @@ -11,6 +11,8 @@ package org.junit.platform.console.tasks; import static org.apiguardian.api.API.Status.INTERNAL; +import static org.junit.platform.console.tasks.DiscoveryRequestCreator.toDiscoveryRequestBuilder; +import static org.junit.platform.launcher.LauncherConstants.OUTPUT_DIR_PROPERTY_NAME; import java.io.PrintWriter; import java.net.URL; @@ -32,6 +34,7 @@ import org.junit.platform.launcher.LauncherDiscoveryRequest; import org.junit.platform.launcher.TestExecutionListener; import org.junit.platform.launcher.TestPlan; +import org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder; import org.junit.platform.launcher.core.LauncherFactory; import org.junit.platform.launcher.listeners.SummaryGeneratingListener; import org.junit.platform.launcher.listeners.TestExecutionSummary; @@ -75,7 +78,7 @@ private void discoverTests(PrintWriter out) { Launcher launcher = launcherSupplier.get(); Optional commandLineTestPrinter = createDetailsPrintingListener(out); - LauncherDiscoveryRequest discoveryRequest = new DiscoveryRequestCreator().toDiscoveryRequest(discoveryOptions); + LauncherDiscoveryRequest discoveryRequest = toDiscoveryRequestBuilder(discoveryOptions).build(); TestPlan testPlan = launcher.discover(discoveryRequest); commandLineTestPrinter.ifPresent(printer -> printer.listTests(testPlan)); @@ -98,8 +101,10 @@ private TestExecutionSummary executeTests(PrintWriter out, Optional report Launcher launcher = launcherSupplier.get(); SummaryGeneratingListener summaryListener = registerListeners(out, reportsDir, launcher); - LauncherDiscoveryRequest discoveryRequest = new DiscoveryRequestCreator().toDiscoveryRequest(discoveryOptions); - launcher.execute(discoveryRequest); + LauncherDiscoveryRequestBuilder discoveryRequestBuilder = toDiscoveryRequestBuilder(discoveryOptions); + reportsDir.ifPresent(dir -> discoveryRequestBuilder.configurationParameter(OUTPUT_DIR_PROPERTY_NAME, + dir.toAbsolutePath().toString())); + launcher.execute(discoveryRequestBuilder.build()); TestExecutionSummary summary = summaryListener.getSummary(); if (summary.getTotalFailureCount() > 0 || outputOptions.getDetails() != Details.NONE) { diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/DiscoveryRequestCreator.java b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/DiscoveryRequestCreator.java index 6cbbfa039d6b..25af8a62a0d7 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/DiscoveryRequestCreator.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/DiscoveryRequestCreator.java @@ -42,7 +42,6 @@ import org.junit.platform.engine.discovery.ClasspathRootSelector; import org.junit.platform.engine.discovery.IterationSelector; import org.junit.platform.engine.discovery.MethodSelector; -import org.junit.platform.launcher.LauncherDiscoveryRequest; import org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder; /** @@ -50,7 +49,7 @@ */ class DiscoveryRequestCreator { - LauncherDiscoveryRequest toDiscoveryRequest(TestDiscoveryOptions options) { + static LauncherDiscoveryRequestBuilder toDiscoveryRequestBuilder(TestDiscoveryOptions options) { LauncherDiscoveryRequestBuilder requestBuilder = request(); List selectors = createDiscoverySelectors(options); requestBuilder.selectors(selectors); @@ -58,10 +57,10 @@ LauncherDiscoveryRequest toDiscoveryRequest(TestDiscoveryOptions options) { requestBuilder.configurationParameters(options.getConfigurationParameters()); requestBuilder.configurationParametersResources( options.getConfigurationParametersResources().toArray(new String[0])); - return requestBuilder.build(); + return requestBuilder; } - private List createDiscoverySelectors(TestDiscoveryOptions options) { + private static List createDiscoverySelectors(TestDiscoveryOptions options) { List explicitSelectors = options.getExplicitSelectors(); if (options.isScanClasspath()) { Preconditions.condition(explicitSelectors.isEmpty(), @@ -77,12 +76,12 @@ private List createDiscoverySelectors(TestDiscovery "Please specify an explicit selector option or use --scan-class-path or --scan-modules"); } - private List createClasspathRootSelectors(TestDiscoveryOptions options) { + private static List createClasspathRootSelectors(TestDiscoveryOptions options) { Set classpathRoots = determineClasspathRoots(options); return selectClasspathRoots(classpathRoots); } - private Set determineClasspathRoots(TestDiscoveryOptions options) { + private static Set determineClasspathRoots(TestDiscoveryOptions options) { if (options.getSelectedClasspathEntries().isEmpty()) { Set rootDirs = new LinkedHashSet<>(ReflectionUtils.getAllClasspathRootDirectories()); rootDirs.addAll(options.getExistingAdditionalClasspathEntries()); @@ -91,7 +90,7 @@ private Set determineClasspathRoots(TestDiscoveryOptions options) { return new LinkedHashSet<>(options.getSelectedClasspathEntries()); } - private void addFilters(LauncherDiscoveryRequestBuilder requestBuilder, TestDiscoveryOptions options, + private static void addFilters(LauncherDiscoveryRequestBuilder requestBuilder, TestDiscoveryOptions options, List selectors) { requestBuilder.filters(includedClassNamePatterns(options, selectors)); @@ -133,7 +132,7 @@ private void addFilters(LauncherDiscoveryRequestBuilder requestBuilder, TestDisc } } - private ClassNameFilter includedClassNamePatterns(TestDiscoveryOptions options, + private static ClassNameFilter includedClassNamePatterns(TestDiscoveryOptions options, List selectors) { Stream patternStreams = Stream.concat( // options.getIncludedClassNamePatterns().stream(), // diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/FlatPrintingListener.java b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/FlatPrintingListener.java index 0cbe2abd3352..c6a50c6349c2 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/FlatPrintingListener.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/FlatPrintingListener.java @@ -14,6 +14,7 @@ import org.junit.platform.commons.util.ExceptionUtils; import org.junit.platform.engine.TestExecutionResult; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; import org.junit.platform.launcher.TestIdentifier; import org.junit.platform.launcher.TestPlan; @@ -73,6 +74,12 @@ public void reportingEntryPublished(TestIdentifier testIdentifier, ReportEntry e printlnMessage(Style.REPORTED, "Reported values", entry.toString()); } + @Override + public void fileEntryPublished(TestIdentifier testIdentifier, FileEntry file) { + printlnTestDescriptor(Style.REPORTED, "Reported:", testIdentifier); + printlnMessage(Style.REPORTED, "Reported file", file.toString()); + } + private void printlnTestDescriptor(Style style, String message, TestIdentifier testIdentifier) { println(style, "%-10s %s (%s)", message, testIdentifier.getDisplayName(), testIdentifier.getUniqueId()); } diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreeNode.java b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreeNode.java index 8c1217f8cf68..fb119bbfa0f0 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreeNode.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreeNode.java @@ -16,6 +16,7 @@ import org.junit.platform.commons.util.StringUtils; import org.junit.platform.engine.TestExecutionResult; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; import org.junit.platform.launcher.TestIdentifier; @@ -31,6 +32,7 @@ class TreeNode { private TestIdentifier identifier; private TestExecutionResult result; final Queue reports = new ConcurrentLinkedQueue<>(); + final Queue files = new ConcurrentLinkedQueue<>(); final Queue children = new ConcurrentLinkedQueue<>(); boolean visible; @@ -61,6 +63,11 @@ TreeNode addReportEntry(ReportEntry reportEntry) { return this; } + TreeNode addFileEntry(FileEntry file) { + files.add(file); + return this; + } + TreeNode setResult(TestExecutionResult result) { this.result = result; this.duration = System.currentTimeMillis() - creation; diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreePrinter.java b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreePrinter.java index 8e171d48d3b2..dceaa952ce50 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreePrinter.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreePrinter.java @@ -21,6 +21,7 @@ import org.junit.platform.console.options.Theme; import org.junit.platform.engine.TestExecutionResult; import org.junit.platform.engine.TestExecutionResult.Status; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; /** @@ -88,6 +89,7 @@ private void printVisible(TreeNode node, String indent, boolean continuous) { node.reason().ifPresent(reason -> printMessage(Style.SKIPPED, tabbed, reason)); node.reports.forEach(e -> printReportEntry(tabbed, e)); out.println(); + node.files.forEach(e -> printFileEntry(tabbed, e)); } private String tab(TreeNode node, boolean continuous) { @@ -152,6 +154,14 @@ private void printReportEntry(String indent, Map.Entry mapEntry) out.print("`"); } + private void printFileEntry(String indent, FileEntry fileEntry) { + out.print(indent); + out.print(fileEntry.getTimestamp()); + out.print(" "); + out.print(color(Style.SUCCESSFUL, fileEntry.getFile().toUri().toString())); + out.println(); + } + private void printMessage(Style style, String indent, String message) { String[] lines = message.split("\\R"); out.print(" "); diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreePrintingListener.java b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreePrintingListener.java index 437f7b56733e..34a3b3300b49 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreePrintingListener.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreePrintingListener.java @@ -17,6 +17,7 @@ import org.junit.platform.console.options.Theme; import org.junit.platform.engine.TestExecutionResult; import org.junit.platform.engine.UniqueId; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; import org.junit.platform.launcher.TestIdentifier; import org.junit.platform.launcher.TestPlan; @@ -73,6 +74,11 @@ public void reportingEntryPublished(TestIdentifier testIdentifier, ReportEntry e getNode(testIdentifier).addReportEntry(entry); } + @Override + public void fileEntryPublished(TestIdentifier testIdentifier, FileEntry file) { + getNode(testIdentifier).addFileEntry(file); + } + @Override public void listTests(TestPlan testPlan) { root = new TreeNode(testPlan.toString()); diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/VerboseTreePrintingListener.java b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/VerboseTreePrintingListener.java index a8df758dc114..bf247ff5e1a1 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/VerboseTreePrintingListener.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/VerboseTreePrintingListener.java @@ -19,6 +19,7 @@ import org.junit.platform.console.options.Theme; import org.junit.platform.engine.TestExecutionResult; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; import org.junit.platform.launcher.TestIdentifier; import org.junit.platform.launcher.TestPlan; @@ -130,6 +131,11 @@ public void reportingEntryPublished(TestIdentifier testIdentifier, ReportEntry e printDetail(Style.REPORTED, "reports", entry.toString()); } + @Override + public void fileEntryPublished(TestIdentifier testIdentifier, FileEntry file) { + printDetail(Style.REPORTED, "reports", file.toString()); + } + /** * Print static information about the test identifier. */ diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/EngineDiscoveryRequest.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/EngineDiscoveryRequest.java index 41f6e3b76f18..3aa9cd5256b5 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/EngineDiscoveryRequest.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/EngineDiscoveryRequest.java @@ -10,11 +10,14 @@ package org.junit.platform.engine; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.STABLE; import java.util.List; import org.apiguardian.api.API; +import org.junit.platform.commons.JUnitException; +import org.junit.platform.engine.reporting.OutputDirectoryProvider; /** * {@code EngineDiscoveryRequest} provides a {@link TestEngine} access to the @@ -72,10 +75,6 @@ public interface EngineDiscoveryRequest { /** * Get the {@link EngineDiscoveryListener} for this request. * - *

    The default implementation returns a no-op listener that ignores all - * calls so that engines that call this methods can be used with an earlier - * version of the JUnit Platform that did not yet include this API. - * * @return the discovery listener; never {@code null} * @since 1.6 */ @@ -84,4 +83,15 @@ default EngineDiscoveryListener getDiscoveryListener() { return EngineDiscoveryListener.NOOP; } + /** + * Get the {@link OutputDirectoryProvider} for this request. + * + * @return the output directory provider; never {@code null} + * @since 1.12 + */ + @API(status = EXPERIMENTAL, since = "1.12") + default OutputDirectoryProvider getOutputDirectoryProvider() { + throw new JUnitException( + "OutputDirectoryProvider not available; probably due to unaligned versions of the junit-platform-engine and junit-platform-launcher jars on the classpath/module path."); + } } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/EngineExecutionListener.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/EngineExecutionListener.java index 80727af0e3c2..c5fe614fc6b6 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/EngineExecutionListener.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/EngineExecutionListener.java @@ -10,10 +10,12 @@ package org.junit.platform.engine; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.STABLE; import org.apiguardian.api.API; import org.junit.platform.engine.TestExecutionResult.Status; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; /** @@ -137,4 +139,24 @@ default void executionFinished(TestDescriptor testDescriptor, TestExecutionResul default void reportingEntryPublished(TestDescriptor testDescriptor, ReportEntry entry) { } + /** + * Can be called for any {@link TestDescriptor} in order to attach a file to + * a test or container — for example: + * + *

      + *
    • Screenshots
    • + *
    • Logs
    • + *
    • Output files written by the code under test
    • + *
    + * + *

    The current lifecycle state of the supplied {@code TestDescriptor} is + * not relevant: file events can occur at any time. + * + * @param testDescriptor the descriptor of the test or container to which + * the file entry belongs + * @param file a {@code FileEntry} instance to be attached + */ + @API(status = EXPERIMENTAL, since = "1.12") + default void fileEntryPublished(TestDescriptor testDescriptor, FileEntry file) { + } } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/ExecutionRequest.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/ExecutionRequest.java index ce0b9e0c65c7..64bdc62cb37d 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/ExecutionRequest.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/ExecutionRequest.java @@ -31,9 +31,7 @@ public class ExecutionRequest { private final TestDescriptor rootTestDescriptor; - private final EngineExecutionListener engineExecutionListener; - private final ConfigurationParameters configurationParameters; @API(status = INTERNAL, since = "1.0") diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/FileEntry.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/FileEntry.java new file mode 100644 index 000000000000..9dab655e5a1f --- /dev/null +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/FileEntry.java @@ -0,0 +1,74 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.engine.reporting; + +import static org.apiguardian.api.API.Status.EXPERIMENTAL; + +import java.nio.file.Path; +import java.time.LocalDateTime; + +import org.apiguardian.api.API; +import org.junit.platform.commons.util.Preconditions; +import org.junit.platform.commons.util.ToStringBuilder; + +/** + * {@code FileEntry} encapsulates a file to be published to the reporting + * infrastructure. + * + * @since 1.12 + * @see #from(Path) + */ +@API(status = EXPERIMENTAL, since = "1.12") +public final class FileEntry { + + /** + * Factory for creating a new {@code FileEntry} from the supplied file. + * + * @param file the file to publish; never {@code null} + */ + public static FileEntry from(Path file) { + return new FileEntry(file); + } + + private final LocalDateTime timestamp = LocalDateTime.now(); + private final Path file; + + private FileEntry(Path file) { + this.file = Preconditions.notNull(file, "file must not be null"); + } + + /** + * Get the timestamp for when this {@code FileEntry} was created. + * + * @return when this entry was created; never {@code null} + */ + public LocalDateTime getTimestamp() { + return this.timestamp; + } + + /** + * Get the file to be published. + * + * @return the file to publish; never {@code null} + */ + public Path getFile() { + return file; + } + + @Override + public String toString() { + ToStringBuilder builder = new ToStringBuilder(this); + builder.append("timestamp", this.timestamp); + builder.append("file", this.file); + return builder.toString(); + } + +} diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/OutputDirectoryProvider.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/OutputDirectoryProvider.java new file mode 100644 index 000000000000..5bb83fc77dc9 --- /dev/null +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/OutputDirectoryProvider.java @@ -0,0 +1,47 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.engine.reporting; + +import static org.apiguardian.api.API.Status.EXPERIMENTAL; + +import java.io.IOException; +import java.nio.file.Path; + +import org.apiguardian.api.API; +import org.junit.platform.engine.EngineDiscoveryRequest; +import org.junit.platform.engine.TestDescriptor; + +/** + * Provider of output directories for test engines to write reports and other + * output files to. + * + * @since 1.12 + * @see EngineDiscoveryRequest#getOutputDirectoryProvider() + */ +@API(status = EXPERIMENTAL, since = "1.12") +public interface OutputDirectoryProvider { + + /** + * {@return the root directory for all output files; never {@code null}} + */ + Path getRootDirectory(); + + /** + * Create an output directory for the supplied test descriptor. + * + * @param testDescriptor the test descriptor for which to create an output + * directory; never {@code null} + * @return the output directory + * @throws IOException if the output directory could not be created + */ + Path createOutputDirectory(TestDescriptor testDescriptor) throws IOException; + +} diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/ReportEntry.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/ReportEntry.java index 740df190eaaa..f091e0984ecc 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/ReportEntry.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/ReportEntry.java @@ -83,7 +83,7 @@ private void add(String key, String value) { * * @return a copy of the map of key-value pairs; never {@code null} */ - public final Map getKeyValuePairs() { + public Map getKeyValuePairs() { return Collections.unmodifiableMap(this.keyValuePairs); } @@ -94,7 +94,7 @@ public final Map getKeyValuePairs() { * * @return when this entry was created; never {@code null} */ - public final LocalDateTime getTimestamp() { + public LocalDateTime getTimestamp() { return this.timestamp; } diff --git a/junit-platform-jfr/src/main/java/org/junit/platform/jfr/FlightRecordingExecutionListener.java b/junit-platform-jfr/src/main/java/org/junit/platform/jfr/FlightRecordingExecutionListener.java index cef4753f01b2..04d72df4cb87 100644 --- a/junit-platform-jfr/src/main/java/org/junit/platform/jfr/FlightRecordingExecutionListener.java +++ b/junit-platform-jfr/src/main/java/org/junit/platform/jfr/FlightRecordingExecutionListener.java @@ -26,6 +26,7 @@ import org.apiguardian.api.API; import org.junit.platform.engine.TestExecutionResult; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; import org.junit.platform.launcher.TestExecutionListener; import org.junit.platform.launcher.TestIdentifier; @@ -97,6 +98,14 @@ public void reportingEntryPublished(TestIdentifier test, ReportEntry reportEntry } } + @Override + public void fileEntryPublished(TestIdentifier testIdentifier, FileEntry file) { + FileEntryEvent event = new FileEntryEvent(); + event.uniqueId = testIdentifier.getUniqueId(); + event.path = file.getFile().toAbsolutePath().toString(); + event.commit(); + } + @Category({ "JUnit", "Execution" }) @StackTrace(false) abstract static class ExecutionEvent extends Event { @@ -159,4 +168,14 @@ static class ReportEntryEvent extends ExecutionEvent { @Label("Value") String value; } + + @Label("File Entry") + @Name("org.junit.FileEntry") + static class FileEntryEvent extends ExecutionEvent { + @UniqueId + @Label("Unique Id") + String uniqueId; + @Label("Path") + String path; + } } diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherConstants.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherConstants.java index 3a7aa079aed1..da3dac7fae74 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherConstants.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherConstants.java @@ -191,6 +191,34 @@ public class LauncherConstants { @API(status = EXPERIMENTAL, since = "1.10") public static final String STACKTRACE_PRUNING_ENABLED_PROPERTY_NAME = "junit.platform.stacktrace.pruning.enabled"; + /** + * Property name used to configure the output directory for reporting. + * + *

    If set, value must be a valid path that will be created if it doesn't + * exist. If not set, the default output directory will be determined by the + * reporting engine based on the current working directory. + * + * @since 1.12 + * @see #OUTPUT_DIR_UNIQUE_NUMBER_PLACEHOLDER + * @see org.junit.platform.engine.reporting.OutputDirectoryProvider + */ + @API(status = EXPERIMENTAL, since = "1.12") + public static final String OUTPUT_DIR_PROPERTY_NAME = "junit.platform.reporting.output.dir"; + + /** + * Placeholder for use in {@link #OUTPUT_DIR_PROPERTY_NAME} that will be + * replaced with a unique number. + * + *

    This can be used to create a unique output directory for each test + * run. For example, if multiple forks are used, each fork can be configured + * to write its output to a separate directory. + * + * @since 1.12 + * @see #OUTPUT_DIR_PROPERTY_NAME + */ + @API(status = EXPERIMENTAL, since = "1.12") + public static final String OUTPUT_DIR_UNIQUE_NUMBER_PLACEHOLDER = "{uniqueNumber}"; + private LauncherConstants() { /* no-op */ } diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestExecutionListener.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestExecutionListener.java index 9179705f3661..ad3c98105bb0 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestExecutionListener.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestExecutionListener.java @@ -10,12 +10,14 @@ package org.junit.platform.launcher; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.STABLE; import org.apiguardian.api.API; import org.junit.platform.commons.util.UnrecoverableExceptions; import org.junit.platform.engine.TestExecutionResult; import org.junit.platform.engine.TestExecutionResult.Status; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; /** @@ -184,4 +186,15 @@ default void executionFinished(TestIdentifier testIdentifier, TestExecutionResul default void reportingEntryPublished(TestIdentifier testIdentifier, ReportEntry entry) { } + /** + * Called when a file has been published for the supplied {@link TestIdentifier}. + * + *

    Can be called at any time during the execution of a test plan. + * + * @param testIdentifier describes the test or container to which the entry pertains + * @param file the published {@code FileEntry} + */ + @API(status = EXPERIMENTAL, since = "1.12") + default void fileEntryPublished(TestIdentifier testIdentifier, FileEntry file) { + } } diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestPlan.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestPlan.java index c83f11124913..c236d1980216 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestPlan.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestPlan.java @@ -34,6 +34,7 @@ import org.junit.platform.engine.ConfigurationParameters; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.UniqueId; +import org.junit.platform.engine.reporting.OutputDirectoryProvider; /** * {@code TestPlan} describes the tree of tests and containers as discovered @@ -70,6 +71,7 @@ public class TestPlan { private final boolean containsTests; private final ConfigurationParameters configurationParameters; + private final OutputDirectoryProvider outputDirectoryProvider; /** * Construct a new {@code TestPlan} from the supplied collection of @@ -82,24 +84,28 @@ public class TestPlan { * plan should be created; never {@code null} * @param configurationParameters the {@code ConfigurationParameters} for * this test plan; never {@code null} + * @param outputDirectoryProvider the {@code OutputDirectoryProvider} for + * this test plan; never {@code null} * @return a new test plan */ - @API(status = INTERNAL, since = "1.0") + @API(status = INTERNAL, since = "1.12") public static TestPlan from(Collection engineDescriptors, - ConfigurationParameters configurationParameters) { + ConfigurationParameters configurationParameters, OutputDirectoryProvider outputDirectoryProvider) { Preconditions.notNull(engineDescriptors, "Cannot create TestPlan from a null collection of TestDescriptors"); Preconditions.notNull(configurationParameters, "Cannot create TestPlan from null ConfigurationParameters"); TestPlan testPlan = new TestPlan(engineDescriptors.stream().anyMatch(TestDescriptor::containsTests), - configurationParameters); + configurationParameters, outputDirectoryProvider); TestDescriptor.Visitor visitor = descriptor -> testPlan.addInternal(TestIdentifier.from(descriptor)); engineDescriptors.forEach(engineDescriptor -> engineDescriptor.accept(visitor)); return testPlan; } @API(status = INTERNAL, since = "1.4") - protected TestPlan(boolean containsTests, ConfigurationParameters configurationParameters) { + protected TestPlan(boolean containsTests, ConfigurationParameters configurationParameters, + OutputDirectoryProvider outputDirectoryProvider) { this.containsTests = containsTests; this.configurationParameters = configurationParameters; + this.outputDirectoryProvider = outputDirectoryProvider; } /** @@ -291,6 +297,17 @@ public ConfigurationParameters getConfigurationParameters() { return this.configurationParameters; } + /** + * Get the {@link OutputDirectoryProvider} for this test plan. + * + * @return the output directory provider; never {@code null} + * @since 1.12 + */ + @API(status = EXPERIMENTAL, since = "1.12") + public OutputDirectoryProvider getOutputDirectoryProvider() { + return this.outputDirectoryProvider; + } + /** * Accept the supplied {@link Visitor} for a depth-first traversal of the * test plan. diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/CompositeEngineExecutionListener.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/CompositeEngineExecutionListener.java index b68e59bee23c..b872c12b0f1a 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/CompositeEngineExecutionListener.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/CompositeEngineExecutionListener.java @@ -21,6 +21,7 @@ import org.junit.platform.engine.EngineExecutionListener; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.TestExecutionResult; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; class CompositeEngineExecutionListener implements EngineExecutionListener { @@ -67,6 +68,13 @@ public void reportingEntryPublished(TestDescriptor testDescriptor, ReportEntry e () -> "reportingEntryPublished(" + testDescriptor + ", " + entry + ")"); } + @Override + public void fileEntryPublished(TestDescriptor testDescriptor, FileEntry file) { + notifyEach(engineExecutionListeners, IterationOrder.ORIGINAL, + listener -> listener.fileEntryPublished(testDescriptor, file), + () -> "fileEntryPublished(" + testDescriptor + ", " + file + ")"); + } + private static void notifyEach(List listeners, IterationOrder iterationOrder, Consumer consumer, Supplier description) { iterationOrder.forEach(listeners, listener -> { diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/CompositeTestExecutionListener.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/CompositeTestExecutionListener.java index 9107865d8872..1eaeee172a07 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/CompositeTestExecutionListener.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/CompositeTestExecutionListener.java @@ -21,6 +21,7 @@ import org.junit.platform.commons.logging.LoggerFactory; import org.junit.platform.commons.util.UnrecoverableExceptions; import org.junit.platform.engine.TestExecutionResult; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; import org.junit.platform.launcher.TestExecutionListener; import org.junit.platform.launcher.TestIdentifier; @@ -95,6 +96,13 @@ public void reportingEntryPublished(TestIdentifier testIdentifier, ReportEntry e () -> "reportingEntryPublished(" + testIdentifier + ", " + entry + ")"); } + @Override + public void fileEntryPublished(TestIdentifier testIdentifier, FileEntry file) { + notifyEach(testExecutionListeners, IterationOrder.ORIGINAL, + listener -> listener.fileEntryPublished(testIdentifier, file), + () -> "fileEntryPublished(" + testIdentifier + ", " + file + ")"); + } + private static void notifyEach(List listeners, IterationOrder iterationOrder, Consumer consumer, Supplier description) { iterationOrder.forEach(listeners, listener -> { diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DefaultDiscoveryRequest.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DefaultDiscoveryRequest.java index 3ea9c295384a..fd59b0b447a4 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DefaultDiscoveryRequest.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DefaultDiscoveryRequest.java @@ -20,6 +20,7 @@ import org.junit.platform.engine.DiscoveryFilter; import org.junit.platform.engine.DiscoverySelector; import org.junit.platform.engine.EngineDiscoveryRequest; +import org.junit.platform.engine.reporting.OutputDirectoryProvider; import org.junit.platform.launcher.EngineFilter; import org.junit.platform.launcher.LauncherDiscoveryListener; import org.junit.platform.launcher.LauncherDiscoveryRequest; @@ -51,15 +52,19 @@ final class DefaultDiscoveryRequest implements LauncherDiscoveryRequest { // Listener for test discovery that may abort on errors. private final LauncherDiscoveryListener discoveryListener; + private final OutputDirectoryProvider outputDirectoryProvider; + DefaultDiscoveryRequest(List selectors, List engineFilters, List> discoveryFilters, List postDiscoveryFilters, - LauncherConfigurationParameters configurationParameters, LauncherDiscoveryListener discoveryListener) { + LauncherConfigurationParameters configurationParameters, LauncherDiscoveryListener discoveryListener, + OutputDirectoryProvider outputDirectoryProvider) { this.selectors = selectors; this.engineFilters = engineFilters; this.discoveryFilters = discoveryFilters; this.postDiscoveryFilters = postDiscoveryFilters; this.configurationParameters = configurationParameters; this.discoveryListener = discoveryListener; + this.outputDirectoryProvider = outputDirectoryProvider; } @Override @@ -91,7 +96,11 @@ public ConfigurationParameters getConfigurationParameters() { @Override public LauncherDiscoveryListener getDiscoveryListener() { - return discoveryListener; + return this.discoveryListener; } + @Override + public OutputDirectoryProvider getOutputDirectoryProvider() { + return this.outputDirectoryProvider; + } } diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DelegatingEngineExecutionListener.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DelegatingEngineExecutionListener.java index 18a95fabdb3b..2eca74628725 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DelegatingEngineExecutionListener.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DelegatingEngineExecutionListener.java @@ -13,6 +13,7 @@ import org.junit.platform.engine.EngineExecutionListener; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.TestExecutionResult; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; /** @@ -51,4 +52,8 @@ public void reportingEntryPublished(TestDescriptor testDescriptor, ReportEntry e delegate.reportingEntryPublished(testDescriptor, entry); } + @Override + public void fileEntryPublished(TestDescriptor testDescriptor, FileEntry file) { + delegate.fileEntryPublished(testDescriptor, file); + } } diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineDiscoveryOrchestrator.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineDiscoveryOrchestrator.java index 09cb6231b9a7..6e01d443cfb7 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineDiscoveryOrchestrator.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineDiscoveryOrchestrator.java @@ -75,8 +75,7 @@ public EngineDiscoveryOrchestrator(Iterable testEngines, * {@linkplain TestDescriptor#prune() prunes} the resulting test tree. */ public LauncherDiscoveryResult discover(LauncherDiscoveryRequest request, Phase phase) { - Map result = discover(request, phase, UniqueId::forEngine); - return new LauncherDiscoveryResult(result, request.getConfigurationParameters()); + return discover(request, phase, UniqueId::forEngine); } /** @@ -94,17 +93,18 @@ public LauncherDiscoveryResult discover(LauncherDiscoveryRequest request, Phase * will not emit start or emit events for engines without tests. */ public LauncherDiscoveryResult discover(LauncherDiscoveryRequest request, Phase phase, UniqueId parentId) { - Map testEngines = discover(request, phase, parentId::appendEngine); - LauncherDiscoveryResult result = new LauncherDiscoveryResult(testEngines, request.getConfigurationParameters()); + LauncherDiscoveryResult result = discover(request, phase, parentId::appendEngine); return result.withRetainedEngines(TestDescriptor::containsTests); } - private Map discover(LauncherDiscoveryRequest request, Phase phase, + private LauncherDiscoveryResult discover(LauncherDiscoveryRequest request, Phase phase, Function uniqueIdCreator) { LauncherDiscoveryListener listener = getLauncherDiscoveryListener(request); listener.launcherDiscoveryStarted(request); try { - return discoverSafely(request, phase, listener, uniqueIdCreator); + Map testEngines = discoverSafely(request, phase, listener, uniqueIdCreator); + return new LauncherDiscoveryResult(testEngines, request.getConfigurationParameters(), + request.getOutputDirectoryProvider()); } finally { listener.launcherDiscoveryFinished(request); diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineExecutionOrchestrator.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineExecutionOrchestrator.java index c000c09ce6cc..1ef05c02d820 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineExecutionOrchestrator.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineExecutionOrchestrator.java @@ -195,7 +195,7 @@ private void execute(TestDescriptor engineDescriptor, EngineExecutionListener li OutcomeDelayingEngineExecutionListener delayingListener = new OutcomeDelayingEngineExecutionListener(listener, engineDescriptor); try { - testEngine.execute(new ExecutionRequest(engineDescriptor, delayingListener, configurationParameters)); + testEngine.execute(ExecutionRequest.create(engineDescriptor, delayingListener, configurationParameters)); delayingListener.reportEngineOutcome(); } catch (Throwable throwable) { diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ExecutionListenerAdapter.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ExecutionListenerAdapter.java index 54e3b7c2ae38..cd85e331dccb 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ExecutionListenerAdapter.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ExecutionListenerAdapter.java @@ -13,6 +13,7 @@ import org.junit.platform.engine.EngineExecutionListener; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.TestExecutionResult; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; import org.junit.platform.launcher.TestExecutionListener; import org.junit.platform.launcher.TestIdentifier; @@ -61,6 +62,11 @@ public void reportingEntryPublished(TestDescriptor testDescriptor, ReportEntry e this.testExecutionListener.reportingEntryPublished(getTestIdentifier(testDescriptor), entry); } + @Override + public void fileEntryPublished(TestDescriptor testDescriptor, FileEntry file) { + this.testExecutionListener.fileEntryPublished(getTestIdentifier(testDescriptor), file); + } + private TestIdentifier getTestIdentifier(TestDescriptor testDescriptor) { return this.testPlan.getTestIdentifier(testDescriptor.getUniqueId()); } diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/HierarchicalOutputDirectoryProvider.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/HierarchicalOutputDirectoryProvider.java new file mode 100644 index 000000000000..9296ca634468 --- /dev/null +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/HierarchicalOutputDirectoryProvider.java @@ -0,0 +1,71 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.launcher.core; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; +import java.util.function.Supplier; +import java.util.regex.Pattern; + +import org.junit.platform.commons.util.Preconditions; +import org.junit.platform.engine.TestDescriptor; +import org.junit.platform.engine.UniqueId.Segment; +import org.junit.platform.engine.reporting.OutputDirectoryProvider; + +/** + * Hierarchical {@link OutputDirectoryProvider} that creates directories based on + * the unique ID segments of a {@link TestDescriptor}. + * + * @since 1.12 + */ +class HierarchicalOutputDirectoryProvider implements OutputDirectoryProvider { + + private static final Pattern FORBIDDEN_CHARS = Pattern.compile("[^a-z0-9.,_\\-() ]", Pattern.CASE_INSENSITIVE); + private static final String REPLACEMENT = "_"; + + private final Supplier rootDirSupplier; + private volatile Path rootDir; + + HierarchicalOutputDirectoryProvider(Supplier rootDirSupplier) { + this.rootDirSupplier = rootDirSupplier; + } + + @Override + public Path createOutputDirectory(TestDescriptor testDescriptor) throws IOException { + Preconditions.notNull(testDescriptor, "testDescriptor must not be null"); + + List segments = testDescriptor.getUniqueId().getSegments(); + Path relativePath = segments.stream() // + .skip(1) // + .map(HierarchicalOutputDirectoryProvider::toSanitizedPath) // + .reduce(toSanitizedPath(segments.get(0)), Path::resolve); + return Files.createDirectories(getRootDirectory().resolve(relativePath)); + } + + @Override + public synchronized Path getRootDirectory() { + if (rootDir == null) { + rootDir = rootDirSupplier.get(); + } + return rootDir; + } + + private static Path toSanitizedPath(Segment segment) { + return Paths.get(sanitizeName(segment.getValue())); + } + + private static String sanitizeName(String value) { + return FORBIDDEN_CHARS.matcher(value).replaceAll(REPLACEMENT); + } +} diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/InternalTestPlan.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/InternalTestPlan.java index 9195eaef2e97..3297909c09ae 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/InternalTestPlan.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/InternalTestPlan.java @@ -31,12 +31,12 @@ class InternalTestPlan extends TestPlan { static InternalTestPlan from(LauncherDiscoveryResult discoveryResult) { TestPlan delegate = TestPlan.from(discoveryResult.getEngineTestDescriptors(), - discoveryResult.getConfigurationParameters()); + discoveryResult.getConfigurationParameters(), discoveryResult.getOutputDirectoryProvider()); return new InternalTestPlan(discoveryResult, delegate); } private InternalTestPlan(LauncherDiscoveryResult discoveryResult, TestPlan delegate) { - super(delegate.containsTests(), delegate.getConfigurationParameters()); + super(delegate.containsTests(), delegate.getConfigurationParameters(), delegate.getOutputDirectoryProvider()); this.discoveryResult = discoveryResult; this.delegate = delegate; } diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilder.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilder.java index cb480d2533e3..0d62e9a3b5c2 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilder.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilder.java @@ -11,7 +11,9 @@ package org.junit.platform.launcher.core; import static org.apiguardian.api.API.Status.DEPRECATED; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.STABLE; +import static org.junit.platform.launcher.LauncherConstants.OUTPUT_DIR_PROPERTY_NAME; import java.util.ArrayList; import java.util.Arrays; @@ -27,11 +29,14 @@ import org.junit.platform.engine.DiscoveryFilter; import org.junit.platform.engine.DiscoverySelector; import org.junit.platform.engine.Filter; +import org.junit.platform.engine.reporting.OutputDirectoryProvider; import org.junit.platform.launcher.EngineFilter; +import org.junit.platform.launcher.LauncherConstants; import org.junit.platform.launcher.LauncherDiscoveryListener; import org.junit.platform.launcher.LauncherDiscoveryRequest; import org.junit.platform.launcher.PostDiscoveryFilter; import org.junit.platform.launcher.core.LauncherConfigurationParameters.Builder; +import org.junit.platform.launcher.listeners.OutputDir; import org.junit.platform.launcher.listeners.discovery.LauncherDiscoveryListeners; /** @@ -107,6 +112,7 @@ public final class LauncherDiscoveryRequestBuilder { private final List discoveryListeners = new ArrayList<>(); private boolean implicitConfigurationParametersEnabled = true; private ConfigurationParameters parentConfigurationParameters; + private OutputDirectoryProvider outputDirectoryProvider; /** * Create a new {@code LauncherDiscoveryRequestBuilder}. @@ -283,6 +289,27 @@ public LauncherDiscoveryRequestBuilder listeners(LauncherDiscoveryListener... li return this; } + /** + * Set the {@link OutputDirectoryProvider} to use for the request. + * + *

    If not specified, a default provider will be used that can be + * configured via the {@value LauncherConstants#OUTPUT_DIR_PROPERTY_NAME} + * configuration parameter. + * + * @param outputDirectoryProvider the output directory provider to use; + * never {@code null} + * @return this builder for method chaining + * @since 1.12 + * @see OutputDirectoryProvider + * @see LauncherConstants#OUTPUT_DIR_PROPERTY_NAME + */ + @API(status = EXPERIMENTAL, since = "1.12") + public LauncherDiscoveryRequestBuilder outputDirectoryProvider(OutputDirectoryProvider outputDirectoryProvider) { + this.outputDirectoryProvider = Preconditions.notNull(outputDirectoryProvider, + "outputDirectoryProvider must not be null"); + return this; + } + private void storeFilter(Filter filter) { if (filter instanceof EngineFilter) { this.engineFilters.add((EngineFilter) filter); @@ -307,8 +334,18 @@ else if (filter instanceof DiscoveryFilter) { public LauncherDiscoveryRequest build() { LauncherConfigurationParameters launcherConfigurationParameters = buildLauncherConfigurationParameters(); LauncherDiscoveryListener discoveryListener = getLauncherDiscoveryListener(launcherConfigurationParameters); + OutputDirectoryProvider outputDirectoryProvider = getOutputDirectoryProvider(launcherConfigurationParameters); return new DefaultDiscoveryRequest(this.selectors, this.engineFilters, this.discoveryFilters, - this.postDiscoveryFilters, launcherConfigurationParameters, discoveryListener); + this.postDiscoveryFilters, launcherConfigurationParameters, discoveryListener, outputDirectoryProvider); + } + + private OutputDirectoryProvider getOutputDirectoryProvider( + LauncherConfigurationParameters configurationParameters) { + if (this.outputDirectoryProvider != null) { + return this.outputDirectoryProvider; + } + return new HierarchicalOutputDirectoryProvider( + () -> OutputDir.create(configurationParameters.get(OUTPUT_DIR_PROPERTY_NAME)).toPath()); } private LauncherConfigurationParameters buildLauncherConfigurationParameters() { diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherDiscoveryResult.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherDiscoveryResult.java index d65b4c3fe4d1..af4c75db0e67 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherDiscoveryResult.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherDiscoveryResult.java @@ -23,6 +23,7 @@ import org.junit.platform.engine.ConfigurationParameters; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.TestEngine; +import org.junit.platform.engine.reporting.OutputDirectoryProvider; /** * Represents the result of test discovery of the configured @@ -35,11 +36,13 @@ public class LauncherDiscoveryResult { private final Map testEngineDescriptors; private final ConfigurationParameters configurationParameters; + private final OutputDirectoryProvider outputDirectoryProvider; LauncherDiscoveryResult(Map testEngineDescriptors, - ConfigurationParameters configurationParameters) { + ConfigurationParameters configurationParameters, OutputDirectoryProvider outputDirectoryProvider) { this.testEngineDescriptors = unmodifiableMap(new LinkedHashMap<>(testEngineDescriptors)); this.configurationParameters = configurationParameters; + this.outputDirectoryProvider = outputDirectoryProvider; } public TestDescriptor getEngineTestDescriptor(TestEngine testEngine) { @@ -47,7 +50,11 @@ public TestDescriptor getEngineTestDescriptor(TestEngine testEngine) { } ConfigurationParameters getConfigurationParameters() { - return configurationParameters; + return this.configurationParameters; + } + + OutputDirectoryProvider getOutputDirectoryProvider() { + return this.outputDirectoryProvider; } public Collection getTestEngines() { @@ -60,15 +67,16 @@ Collection getEngineTestDescriptors() { public LauncherDiscoveryResult withRetainedEngines(Predicate predicate) { Map prunedTestEngineDescriptors = retainEngines(predicate); - if (prunedTestEngineDescriptors.size() < testEngineDescriptors.size()) { - return new LauncherDiscoveryResult(prunedTestEngineDescriptors, configurationParameters); + if (prunedTestEngineDescriptors.size() < this.testEngineDescriptors.size()) { + return new LauncherDiscoveryResult(prunedTestEngineDescriptors, this.configurationParameters, + this.outputDirectoryProvider); } return this; } private Map retainEngines(Predicate predicate) { // @formatter:off - return testEngineDescriptors.entrySet() + return this.testEngineDescriptors.entrySet() .stream() .filter(entry -> predicate.test(entry.getValue())) .collect(toMap(Map.Entry::getKey, Map.Entry::getValue)); diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/OutputDir.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/OutputDir.java index 31de20e55175..27856d5154b8 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/OutputDir.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/OutputDir.java @@ -11,15 +11,20 @@ package org.junit.platform.launcher.listeners; import static org.apiguardian.api.API.Status.INTERNAL; +import static org.junit.platform.launcher.LauncherConstants.OUTPUT_DIR_UNIQUE_NUMBER_PLACEHOLDER; import java.io.IOException; import java.io.UncheckedIOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.nio.file.attribute.BasicFileAttributes; import java.security.SecureRandom; import java.util.Optional; +import java.util.function.BiPredicate; import java.util.function.Supplier; +import java.util.regex.Pattern; +import java.util.stream.Stream; import org.apiguardian.api.API; import org.junit.platform.commons.util.StringUtils; @@ -27,6 +32,9 @@ @API(status = INTERNAL, since = "1.9") public class OutputDir { + private static final Pattern OUTPUT_DIR_UNIQUE_NUMBER_PLACEHOLDER_PATTERN = Pattern.compile( + Pattern.quote(OUTPUT_DIR_UNIQUE_NUMBER_PLACEHOLDER)); + public static OutputDir create(Optional customDir) { try { return createSafely(customDir, () -> Paths.get(".").toAbsolutePath()); @@ -40,11 +48,21 @@ public static OutputDir create(Optional customDir) { * Package private for testing purposes. */ static OutputDir createSafely(Optional customDir, Supplier currentWorkingDir) throws IOException { + return createSafely(customDir, currentWorkingDir, new SecureRandom()); + } + + private static OutputDir createSafely(Optional customDir, Supplier currentWorkingDir, + SecureRandom random) throws IOException { Path cwd = currentWorkingDir.get(); Path outputDir; if (customDir.isPresent() && StringUtils.isNotBlank(customDir.get())) { - outputDir = cwd.resolve(customDir.get()); + String customPath = customDir.get(); + while (customPath.contains(OUTPUT_DIR_UNIQUE_NUMBER_PLACEHOLDER)) { + customPath = OUTPUT_DIR_UNIQUE_NUMBER_PLACEHOLDER_PATTERN.matcher(customPath) // + .replaceFirst(String.valueOf(Math.abs(random.nextLong()))); + } + outputDir = cwd.resolve(customPath); } else if (Files.exists(cwd.resolve("pom.xml"))) { outputDir = cwd.resolve("target"); @@ -60,13 +78,15 @@ else if (containsFilesWithExtensions(cwd, ".gradle", ".gradle.kts")) { Files.createDirectories(outputDir); } - return new OutputDir(outputDir); + return new OutputDir(outputDir.normalize(), random); } private final Path path; + private final SecureRandom random; - private OutputDir(Path path) { + private OutputDir(Path path, SecureRandom random) { this.path = path; + this.random = random; } public Path toPath() { @@ -74,7 +94,7 @@ public Path toPath() { } public Path createFile(String prefix, String extension) throws UncheckedIOException { - String filename = String.format("%s-%d.%s", prefix, Math.abs(new SecureRandom().nextLong()), extension); + String filename = String.format("%s-%d.%s", prefix, Math.abs(random.nextLong()), extension); Path outputFile = path.resolve(filename); try { @@ -93,18 +113,18 @@ public Path createFile(String prefix, String extension) throws UncheckedIOExcept * supplied extensions. */ private static boolean containsFilesWithExtensions(Path dir, String... extensions) throws IOException { - return Files.find(dir, 1, // - (path, basicFileAttributes) -> { - if (basicFileAttributes.isRegularFile()) { - for (String extension : extensions) { - if (path.getFileName().toString().endsWith(extension)) { - return true; - } + BiPredicate matcher = (path, basicFileAttributes) -> { + if (basicFileAttributes.isRegularFile()) { + for (String extension : extensions) { + if (path.getFileName().toString().endsWith(extension)) { + return true; } } - return false; - }) // - .findFirst() // - .isPresent(); + } + return false; + }; + try (Stream pathStream = Files.find(dir, 1, matcher)) { + return pathStream.findFirst().isPresent(); + } } } diff --git a/junit-platform-launcher/src/testFixtures/java/org/junit/platform/launcher/core/OutputDirectoryProviders.java b/junit-platform-launcher/src/testFixtures/java/org/junit/platform/launcher/core/OutputDirectoryProviders.java new file mode 100644 index 000000000000..408d0740ce6a --- /dev/null +++ b/junit-platform-launcher/src/testFixtures/java/org/junit/platform/launcher/core/OutputDirectoryProviders.java @@ -0,0 +1,29 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.launcher.core; + +import java.nio.file.Path; + +import org.junit.platform.commons.JUnitException; +import org.junit.platform.engine.reporting.OutputDirectoryProvider; + +public class OutputDirectoryProviders { + + public static OutputDirectoryProvider dummyOutputDirectoryProvider() { + return new HierarchicalOutputDirectoryProvider(() -> { + throw new JUnitException("This should not be called; use a real provider instead"); + }); + } + + public static OutputDirectoryProvider hierarchicalOutputDirectoryProvider(Path rootDir) { + return new HierarchicalOutputDirectoryProvider(() -> rootDir); + } +} diff --git a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java index 9381776a0d40..c7fbef603e88 100644 --- a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java +++ b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java @@ -19,6 +19,7 @@ import static org.opentest4j.reporting.events.core.CoreFactory.cpuCores; import static org.opentest4j.reporting.events.core.CoreFactory.data; import static org.opentest4j.reporting.events.core.CoreFactory.directorySource; +import static org.opentest4j.reporting.events.core.CoreFactory.file; import static org.opentest4j.reporting.events.core.CoreFactory.fileSource; import static org.opentest4j.reporting.events.core.CoreFactory.hostName; import static org.opentest4j.reporting.events.core.CoreFactory.infrastructure; @@ -73,6 +74,7 @@ import org.junit.platform.engine.TestExecutionResult; import org.junit.platform.engine.TestSource; import org.junit.platform.engine.UniqueId; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; import org.junit.platform.engine.support.descriptor.ClassSource; import org.junit.platform.engine.support.descriptor.ClasspathResourceSource; @@ -85,7 +87,6 @@ import org.junit.platform.launcher.TestExecutionListener; import org.junit.platform.launcher.TestIdentifier; import org.junit.platform.launcher.TestPlan; -import org.junit.platform.launcher.listeners.OutputDir; import org.opentest4j.reporting.events.api.DocumentWriter; import org.opentest4j.reporting.events.api.NamespaceRegistry; import org.opentest4j.reporting.events.core.Infrastructure; @@ -103,11 +104,11 @@ public class OpenTestReportGeneratingListener implements TestExecutionListener { static final String ENABLED_PROPERTY_NAME = "junit.platform.reporting.open.xml.enabled"; - static final String OUTPUT_DIR_PROPERTY_NAME = "junit.platform.reporting.output.dir"; private final AtomicInteger idCounter = new AtomicInteger(); private final Map inProgressIds = new ConcurrentHashMap<>(); private DocumentWriter eventsFileWriter = DocumentWriter.noop(); + private Path outputDir; public OpenTestReportGeneratingListener() { } @@ -123,8 +124,8 @@ public void testPlanExecutionStarted(TestPlan testPlan) { .add("junit", JUnitFactory.NAMESPACE, "https://junit.org/junit5/schemas/open-test-reporting/junit-1.9.xsd") // .build(); - Path eventsXml = OutputDir.create(config.get(OUTPUT_DIR_PROPERTY_NAME)) // - .createFile("junit-platform-events", "xml"); + outputDir = testPlan.getOutputDirectoryProvider().getRootDirectory(); + Path eventsXml = outputDir.resolve("open-test-report.xml"); try { eventsFileWriter = Events.createDocumentWriter(namespaceRegistry, eventsXml); reportInfrastructure(); @@ -340,6 +341,14 @@ public void reportingEntryPublished(TestIdentifier testIdentifier, ReportEntry e data -> entry.getKeyValuePairs().forEach(data::addEntry)))); } + @Override + public void fileEntryPublished(TestIdentifier testIdentifier, FileEntry entry) { + String id = inProgressIds.get(testIdentifier.getUniqueIdObject()); + eventsFileWriter.append(reported(id, Instant.now()), // + reported -> reported.append(attachments(), attachments -> attachments.append(file(entry.getTimestamp()), // + file -> file.withPath(outputDir.relativize(entry.getFile()).toString())))); + } + @Override public void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) { String id = inProgressIds.remove(testIdentifier.getUniqueIdObject()); diff --git a/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatformRunnerListener.java b/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatformRunnerListener.java index e91045ee8422..2a51109e17c2 100644 --- a/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatformRunnerListener.java +++ b/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatformRunnerListener.java @@ -16,6 +16,7 @@ import org.junit.platform.engine.TestExecutionResult; import org.junit.platform.engine.TestExecutionResult.Status; import org.junit.platform.engine.UniqueId; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; import org.junit.platform.launcher.TestExecutionListener; import org.junit.platform.launcher.TestIdentifier; @@ -85,6 +86,11 @@ public void reportingEntryPublished(TestIdentifier testIdentifier, ReportEntry e System.out.println(entry); } + @Override + public void fileEntryPublished(TestIdentifier testIdentifier, FileEntry file) { + System.out.println(file); + } + private Failure toFailure(TestExecutionResult testExecutionResult, Description description) { return new Failure(description, testExecutionResult.getThrowable().orElse(null)); } diff --git a/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilder.java b/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilder.java index 610bc0524e8d..56fd410ce06e 100644 --- a/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilder.java +++ b/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilder.java @@ -41,6 +41,7 @@ import org.junit.platform.engine.discovery.DiscoverySelectors; import org.junit.platform.engine.discovery.MethodSelector; import org.junit.platform.engine.discovery.PackageNameFilter; +import org.junit.platform.engine.reporting.OutputDirectoryProvider; import org.junit.platform.launcher.EngineFilter; import org.junit.platform.launcher.LauncherDiscoveryRequest; import org.junit.platform.launcher.TagFilter; @@ -261,6 +262,12 @@ public SuiteLauncherDiscoveryRequestBuilder enableImplicitConfigurationParameter return this; } + public SuiteLauncherDiscoveryRequestBuilder outputDirectoryProvider( + OutputDirectoryProvider outputDirectoryProvider) { + delegate.outputDirectoryProvider(outputDirectoryProvider); + return this; + } + /** * Apply a suite's annotation-based configuration, selectors, and filters to * this builder. diff --git a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/ClassSelectorResolver.java b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/ClassSelectorResolver.java index ce9107310ecf..6e7dfffe05a9 100644 --- a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/ClassSelectorResolver.java +++ b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/ClassSelectorResolver.java @@ -25,6 +25,7 @@ import org.junit.platform.engine.UniqueId.Segment; import org.junit.platform.engine.discovery.ClassSelector; import org.junit.platform.engine.discovery.UniqueIdSelector; +import org.junit.platform.engine.reporting.OutputDirectoryProvider; import org.junit.platform.engine.support.discovery.SelectorResolver; /** @@ -39,12 +40,14 @@ final class ClassSelectorResolver implements SelectorResolver { private final Predicate classNameFilter; private final SuiteEngineDescriptor suiteEngineDescriptor; private final ConfigurationParameters configurationParameters; + private final OutputDirectoryProvider outputDirectoryProvider; ClassSelectorResolver(Predicate classNameFilter, SuiteEngineDescriptor suiteEngineDescriptor, - ConfigurationParameters configurationParameters) { + ConfigurationParameters configurationParameters, OutputDirectoryProvider outputDirectoryProvider) { this.classNameFilter = classNameFilter; this.suiteEngineDescriptor = suiteEngineDescriptor; this.configurationParameters = configurationParameters; + this.outputDirectoryProvider = outputDirectoryProvider; } @Override @@ -103,7 +106,7 @@ private Optional newSuiteDescriptor(Class suiteClass, Te return Optional.empty(); } - return Optional.of(new SuiteTestDescriptor(id, suiteClass, configurationParameters)); + return Optional.of(new SuiteTestDescriptor(id, suiteClass, configurationParameters, outputDirectoryProvider)); } private static boolean containsCycle(UniqueId id) { diff --git a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/DiscoverySelectorResolver.java b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/DiscoverySelectorResolver.java index 15d31d65ccc2..8fc2bbeef786 100644 --- a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/DiscoverySelectorResolver.java +++ b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/DiscoverySelectorResolver.java @@ -25,7 +25,8 @@ final class DiscoverySelectorResolver { .addSelectorResolver(context -> new ClassSelectorResolver( context.getClassNameFilter(), context.getEngineDescriptor(), - context.getDiscoveryRequest().getConfigurationParameters())) + context.getDiscoveryRequest().getConfigurationParameters(), + context.getDiscoveryRequest().getOutputDirectoryProvider())) .build(); // @formatter:on diff --git a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestDescriptor.java b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestDescriptor.java index ded5d53aebc2..779c2a03bc3a 100644 --- a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestDescriptor.java +++ b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestDescriptor.java @@ -26,6 +26,7 @@ import org.junit.platform.engine.TestExecutionResult; import org.junit.platform.engine.UniqueId; import org.junit.platform.engine.discovery.DiscoverySelectors; +import org.junit.platform.engine.reporting.OutputDirectoryProvider; import org.junit.platform.engine.support.descriptor.AbstractTestDescriptor; import org.junit.platform.engine.support.descriptor.ClassSource; import org.junit.platform.engine.support.hierarchical.OpenTest4JAwareThrowableCollector; @@ -53,15 +54,18 @@ final class SuiteTestDescriptor extends AbstractTestDescriptor { private final SuiteLauncherDiscoveryRequestBuilder discoveryRequestBuilder = request(); private final ConfigurationParameters configurationParameters; + private final OutputDirectoryProvider outputDirectoryProvider; private final Boolean failIfNoTests; private final Class suiteClass; private LauncherDiscoveryResult launcherDiscoveryResult; private SuiteLauncher launcher; - SuiteTestDescriptor(UniqueId id, Class suiteClass, ConfigurationParameters configurationParameters) { + SuiteTestDescriptor(UniqueId id, Class suiteClass, ConfigurationParameters configurationParameters, + OutputDirectoryProvider outputDirectoryProvider) { super(id, getSuiteDisplayName(suiteClass), ClassSource.from(suiteClass)); this.configurationParameters = configurationParameters; + this.outputDirectoryProvider = outputDirectoryProvider; this.failIfNoTests = getFailIfNoTests(suiteClass); this.suiteClass = suiteClass; } @@ -99,6 +103,7 @@ void discover() { .enableImplicitConfigurationParameters(false) .parentConfigurationParameters(configurationParameters) .applyConfigurationParametersFromSuite(suiteClass) + .outputDirectoryProvider(outputDirectoryProvider) .build(); // @formatter:on this.launcher = SuiteLauncher.create(); diff --git a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EngineTestKit.java b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EngineTestKit.java index 23884df7577b..0d2b634bb01e 100644 --- a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EngineTestKit.java +++ b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EngineTestKit.java @@ -13,15 +13,18 @@ import static java.util.Collections.emptySet; import static java.util.Collections.singleton; import static org.apiguardian.api.API.Status.DEPRECATED; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.MAINTAINED; import static org.apiguardian.api.API.Status.STABLE; import static org.junit.platform.launcher.core.EngineDiscoveryOrchestrator.Phase.EXECUTION; +import java.nio.file.Path; import java.util.Map; import java.util.ServiceLoader; import java.util.stream.Stream; import org.apiguardian.api.API; +import org.junit.platform.commons.JUnitException; import org.junit.platform.commons.PreconditionViolationException; import org.junit.platform.commons.util.CollectionUtils; import org.junit.platform.commons.util.Preconditions; @@ -34,6 +37,7 @@ import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.TestEngine; import org.junit.platform.engine.UniqueId; +import org.junit.platform.engine.reporting.OutputDirectoryProvider; import org.junit.platform.launcher.LauncherDiscoveryRequest; import org.junit.platform.launcher.core.EngineDiscoveryOrchestrator; import org.junit.platform.launcher.core.EngineExecutionOrchestrator; @@ -249,7 +253,7 @@ private static void executeDirectly(TestEngine testEngine, EngineDiscoveryReques EngineExecutionListener listener) { UniqueId engineUniqueId = UniqueId.forEngine(testEngine.getId()); TestDescriptor engineTestDescriptor = testEngine.discover(discoveryRequest, engineUniqueId); - ExecutionRequest request = new ExecutionRequest(engineTestDescriptor, listener, + ExecutionRequest request = ExecutionRequest.create(engineTestDescriptor, listener, discoveryRequest.getConfigurationParameters()); testEngine.execute(request); } @@ -295,7 +299,8 @@ private EngineTestKit() { public static final class Builder { private final LauncherDiscoveryRequestBuilder requestBuilder = LauncherDiscoveryRequestBuilder.request() // - .enableImplicitConfigurationParameters(false); + .enableImplicitConfigurationParameters(false) // + .outputDirectoryProvider(DisabledOutputDirectoryProvider.INSTANCE); private final TestEngine testEngine; private Builder(TestEngine testEngine) { @@ -422,6 +427,25 @@ public Builder enableImplicitConfigurationParameters(boolean enabled) { return this; } + /** + * Set the {@link OutputDirectoryProvider} to use. + * + *

    If not specified, a default provider will be used that throws an + * exception when attempting to create output directories. This is done + * to avoid accidentally writing output files to the file system. + * + * @param outputDirectoryProvider the output directory provider to use; + * never {@code null} + * @return this builder for method chaining + * @since 1.12 + * @see OutputDirectoryProvider + */ + @API(status = EXPERIMENTAL, since = "1.12") + public Builder outputDirectoryProvider(OutputDirectoryProvider outputDirectoryProvider) { + this.requestBuilder.outputDirectoryProvider(outputDirectoryProvider); + return this; + } + /** * Execute tests for the configured {@link TestEngine}, * {@linkplain DiscoverySelector discovery selectors}, @@ -441,6 +465,27 @@ public EngineExecutionResults execute() { return executionRecorder.getExecutionResults(); } + private static class DisabledOutputDirectoryProvider implements OutputDirectoryProvider { + + public static final OutputDirectoryProvider INSTANCE = new DisabledOutputDirectoryProvider(); + + private static final String FAILURE_MESSAGE = "Writing outputs is disabled by default when using EngineTestKit. " + + "To enable, configure a custom OutputDirectoryProvider via EngineTestKit#outputDirectoryProvider."; + + private DisabledOutputDirectoryProvider() { + } + + @Override + public Path getRootDirectory() { + throw new JUnitException(FAILURE_MESSAGE); + } + + @Override + public Path createOutputDirectory(TestDescriptor testDescriptor) { + throw new JUnitException(FAILURE_MESSAGE); + } + + } } } diff --git a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Event.java b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Event.java index 190a7aaf5510..08069dfeea17 100644 --- a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Event.java +++ b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Event.java @@ -10,6 +10,7 @@ package org.junit.platform.testkit.engine; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.MAINTAINED; import static org.junit.platform.commons.util.FunctionUtils.where; @@ -22,6 +23,7 @@ import org.junit.platform.commons.util.ToStringBuilder; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.TestExecutionResult; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; /** @@ -51,6 +53,23 @@ public static Event reportingEntryPublished(TestDescriptor testDescriptor, Repor return new Event(EventType.REPORTING_ENTRY_PUBLISHED, testDescriptor, entry); } + /** + * Create an {@code Event} for a published file for the supplied + * {@link TestDescriptor} and {@link FileEntry}. + * + * @param testDescriptor the {@code TestDescriptor} associated with the + * event; never {@code null} + * @param file the {@code FileEntry} that was published; never {@code null} + * @return the newly created {@code Event} + * @since 1.12 + * @see EventType#FILE_ENTRY_PUBLISHED + */ + @API(status = EXPERIMENTAL, since = "1.12") + public static Event fileEntryPublished(TestDescriptor testDescriptor, FileEntry file) { + Preconditions.notNull(file, "FileEntry must not be null"); + return new Event(EventType.FILE_ENTRY_PUBLISHED, testDescriptor, file); + } + /** * Create an {@code Event} for the dynamic registration of the * supplied {@link TestDescriptor}. diff --git a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventConditions.java b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventConditions.java index 3431252cbef2..339321e3c5b5 100644 --- a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventConditions.java +++ b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventConditions.java @@ -12,6 +12,7 @@ import static java.util.function.Predicate.isEqual; import static java.util.stream.Collectors.toList; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.MAINTAINED; import static org.apiguardian.api.API.Status.STABLE; import static org.assertj.core.api.Assertions.allOf; @@ -27,6 +28,7 @@ import static org.junit.platform.testkit.engine.EventType.SKIPPED; import static org.junit.platform.testkit.engine.EventType.STARTED; +import java.nio.file.Path; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -42,6 +44,7 @@ import org.junit.platform.engine.TestExecutionResult; import org.junit.platform.engine.TestExecutionResult.Status; import org.junit.platform.engine.UniqueId; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; import org.junit.platform.engine.support.descriptor.EngineDescriptor; @@ -470,4 +473,18 @@ public static Condition reportEntry(Map keyValuePairs) { "event for report entry with key-value pairs %s", keyValuePairs); } + /** + * Create a new {@link Condition} that matches if and only if an + * {@link Event}'s {@linkplain Event#getPayload() payload} is an instance of + * {@link FileEntry} that contains a file that matches the supplied + * {@link Predicate}. + * + * @since 1.12 + */ + @API(status = EXPERIMENTAL, since = "1.12") + public static Condition fileEntry(Predicate filePredicate) { + return new Condition<>(byPayload(FileEntry.class, it -> filePredicate.test(it.getFile())), + "event for file entry with custom predicate"); + } + } diff --git a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventStatistics.java b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventStatistics.java index bd1cf3e06262..f052d2f2b486 100644 --- a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventStatistics.java +++ b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventStatistics.java @@ -10,6 +10,7 @@ package org.junit.platform.testkit.engine; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.MAINTAINED; import static org.junit.platform.testkit.engine.Assertions.assertEquals; @@ -127,6 +128,20 @@ public EventStatistics reportingEntryPublished(long expected) { return this; } + /** + * Specify the number of expected file entry publication events. + * + * @param expected the expected number of events + * @return this {@code EventStatistics} for method chaining + * @since 1.12 + */ + @API(status = EXPERIMENTAL, since = "1.12") + public EventStatistics fileEntryPublished(long expected) { + this.executables.add( + () -> assertEquals(expected, this.events.fileEntryPublished().count(), "file entry published")); + return this; + } + /** * Specify the number of expected dynamic registration events. * diff --git a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventType.java b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventType.java index 09a6bdb59833..7bb029ad9929 100644 --- a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventType.java +++ b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventType.java @@ -10,11 +10,13 @@ package org.junit.platform.testkit.engine; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.MAINTAINED; import org.apiguardian.api.API; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.TestExecutionResult; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; /** @@ -60,6 +62,15 @@ public enum EventType { * * @see org.junit.platform.engine.EngineExecutionListener#reportingEntryPublished(TestDescriptor, ReportEntry) */ - REPORTING_ENTRY_PUBLISHED + REPORTING_ENTRY_PUBLISHED, + + /** + * Signals that a {@link TestDescriptor} published a file entry. + * + * @since 1.12 + * @see org.junit.platform.engine.EngineExecutionListener#fileEntryPublished(TestDescriptor, FileEntry) + */ + @API(status = EXPERIMENTAL, since = "1.12") + FILE_ENTRY_PUBLISHED } diff --git a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Events.java b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Events.java index 256ea9f2d2d3..9f688eb9d763 100644 --- a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Events.java +++ b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Events.java @@ -13,6 +13,7 @@ import static java.util.Collections.sort; import static java.util.function.Predicate.isEqual; import static java.util.stream.Collectors.toList; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.MAINTAINED; import static org.junit.platform.commons.util.FunctionUtils.where; import static org.junit.platform.testkit.engine.Event.byPayload; @@ -207,6 +208,18 @@ public Events reportingEntryPublished() { this.category + " Reporting Entry Published"); } + /** + * Get the file entry publication {@link Events} contained in this + * {@code Events} object. + * + * @return the filtered {@code Events}; never {@code null} + * @since 1.12 + */ + @API(status = EXPERIMENTAL, since = "1.12") + public Events fileEntryPublished() { + return new Events(eventsByType(EventType.FILE_ENTRY_PUBLISHED), this.category + " File Entry Published"); + } + /** * Get the dynamic registration {@link Events} contained in this * {@code Events} object. diff --git a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/ExecutionRecorder.java b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/ExecutionRecorder.java index c7f42f5693af..1f375f3a4e33 100644 --- a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/ExecutionRecorder.java +++ b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/ExecutionRecorder.java @@ -10,6 +10,7 @@ package org.junit.platform.testkit.engine; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.MAINTAINED; import java.util.List; @@ -19,6 +20,7 @@ import org.junit.platform.engine.EngineExecutionListener; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.TestExecutionResult; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; /** @@ -82,6 +84,17 @@ public void reportingEntryPublished(TestDescriptor testDescriptor, ReportEntry e this.events.add(Event.reportingEntryPublished(testDescriptor, entry)); } + /** + * Record an {@link Event} for a published {@link FileEntry}. + * + * @since 1.12 + */ + @API(status = EXPERIMENTAL, since = "1.12") + @Override + public void fileEntryPublished(TestDescriptor testDescriptor, FileEntry file) { + this.events.add(Event.fileEntryPublished(testDescriptor, file)); + } + /** * Get the state of the engine's execution in the form of {@link EngineExecutionResults}. * diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineExecutionTests.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineExecutionTests.java index dee38a4fec62..531016e16b4f 100644 --- a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineExecutionTests.java +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineExecutionTests.java @@ -46,7 +46,6 @@ import org.junit.platform.engine.TestEngine; import org.junit.platform.engine.TestExecutionResult; import org.junit.platform.engine.UniqueId; -import org.junit.platform.engine.reporting.ReportEntry; import org.junit.platform.launcher.LauncherDiscoveryRequest; import org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder; import org.junit.platform.testkit.engine.EngineExecutionResults; @@ -397,14 +396,6 @@ public void executionSkipped(TestDescriptor testDescriptor, String reason) { PlainJUnit4TestCaseWithLifecycleMethods.EVENTS.add( "executionSkipped:" + testDescriptor.getDisplayName()); } - - @Override - public void dynamicTestRegistered(TestDescriptor testDescriptor) { - } - - @Override - public void reportingEntryPublished(TestDescriptor testDescriptor, ReportEntry entry) { - } }; execute(testClass, listener); @@ -933,7 +924,7 @@ private static void execute(Class testClass, EngineExecutionListener listener var discoveryRequest = request(testClass); var engineTestDescriptor = testEngine.discover(discoveryRequest, UniqueId.forEngine(testEngine.getId())); testEngine.execute( - new ExecutionRequest(engineTestDescriptor, listener, discoveryRequest.getConfigurationParameters())); + ExecutionRequest.create(engineTestDescriptor, listener, discoveryRequest.getConfigurationParameters())); } private static LauncherDiscoveryRequest request(Class testClass) { diff --git a/jupiter-tests/jupiter-tests.gradle.kts b/jupiter-tests/jupiter-tests.gradle.kts index a6557280218c..061920f4d96d 100644 --- a/jupiter-tests/jupiter-tests.gradle.kts +++ b/jupiter-tests/jupiter-tests.gradle.kts @@ -23,6 +23,7 @@ dependencies { testImplementation(libs.memoryfilesystem) testImplementation(testFixtures(projects.junitJupiterApi)) testImplementation(testFixtures(projects.junitJupiterEngine)) + testImplementation(testFixtures(projects.junitPlatformLauncher)) testImplementation(testFixtures(projects.junitPlatformReporting)) } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/AbstractJupiterTestEngineTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/AbstractJupiterTestEngineTests.java index 209f07cc4767..b868af74f87f 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/AbstractJupiterTestEngineTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/AbstractJupiterTestEngineTests.java @@ -14,6 +14,7 @@ import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectMethod; import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; +import static org.junit.platform.launcher.core.OutputDirectoryProviders.dummyOutputDirectoryProvider; import java.util.Set; @@ -39,7 +40,7 @@ protected EngineExecutionResults executeTestsForClass(Class testClass) { } protected EngineExecutionResults executeTests(DiscoverySelector... selectors) { - return executeTests(request().selectors(selectors)); + return executeTests(request().selectors(selectors).outputDirectoryProvider(dummyOutputDirectoryProvider())); } protected EngineExecutionResults executeTests(LauncherDiscoveryRequestBuilder builder) { @@ -51,7 +52,8 @@ protected EngineExecutionResults executeTests(LauncherDiscoveryRequest request) } protected TestDescriptor discoverTests(DiscoverySelector... selectors) { - return discoverTests(request().selectors(selectors).build()); + return discoverTests( + request().selectors(selectors).outputDirectoryProvider(dummyOutputDirectoryProvider()).build()); } protected TestDescriptor discoverTests(LauncherDiscoveryRequest request) { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java index 19176dd10003..4cf84f61e430 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java @@ -10,20 +10,28 @@ package org.junit.jupiter.engine; -import static java.util.Collections.emptyMap; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.engine.Constants.DEFAULT_TEST_INSTANCE_LIFECYCLE_PROPERTY_NAME; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; - +import static org.junit.platform.launcher.core.OutputDirectoryProviders.hierarchicalOutputDirectoryProvider; +import static org.junit.platform.testkit.engine.EventConditions.fileEntry; +import static org.junit.platform.testkit.engine.EventConditions.reportEntry; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.HashMap; import java.util.Map; +import java.util.function.Predicate; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance.Lifecycle; import org.junit.jupiter.api.TestReporter; +import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; import org.junit.platform.commons.PreconditionViolationException; @@ -35,20 +43,42 @@ class ReportingTests extends AbstractJupiterTestEngineTests { @ParameterizedTest @CsvSource(textBlock = """ - PER_CLASS, 7 - PER_METHOD, 9 + PER_CLASS, 1, 7, 5 + PER_METHOD, 0, 9, 7 """) - void reportEntriesArePublished(Lifecycle lifecycle, int expectedReportEntryCount) { + void reportAndFileEntriesArePublished(Lifecycle lifecycle, int containerEntries, int testReportEntries, + int testFileEntries, @TempDir Path tempDir) { var request = request() // .selectors(selectClass(MyReportingTestCase.class)) // - .configurationParameter(DEFAULT_TEST_INSTANCE_LIFECYCLE_PROPERTY_NAME, lifecycle.name()); - executeTests(request) // + .configurationParameter(DEFAULT_TEST_INSTANCE_LIFECYCLE_PROPERTY_NAME, lifecycle.name()) // + .outputDirectoryProvider(hierarchicalOutputDirectoryProvider(tempDir)); + + var results = executeTests(request); + + results // + .containerEvents() // + .assertStatistics(stats -> stats // + .started(2) // + .succeeded(2) // + .reportingEntryPublished(containerEntries) // + .fileEntryPublished(containerEntries)); + + results // .testEvents() // .assertStatistics(stats -> stats // .started(2) // .succeeded(2) // - .failed(0) // - .reportingEntryPublished(expectedReportEntryCount)); + .reportingEntryPublished(testReportEntries) // + .fileEntryPublished(testFileEntries)) // + .assertThatEvents() // + .haveExactly(2, reportEntry(Map.of("value", "@BeforeEach"))) // + .haveExactly(2, fileEntry(nameAndContent("beforeEach"))) // + .haveExactly(1, reportEntry(Map.of())) // + .haveExactly(1, reportEntry(Map.of("user name", "dk38"))) // + .haveExactly(1, reportEntry(Map.of("value", "message"))) // + .haveExactly(1, fileEntry(nameAndContent("succeedingTest"))) // + .haveExactly(2, reportEntry(Map.of("value", "@AfterEach"))) // + .haveExactly(2, fileEntry(nameAndContent("afterEach"))); } @SuppressWarnings("JUnitMalformedDeclaration") @@ -57,23 +87,27 @@ static class MyReportingTestCase { public MyReportingTestCase(TestReporter reporter) { // Reported on class-level for PER_CLASS lifecycle and on method-level for PER_METHOD lifecycle reporter.publishEntry("Constructor"); + reporter.publishFile("constructor", file -> Files.writeString(file, "constructor")); } @BeforeEach void beforeEach(TestReporter reporter) { reporter.publishEntry("@BeforeEach"); + reporter.publishFile("beforeEach", file -> Files.writeString(file, "beforeEach")); } @AfterEach void afterEach(TestReporter reporter) { reporter.publishEntry("@AfterEach"); + reporter.publishFile("afterEach", file -> Files.writeString(file, "afterEach")); } @Test void succeedingTest(TestReporter reporter) { - reporter.publishEntry(emptyMap()); + reporter.publishEntry(Map.of()); reporter.publishEntry("user name", "dk38"); reporter.publishEntry("message"); + reporter.publishFile("succeedingTest", file -> Files.writeString(file, "succeedingTest")); } @Test @@ -101,4 +135,15 @@ void invalidReportData(TestReporter reporter) { } + private static Predicate nameAndContent(String expectedName) { + return file -> { + try { + return Path.of(expectedName).equals(file.getFileName()) && expectedName.equals(Files.readString(file)); + } + catch (IOException e) { + throw new UncheckedIOException(e); + } + }; + } + } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/config/DefaultJupiterConfigurationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/config/DefaultJupiterConfigurationTests.java index a6c1d9919e56..2b329c1704c1 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/config/DefaultJupiterConfigurationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/config/DefaultJupiterConfigurationTests.java @@ -17,6 +17,7 @@ import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_METHOD; import static org.junit.jupiter.api.io.CleanupMode.ALWAYS; import static org.junit.jupiter.engine.Constants.DEFAULT_TEST_INSTANCE_LIFECYCLE_PROPERTY_NAME; +import static org.junit.platform.launcher.core.OutputDirectoryProviders.dummyOutputDirectoryProvider; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -44,20 +45,20 @@ class DefaultJupiterConfigurationTests { @Test void getDefaultTestInstanceLifecyclePreconditions() { PreconditionViolationException exception = assertThrows(PreconditionViolationException.class, - () -> new DefaultJupiterConfiguration(null)); + () -> new DefaultJupiterConfiguration(null, dummyOutputDirectoryProvider())); assertThat(exception).hasMessage("ConfigurationParameters must not be null"); } @Test void getDefaultTestInstanceLifecycleWithNoConfigParamSet() { - JupiterConfiguration configuration = new DefaultJupiterConfiguration(mock()); + JupiterConfiguration configuration = new DefaultJupiterConfiguration(mock(), dummyOutputDirectoryProvider()); Lifecycle lifecycle = configuration.getDefaultTestInstanceLifecycle(); assertThat(lifecycle).isEqualTo(PER_METHOD); } @Test void getDefaultTempDirCleanupModeWithNoConfigParamSet() { - JupiterConfiguration configuration = new DefaultJupiterConfiguration(mock()); + JupiterConfiguration configuration = new DefaultJupiterConfiguration(mock(), dummyOutputDirectoryProvider()); CleanupMode cleanupMode = configuration.getDefaultTempDirCleanupMode(); assertThat(cleanupMode).isEqualTo(ALWAYS); } @@ -82,7 +83,8 @@ void shouldGetDefaultDisplayNameGeneratorWithConfigParamSet() { ConfigurationParameters parameters = mock(); String key = Constants.DEFAULT_DISPLAY_NAME_GENERATOR_PROPERTY_NAME; when(parameters.get(key)).thenReturn(Optional.of(CustomDisplayNameGenerator.class.getName())); - JupiterConfiguration configuration = new DefaultJupiterConfiguration(parameters); + JupiterConfiguration configuration = new DefaultJupiterConfiguration(parameters, + dummyOutputDirectoryProvider()); DisplayNameGenerator defaultDisplayNameGenerator = configuration.getDefaultDisplayNameGenerator(); @@ -94,7 +96,8 @@ void shouldGetStandardAsDefaultDisplayNameGeneratorWithoutConfigParamSet() { ConfigurationParameters parameters = mock(); String key = Constants.DEFAULT_DISPLAY_NAME_GENERATOR_PROPERTY_NAME; when(parameters.get(key)).thenReturn(Optional.empty()); - JupiterConfiguration configuration = new DefaultJupiterConfiguration(parameters); + JupiterConfiguration configuration = new DefaultJupiterConfiguration(parameters, + dummyOutputDirectoryProvider()); DisplayNameGenerator defaultDisplayNameGenerator = configuration.getDefaultDisplayNameGenerator(); @@ -106,7 +109,8 @@ void shouldGetNothingAsDefaultTestMethodOrderWithoutConfigParamSet() { ConfigurationParameters parameters = mock(); String key = Constants.DEFAULT_TEST_METHOD_ORDER_PROPERTY_NAME; when(parameters.get(key)).thenReturn(Optional.empty()); - JupiterConfiguration configuration = new DefaultJupiterConfiguration(parameters); + JupiterConfiguration configuration = new DefaultJupiterConfiguration(parameters, + dummyOutputDirectoryProvider()); final Optional defaultTestMethodOrder = configuration.getDefaultTestMethodOrderer(); @@ -118,7 +122,8 @@ void shouldGetDefaultTempDirFactorySupplierWithConfigParamSet() { ConfigurationParameters parameters = mock(); String key = Constants.DEFAULT_TEMP_DIR_FACTORY_PROPERTY_NAME; when(parameters.get(key)).thenReturn(Optional.of(CustomFactory.class.getName())); - JupiterConfiguration configuration = new DefaultJupiterConfiguration(parameters); + JupiterConfiguration configuration = new DefaultJupiterConfiguration(parameters, + dummyOutputDirectoryProvider()); Supplier supplier = configuration.getDefaultTempDirFactorySupplier(); @@ -138,7 +143,8 @@ void shouldGetStandardAsDefaultTempDirFactorySupplierWithoutConfigParamSet() { ConfigurationParameters parameters = mock(); String key = Constants.DEFAULT_TEMP_DIR_FACTORY_PROPERTY_NAME; when(parameters.get(key)).thenReturn(Optional.empty()); - JupiterConfiguration configuration = new DefaultJupiterConfiguration(parameters); + JupiterConfiguration configuration = new DefaultJupiterConfiguration(parameters, + dummyOutputDirectoryProvider()); Supplier supplier = configuration.getDefaultTempDirFactorySupplier(); @@ -148,7 +154,8 @@ void shouldGetStandardAsDefaultTempDirFactorySupplierWithoutConfigParamSet() { private void assertDefaultConfigParam(String configValue, Lifecycle expected) { ConfigurationParameters configParams = mock(); when(configParams.get(KEY)).thenReturn(Optional.ofNullable(configValue)); - Lifecycle lifecycle = new DefaultJupiterConfiguration(configParams).getDefaultTestInstanceLifecycle(); + Lifecycle lifecycle = new DefaultJupiterConfiguration(configParams, + dummyOutputDirectoryProvider()).getDefaultTestInstanceLifecycle(); assertThat(lifecycle).isEqualTo(expected); } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java index 779ff8620904..66caeeb639f5 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java @@ -16,6 +16,7 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Named.named; +import static org.junit.platform.launcher.core.OutputDirectoryProviders.dummyOutputDirectoryProvider; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -280,7 +281,8 @@ void usingStore() { @ParameterizedTest @MethodSource("extensionContextFactories") void configurationParameter(Function extensionContextFactory) { - JupiterConfiguration echo = new DefaultJupiterConfiguration(new EchoParameters()); + JupiterConfiguration echo = new DefaultJupiterConfiguration(new EchoParameters(), + dummyOutputDirectoryProvider()); String key = "123"; Optional expected = Optional.of(key); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestInstanceLifecycleUtilsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestInstanceLifecycleUtilsTests.java index 2bbdf1321a95..4a6e6294d80a 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestInstanceLifecycleUtilsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestInstanceLifecycleUtilsTests.java @@ -16,6 +16,7 @@ import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_METHOD; import static org.junit.jupiter.engine.Constants.DEFAULT_TEST_INSTANCE_LIFECYCLE_PROPERTY_NAME; import static org.junit.jupiter.engine.descriptor.TestInstanceLifecycleUtils.getTestInstanceLifecycle; +import static org.junit.platform.launcher.core.OutputDirectoryProviders.dummyOutputDirectoryProvider; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -50,7 +51,8 @@ class TestInstanceLifecycleUtilsTests { @Test void getTestInstanceLifecyclePreconditions() { PreconditionViolationException exception = assertThrows(PreconditionViolationException.class, - () -> getTestInstanceLifecycle(null, new DefaultJupiterConfiguration(mock()))); + () -> getTestInstanceLifecycle(null, + new DefaultJupiterConfiguration(mock(), dummyOutputDirectoryProvider()))); assertThat(exception).hasMessage("testClass must not be null"); exception = assertThrows(PreconditionViolationException.class, @@ -60,7 +62,8 @@ void getTestInstanceLifecyclePreconditions() { @Test void getTestInstanceLifecycleWithNoConfigParamSet() { - Lifecycle lifecycle = getTestInstanceLifecycle(getClass(), new DefaultJupiterConfiguration(mock())); + Lifecycle lifecycle = getTestInstanceLifecycle(getClass(), + new DefaultJupiterConfiguration(mock(), dummyOutputDirectoryProvider())); assertThat(lifecycle).isEqualTo(PER_METHOD); } @@ -68,7 +71,8 @@ void getTestInstanceLifecycleWithNoConfigParamSet() { void getTestInstanceLifecycleWithConfigParamSet() { ConfigurationParameters configParams = mock(); when(configParams.get(KEY)).thenReturn(Optional.of(PER_CLASS.name().toLowerCase())); - Lifecycle lifecycle = getTestInstanceLifecycle(getClass(), new DefaultJupiterConfiguration(configParams)); + Lifecycle lifecycle = getTestInstanceLifecycle(getClass(), + new DefaultJupiterConfiguration(configParams, dummyOutputDirectoryProvider())); assertThat(lifecycle).isEqualTo(PER_CLASS); } @@ -76,21 +80,24 @@ void getTestInstanceLifecycleWithConfigParamSet() { void getTestInstanceLifecycleWithLocalConfigThatOverridesCustomDefaultSetViaConfigParam() { ConfigurationParameters configParams = mock(); when(configParams.get(KEY)).thenReturn(Optional.of(PER_CLASS.name().toLowerCase())); - Lifecycle lifecycle = getTestInstanceLifecycle(TestCase.class, new DefaultJupiterConfiguration(configParams)); + Lifecycle lifecycle = getTestInstanceLifecycle(TestCase.class, + new DefaultJupiterConfiguration(configParams, dummyOutputDirectoryProvider())); assertThat(lifecycle).isEqualTo(PER_METHOD); } @Test void getTestInstanceLifecycleFromMetaAnnotationWithNoConfigParamSet() { Class testClass = BaseMetaAnnotatedTestCase.class; - Lifecycle lifecycle = getTestInstanceLifecycle(testClass, new DefaultJupiterConfiguration(mock())); + Lifecycle lifecycle = getTestInstanceLifecycle(testClass, + new DefaultJupiterConfiguration(mock(), dummyOutputDirectoryProvider())); assertThat(lifecycle).isEqualTo(PER_CLASS); } @Test void getTestInstanceLifecycleFromSpecializedClassWithNoConfigParamSet() { Class testClass = SpecializedTestCase.class; - Lifecycle lifecycle = getTestInstanceLifecycle(testClass, new DefaultJupiterConfiguration(mock())); + Lifecycle lifecycle = getTestInstanceLifecycle(testClass, + new DefaultJupiterConfiguration(mock(), dummyOutputDirectoryProvider())); assertThat(lifecycle).isEqualTo(PER_CLASS); } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/CloseablePathTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/CloseablePathTests.java index 6a0645975813..11a55e711610 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/CloseablePathTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/CloseablePathTests.java @@ -236,7 +236,7 @@ public Path createTempDirectory(AnnotatedElementContext elementContext, Extensio @Override public void close() throws IOException { - TempDirFactory.super.close(); + fileSystem.close(); } } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/DefaultTestReporterTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/DefaultTestReporterTests.java new file mode 100644 index 000000000000..68fc7dbff8a7 --- /dev/null +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/DefaultTestReporterTests.java @@ -0,0 +1,80 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.engine.extension; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.Mockito.verify; + +import java.nio.file.Files; +import java.nio.file.NoSuchFileException; +import java.nio.file.Path; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.function.ThrowingConsumer; +import org.junit.jupiter.api.io.TempDir; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoSettings; + +@MockitoSettings +public class DefaultTestReporterTests { + + @TempDir + Path tempDir; + + @Mock + ExtensionContext extensionContext; + + @Captor + ArgumentCaptor fileNameCaptor; + + @Captor + ArgumentCaptor> actionCaptor; + + @InjectMocks + DefaultTestReporter testReporter; + + @Test + void copiesExistingFileToTarget() throws Throwable { + testReporter.publishFile(Files.writeString(tempDir.resolve("source"), "content")); + + verify(extensionContext).publishFile(fileNameCaptor.capture(), actionCaptor.capture()); + assertThat(fileNameCaptor.getValue()).isEqualTo("source"); + actionCaptor.getValue().accept(tempDir.resolve("target")); + + assertThat(tempDir.resolve("target")).hasContent("content"); + } + + @Test + void executesCustomActionWithTargetFile() throws Throwable { + testReporter.publishFile("target", file -> Files.writeString(file, "content")); + + verify(extensionContext).publishFile(fileNameCaptor.capture(), actionCaptor.capture()); + assertThat(fileNameCaptor.getValue()).isEqualTo("target"); + actionCaptor.getValue().accept(tempDir.resolve("target")); + + assertThat(tempDir.resolve("target")).hasContent("content"); + } + + @Test + void failsWhenPublishingMissingFile() { + testReporter.publishFile(tempDir.resolve("source")); + + verify(extensionContext).publishFile(fileNameCaptor.capture(), actionCaptor.capture()); + assertThat(fileNameCaptor.getValue()).isEqualTo("source"); + assertThatThrownBy(() -> actionCaptor.getValue().accept(tempDir.resolve("target"))) // + .isInstanceOf(NoSuchFileException.class); + } +} diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java index fcdd5a0a7583..638cdbf95e1f 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java @@ -22,6 +22,7 @@ import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Constructor; import java.lang.reflect.Method; +import java.nio.file.Path; import java.util.Map; import java.util.Optional; import java.util.Set; @@ -34,6 +35,7 @@ import org.junit.jupiter.api.extension.ExecutableInvoker; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.TestInstances; +import org.junit.jupiter.api.function.ThrowingConsumer; import org.junit.jupiter.api.parallel.ExecutionMode; import org.junit.jupiter.engine.execution.NamespaceAwareStore; import org.junit.jupiter.params.provider.Arguments; @@ -275,6 +277,10 @@ public Optional getConfigurationParameter(String key, Function public void publishReportEntry(Map map) { } + @Override + public void publishFile(String fileName, ThrowingConsumer action) { + } + @Override public Store getStore(Namespace namespace) { var store = new NamespaceAwareStore(this.store, namespace); diff --git a/platform-tests/src/test/java/org/junit/platform/console/tasks/ColorPaletteTests.java b/platform-tests/src/test/java/org/junit/platform/console/tasks/ColorPaletteTests.java index fce602b53011..576f2b3ed97b 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/tasks/ColorPaletteTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/tasks/ColorPaletteTests.java @@ -13,6 +13,7 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.platform.launcher.core.OutputDirectoryProviders.dummyOutputDirectoryProvider; import static org.mockito.Mockito.mock; import java.io.PrintWriter; @@ -186,7 +187,7 @@ void flat_single_color() { private void demoTestRun(TestExecutionListener listener) { TestDescriptor testDescriptor = new TestDescriptorStub(UniqueId.forEngine("demo-engine"), "My Test"); - TestPlan testPlan = TestPlan.from(List.of(testDescriptor), mock()); + TestPlan testPlan = TestPlan.from(List.of(testDescriptor), mock(), dummyOutputDirectoryProvider()); listener.testPlanExecutionStarted(testPlan); listener.executionStarted(TestIdentifier.from(testDescriptor)); listener.executionFinished(TestIdentifier.from(testDescriptor), TestExecutionResult.successful()); diff --git a/platform-tests/src/test/java/org/junit/platform/console/tasks/DiscoveryRequestCreatorTests.java b/platform-tests/src/test/java/org/junit/platform/console/tasks/DiscoveryRequestCreatorTests.java index 95e7123423bc..3e560fa1fabc 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/tasks/DiscoveryRequestCreatorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/tasks/DiscoveryRequestCreatorTests.java @@ -359,8 +359,7 @@ void convertsConfigurationParametersResources() { } private LauncherDiscoveryRequest convert() { - var creator = new DiscoveryRequestCreator(); - return creator.toDiscoveryRequest(options); + return DiscoveryRequestCreator.toDiscoveryRequestBuilder(options).build(); } private void assertIncludes(Filter filter, String included) { diff --git a/platform-tests/src/test/java/org/junit/platform/console/tasks/FlatPrintingListenerTests.java b/platform-tests/src/test/java/org/junit/platform/console/tasks/FlatPrintingListenerTests.java index 8b0c7a5a29b4..afff86ab473a 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/tasks/FlatPrintingListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/tasks/FlatPrintingListenerTests.java @@ -18,11 +18,13 @@ import java.io.PrintWriter; import java.io.StringWriter; +import java.nio.file.Path; import org.assertj.core.util.Maps; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.platform.engine.UniqueId; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; import org.junit.platform.fakes.TestDescriptorStub; import org.junit.platform.launcher.TestIdentifier; @@ -60,6 +62,19 @@ void reportingEntryPublished() { () -> assertTrue(lines[1].endsWith(", foo = 'bar']"))); } + @Test + void fileEntryPublished() { + var stringWriter = new StringWriter(); + listener(stringWriter).fileEntryPublished(newTestIdentifier(), FileEntry.from(Path.of("test.txt"))); + var lines = lines(stringWriter); + + assertEquals(2, lines.length); + assertAll("lines in the output", // + () -> assertEquals("Reported: demo-test ([engine:demo-engine])", lines[0]), // + () -> assertTrue(lines[1].startsWith(INDENTATION + "=> Reported file: FileEntry [timestamp =")), // + () -> assertTrue(lines[1].endsWith(", file = test.txt]"))); + } + @Test void executionFinishedWithFailure() { var stringWriter = new StringWriter(); diff --git a/platform-tests/src/test/java/org/junit/platform/console/tasks/TestFeedPrintingListenerTests.java b/platform-tests/src/test/java/org/junit/platform/console/tasks/TestFeedPrintingListenerTests.java index c6443a624f4e..953cda4a2d58 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/tasks/TestFeedPrintingListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/tasks/TestFeedPrintingListenerTests.java @@ -12,6 +12,7 @@ import static org.junit.jupiter.api.Assertions.assertLinesMatch; import static org.junit.platform.commons.util.CollectionUtils.getOnlyElement; +import static org.junit.platform.launcher.core.OutputDirectoryProviders.dummyOutputDirectoryProvider; import static org.mockito.Mockito.mock; import java.io.PrintWriter; @@ -44,7 +45,7 @@ void prepareListener() { "%c ool test"); engineDescriptor.addChild(testDescriptor); - testPlan = TestPlan.from(Collections.singleton(engineDescriptor), mock()); + testPlan = TestPlan.from(Collections.singleton(engineDescriptor), mock(), dummyOutputDirectoryProvider()); testIdentifier = testPlan.getTestIdentifier(testDescriptor.getUniqueId()); listener.testPlanExecutionStarted(testPlan); diff --git a/platform-tests/src/test/java/org/junit/platform/console/tasks/TreePrinterTests.java b/platform-tests/src/test/java/org/junit/platform/console/tasks/TreePrinterTests.java index 8316437899d3..7cafb539423f 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/tasks/TreePrinterTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/tasks/TreePrinterTests.java @@ -21,12 +21,14 @@ import java.io.PrintWriter; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; +import java.nio.file.Path; import java.util.List; import org.junit.jupiter.api.Test; import org.junit.platform.console.options.Theme; import org.junit.platform.engine.TestExecutionResult; import org.junit.platform.engine.UniqueId; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; import org.junit.platform.fakes.TestDescriptorStub; import org.junit.platform.launcher.TestIdentifier; @@ -92,7 +94,7 @@ void reportsAreTabbedCorrectly() { c1.addChild(m1); var m2 = new TreeNode(identifier("m-2", "method two")).setResult(successful()); - m2.addReportEntry(ReportEntry.from("key", "m-2")); + m2.addFileEntry(FileEntry.from(Path.of("test.txt"))); c1.addChild(m2); new TreePrinter(out, Theme.UNICODE, ColorPalette.NONE).print(root); @@ -105,7 +107,7 @@ void reportsAreTabbedCorrectly() { " ├─ method one ✔", // " │ ....-..-..T..:...* key = `m-1`", // " └─ method two ✔", // - " ....-..-..T..:...* key = `m-2`" // + " ....-..-..T..:...* file:.*" // ), // actual()); } diff --git a/platform-tests/src/test/java/org/junit/platform/console/tasks/VerboseTreeListenerTests.java b/platform-tests/src/test/java/org/junit/platform/console/tasks/VerboseTreePrintingListenerTests.java similarity index 87% rename from platform-tests/src/test/java/org/junit/platform/console/tasks/VerboseTreeListenerTests.java rename to platform-tests/src/test/java/org/junit/platform/console/tasks/VerboseTreePrintingListenerTests.java index 52c74188e08a..8da61de46ea8 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/tasks/VerboseTreeListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/tasks/VerboseTreePrintingListenerTests.java @@ -15,11 +15,13 @@ import java.io.PrintWriter; import java.io.StringWriter; +import java.nio.file.Path; import java.util.List; import org.junit.jupiter.api.Test; import org.junit.platform.console.options.Theme; import org.junit.platform.engine.UniqueId; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; import org.junit.platform.fakes.TestDescriptorStub; import org.junit.platform.launcher.TestIdentifier; @@ -27,7 +29,7 @@ /** * @since 1.3.2 */ -class VerboseTreeListenerTests { +class VerboseTreePrintingListenerTests { private static final String EOL = System.lineSeparator(); @@ -56,6 +58,15 @@ void reportingEntryPublished() { assertLinesMatch(List.of(" reports: ReportEntry \\[timestamp = .+, foo = 'bar'\\]"), List.of(lines)); } + @Test + void fileEntryPublished() { + var stringWriter = new StringWriter(); + listener(stringWriter).fileEntryPublished(newTestIdentifier(), FileEntry.from(Path.of("test.txt"))); + var lines = lines(stringWriter); + + assertLinesMatch(List.of(" reports: FileEntry \\[timestamp = .+, file = test.txt\\]"), List.of(lines)); + } + @Test void executionFinishedWithFailure() { var stringWriter = new StringWriter(); diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestExecutorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestExecutorTests.java index 11d1842ce4a5..057fb6a66826 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestExecutorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestExecutorTests.java @@ -77,7 +77,7 @@ void init() { private HierarchicalTestExecutor createExecutor( HierarchicalTestExecutorService executorService) { - var request = new ExecutionRequest(root, listener, null); + var request = ExecutionRequest.create(root, listener, null); return new HierarchicalTestExecutor<>(request, rootContext, executorService, OpenTest4JAwareThrowableCollector::new); } diff --git a/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingExecutionListenerIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingExecutionListenerIntegrationTests.java index 7d3fe88736a4..cef08d696d9d 100644 --- a/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingExecutionListenerIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingExecutionListenerIntegrationTests.java @@ -12,13 +12,19 @@ import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; +import static org.junit.platform.launcher.core.OutputDirectoryProviders.hierarchicalOutputDirectoryProvider; +import static org.junit.platform.reporting.testutil.FileUtils.findPath; import static org.moditect.jfrunit.ExpectedEvent.event; import static org.moditect.jfrunit.JfrEventsAssert.assertThat; +import java.nio.file.Files; +import java.nio.file.Path; + import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestReporter; import org.junit.jupiter.api.extension.DisabledOnOpenJ9; +import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.engine.JupiterTestEngine; import org.junit.platform.launcher.core.LauncherFactoryForTestingPurposesOnly; import org.moditect.jfrunit.EnableEvent; @@ -33,15 +39,18 @@ public class FlightRecordingExecutionListenerIntegrationTests { @Test @EnableEvent("org.junit.*") - void reportsEvents() { + void reportsEvents(@TempDir Path tempDir) { var launcher = LauncherFactoryForTestingPurposesOnly.createLauncher(new JupiterTestEngine()); var request = request() // .selectors(selectClass(TestCase.class)) // + .outputDirectoryProvider(hierarchicalOutputDirectoryProvider(tempDir)) // .build(); launcher.execute(request, new FlightRecordingExecutionListener()); jfrEvents.awaitEvents(); + var testFile = findPath(tempDir, "glob:**/test.txt"); + assertThat(jfrEvents) // .contains(event("org.junit.TestPlanExecution") // .with("engineNames", "JUnit Jupiter")) // @@ -59,6 +68,8 @@ void reportsEvents() { .contains(event("org.junit.ReportEntry") // .with("key", "message") // .with("value", "Hello JFR!")) // + .contains(event("org.junit.FileEntry") // + .with("path", testFile.toAbsolutePath().toString())) // .contains(event("org.junit.SkippedTest") // .with("displayName", "skipped()") // .with("type", "TEST") // @@ -70,6 +81,7 @@ static class TestCase { @Test void test(TestReporter reporter) { reporter.publishEntry("message", "Hello JFR!"); + reporter.publishFile("test.txt", file -> Files.writeString(file, "test")); } @Test diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/TestPlanTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/TestPlanTests.java index e62df473bb38..80c09b0bea04 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/TestPlanTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/TestPlanTests.java @@ -11,6 +11,7 @@ package org.junit.platform.launcher; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.platform.launcher.core.OutputDirectoryProviders.dummyOutputDirectoryProvider; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.mock; @@ -40,7 +41,7 @@ public Type getType() { } }); - var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams); + var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams, dummyOutputDirectoryProvider()); assertThat(testPlan.containsTests()).as("contains tests").isFalse(); } @@ -55,7 +56,7 @@ public Type getType() { } }); - var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams); + var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams, dummyOutputDirectoryProvider()); assertThat(testPlan.containsTests()).as("contains tests").isTrue(); } @@ -75,7 +76,7 @@ public boolean mayRegisterTests() { } }); - var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams); + var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams, dummyOutputDirectoryProvider()); assertThat(testPlan.containsTests()).as("contains tests").isTrue(); } @@ -93,7 +94,8 @@ void acceptsVisitorsInDepthFirstOrder() { engineDescriptor2.addChild(test2); engineDescriptor2.addChild(test3); - var testPlan = TestPlan.from(List.of(engineDescriptor, engineDescriptor2), configParams); + var testPlan = TestPlan.from(List.of(engineDescriptor, engineDescriptor2), configParams, + dummyOutputDirectoryProvider()); var visitor = mock(TestPlan.Visitor.class); testPlan.accept(visitor); diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/CompositeEngineExecutionListenerTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/CompositeEngineExecutionListenerTests.java index d56669e6eb80..46f26f12d7cf 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/CompositeEngineExecutionListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/CompositeEngineExecutionListenerTests.java @@ -28,6 +28,7 @@ import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.TestExecutionResult; import org.junit.platform.engine.UniqueId; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; import org.junit.platform.engine.support.descriptor.DemoMethodTestDescriptor; import org.mockito.InOrder; @@ -171,6 +172,11 @@ public void executionFinished(TestDescriptor testDescriptor, TestExecutionResult public void reportingEntryPublished(TestDescriptor testDescriptor, ReportEntry entry) { throw new RuntimeException("failed to invoke listener"); } + + @Override + public void fileEntryPublished(TestDescriptor testDescriptor, FileEntry file) { + throw new RuntimeException("failed to invoke listener"); + } } } diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/CompositeTestExecutionListenerTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/CompositeTestExecutionListenerTests.java index cf3004e23966..cb2973165fff 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/CompositeTestExecutionListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/CompositeTestExecutionListenerTests.java @@ -12,6 +12,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.platform.launcher.core.OutputDirectoryProviders.dummyOutputDirectoryProvider; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.mock; @@ -206,7 +207,7 @@ private void assertThatTestListenerErrorLogged(LogRecordListener logRecordListen } private static TestPlan anyTestPlan() { - return TestPlan.from(Set.of(anyTestDescriptor()), mock()); + return TestPlan.from(Set.of(anyTestDescriptor()), mock(), dummyOutputDirectoryProvider()); } private static DemoMethodTestDescriptor anyTestDescriptor() { diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/ExecutionListenerAdapterTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/ExecutionListenerAdapterTests.java index 0d2d5786687d..d60b569abb98 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/ExecutionListenerAdapterTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/ExecutionListenerAdapterTests.java @@ -11,6 +11,7 @@ package org.junit.platform.launcher.core; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.platform.launcher.core.OutputDirectoryProviders.dummyOutputDirectoryProvider; import static org.mockito.Mockito.mock; import java.util.Map; @@ -34,7 +35,8 @@ class ExecutionListenerAdapterTests { void testReportingEntryPublished() { var testDescriptor = getSampleMethodTestDescriptor(); - var discoveryResult = new LauncherDiscoveryResult(Map.of(mock(), testDescriptor), mock()); + var discoveryResult = new LauncherDiscoveryResult(Map.of(mock(), testDescriptor), mock(), + dummyOutputDirectoryProvider()); var testPlan = InternalTestPlan.from(discoveryResult); var testIdentifier = testPlan.getTestIdentifier(testDescriptor.getUniqueId()); diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/HierarchicalOutputDirectoryProviderTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/HierarchicalOutputDirectoryProviderTests.java new file mode 100644 index 000000000000..c5c23e3e6fa2 --- /dev/null +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/HierarchicalOutputDirectoryProviderTests.java @@ -0,0 +1,83 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.launcher.core; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.nio.file.Path; +import java.util.function.Supplier; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; +import org.junit.platform.engine.TestDescriptor; +import org.junit.platform.engine.UniqueId; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoSettings; + +@MockitoSettings +public class HierarchicalOutputDirectoryProviderTests { + + @TempDir + Path tempDir; + + @Mock + Supplier rootDirSupplier; + + @Mock + TestDescriptor testDescriptor; + + @InjectMocks + HierarchicalOutputDirectoryProvider provider; + + @BeforeEach + void prepareMock() { + when(rootDirSupplier.get()).thenReturn(tempDir); + } + + @Test + void returnsConfiguredRootDir() { + assertThat(provider.getRootDirectory()).isEqualTo(tempDir); + assertThat(provider.getRootDirectory()).isEqualTo(tempDir); + verify(rootDirSupplier, times(1)).get(); + } + + @Test + void createsSubDirectoriesBasedOnUniqueId() throws Exception { + var uniqueId = UniqueId.forEngine("engine") // + .append("irrelevant", "foo") // + .append("irrelevant", "bar"); + when(testDescriptor.getUniqueId()).thenReturn(uniqueId); + + var outputDir = provider.createOutputDirectory(testDescriptor); + + assertThat(outputDir) // + .isEqualTo(tempDir.resolve(Path.of("engine", "foo", "bar"))) // + .exists(); + } + + @Test + void replacesForbiddenCharacters() throws Exception { + var uniqueId = UniqueId.forEngine("Engine<>") // + .append("irrelevant", "*/abc"); + when(testDescriptor.getUniqueId()).thenReturn(uniqueId); + + var outputDir = provider.createOutputDirectory(testDescriptor); + + assertThat(outputDir) // + .isEqualTo(tempDir.resolve(Path.of("Engine__", "__abc"))) // + .exists(); + } +} diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/OutputDirTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/OutputDirTests.java index ecab5c1b90c5..d3ac3bea016b 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/OutputDirTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/OutputDirTests.java @@ -10,77 +10,92 @@ package org.junit.platform.launcher.listeners; +import static org.assertj.core.api.Assertions.as; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.InstanceOfAssertFactories.STRING; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.Optional; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; +import org.junit.platform.launcher.LauncherConstants; class OutputDirTests { + @TempDir + Path cwd; + @Test void getOutputDirUsesCustomOutputDir() throws Exception { - String customDir = "build/UniqueIdTrackingListenerIntegrationTests"; - Path outputDir = OutputDir.create(Optional.of(customDir)).toPath(); - assertThat(Files.isSameFile(Paths.get(customDir), outputDir)).isTrue(); + var customDir = cwd.resolve("custom-dir"); + var outputDir = OutputDir.create(Optional.of(customDir.toAbsolutePath().toString())).toPath(); + assertThat(Files.isSameFile(customDir, outputDir)).isTrue(); assertThat(outputDir).exists(); } + @Test + void getOutputDirUsesCustomOutputDirWithPlaceholder() { + var customDir = cwd.resolve("build").resolve("junit-" + LauncherConstants.OUTPUT_DIR_UNIQUE_NUMBER_PLACEHOLDER); + var outputDir = OutputDir.create(Optional.of(customDir.toAbsolutePath().toString())).toPath(); + assertThat(outputDir).exists() // + .hasParent(cwd.resolve("build")) // + .extracting(it -> it.getFileName().toString(), as(STRING)) // + .matches("junit-\\d+"); + } + @Test void getOutputDirFallsBackToCurrentWorkingDir() throws Exception { - String cwd = "src/test/resources/listeners/uidtracking"; - String expected = cwd; + var expected = cwd; - assertOutputDirIsDetected(cwd, expected); + assertOutputDirIsDetected(expected); } @Test void getOutputDirDetectsMavenPom() throws Exception { - String cwd = "src/test/resources/listeners/uidtracking/maven"; - String expected = cwd + "/target"; + Files.createFile(cwd.resolve("pom.xml")); + var expected = cwd.resolve("target"); - assertOutputDirIsDetected(cwd, expected); + assertOutputDirIsDetected(expected); } @Test void getOutputDirDetectsGradleGroovyDefaultBuildScript() throws Exception { - String cwd = "src/test/resources/listeners/uidtracking/gradle/groovy"; - String expected = cwd + "/build"; + Files.createFile(cwd.resolve("build.gradle")); + var expected = cwd.resolve("build"); - assertOutputDirIsDetected(cwd, expected); + assertOutputDirIsDetected(expected); } @Test void getOutputDirDetectsGradleGroovyCustomBuildScript() throws Exception { - String cwd = "src/test/resources/listeners/uidtracking/gradle/groovy/sub-project"; - String expected = cwd + "/build"; + Files.createFile(cwd.resolve("sub-project.gradle")); + var expected = cwd.resolve("build"); - assertOutputDirIsDetected(cwd, expected); + assertOutputDirIsDetected(expected); } @Test void getOutputDirDetectsGradleKotlinDefaultBuildScript() throws Exception { - String cwd = "src/test/resources/listeners/uidtracking/gradle/kotlin"; - String expected = cwd + "/build"; + Files.createFile(cwd.resolve("build.gradle.kts")); + var expected = cwd.resolve("build"); - assertOutputDirIsDetected(cwd, expected); + assertOutputDirIsDetected(expected); } @Test void getOutputDirDetectsGradleKotlinCustomBuildScript() throws Exception { - String cwd = "src/test/resources/listeners/uidtracking/gradle/kotlin/sub-project"; - String expected = cwd + "/build"; + Files.createFile(cwd.resolve("sub-project.gradle.kts")); + var expected = cwd.resolve("build"); - assertOutputDirIsDetected(cwd, expected); + assertOutputDirIsDetected(expected); } - private void assertOutputDirIsDetected(String cwd, String expected) throws IOException { - Path outputDir = OutputDir.createSafely(Optional.empty(), () -> Paths.get(cwd)).toPath(); - assertThat(Files.isSameFile(Paths.get(expected), outputDir)).isTrue(); + private void assertOutputDirIsDetected(Path expected) throws IOException { + var outputDir = OutputDir.createSafely(Optional.empty(), () -> cwd).toPath(); + assertThat(Files.isSameFile(expected, outputDir)).isTrue(); assertThat(outputDir).exists(); } diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/SummaryGenerationTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/SummaryGenerationTests.java index 3eeb506f44f1..70c519e08167 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/SummaryGenerationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/SummaryGenerationTests.java @@ -16,6 +16,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.platform.commons.test.ConcurrencyTestingUtils.executeConcurrently; +import static org.junit.platform.launcher.core.OutputDirectoryProviders.dummyOutputDirectoryProvider; import static org.mockito.Mockito.mock; import java.io.PrintWriter; @@ -39,7 +40,7 @@ class SummaryGenerationTests { private final SummaryGeneratingListener listener = new SummaryGeneratingListener(); - private final TestPlan testPlan = TestPlan.from(List.of(), mock()); + private final TestPlan testPlan = TestPlan.from(List.of(), mock(), dummyOutputDirectoryProvider()); @Test void emptyReport() { diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/LegacyReportingUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/LegacyReportingUtilsTests.java index 408a85ef9bc9..a9a11684c5b1 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/LegacyReportingUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/LegacyReportingUtilsTests.java @@ -11,6 +11,7 @@ package org.junit.platform.reporting.legacy; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.platform.launcher.core.OutputDirectoryProviders.dummyOutputDirectoryProvider; import static org.mockito.Mockito.mock; import java.util.Set; @@ -71,13 +72,13 @@ void legacyReportingClassNameForDescendantOfTestIdentifierWithClassSourceIsClass } private String getClassName(UniqueId uniqueId) { - var testPlan = TestPlan.from(Set.of(engineDescriptor), mock()); + var testPlan = TestPlan.from(Set.of(engineDescriptor), mock(), dummyOutputDirectoryProvider()); return LegacyReportingUtils.getClassName(testPlan, testPlan.getTestIdentifier(uniqueId)); } @SuppressWarnings("deprecation") private String getClassNameFromOldLocation(UniqueId uniqueId) { - var testPlan = TestPlan.from(Set.of(engineDescriptor), mock()); + var testPlan = TestPlan.from(Set.of(engineDescriptor), mock(), dummyOutputDirectoryProvider()); return org.junit.platform.launcher.listeners.LegacyReportingUtils.getClassName(testPlan, testPlan.getTestIdentifier(uniqueId)); } diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/LegacyXmlReportGeneratingListenerTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/LegacyXmlReportGeneratingListenerTests.java index de3b42a79f2f..1f6eeb70dc63 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/LegacyXmlReportGeneratingListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/LegacyXmlReportGeneratingListenerTests.java @@ -19,6 +19,7 @@ import static org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId; import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; import static org.junit.platform.launcher.core.LauncherFactoryForTestingPurposesOnly.createLauncher; +import static org.junit.platform.launcher.core.OutputDirectoryProviders.dummyOutputDirectoryProvider; import static org.junit.platform.reporting.legacy.xml.XmlReportAssertions.assertValidAccordingToJenkinsSchema; import static org.mockito.Mockito.mock; @@ -370,7 +371,7 @@ void printsExceptionWhenReportsDirCannotBeCreated() throws Exception { var out = new StringWriter(); var listener = new LegacyXmlReportGeneratingListener(reportsDir, new PrintWriter(out)); - listener.testPlanExecutionStarted(TestPlan.from(Set.of(), mock())); + listener.testPlanExecutionStarted(TestPlan.from(Set.of(), mock(), dummyOutputDirectoryProvider())); assertThat(out.toString()).containsSubsequence("Could not create reports directory", "FileAlreadyExistsException", "at "); @@ -386,7 +387,8 @@ void printsExceptionWhenReportCouldNotBeWritten() throws Exception { var out = new StringWriter(); var listener = new LegacyXmlReportGeneratingListener(tempDirectory, new PrintWriter(out)); - listener.testPlanExecutionStarted(TestPlan.from(Set.of(engineDescriptor), mock())); + listener.testPlanExecutionStarted( + TestPlan.from(Set.of(engineDescriptor), mock(), dummyOutputDirectoryProvider())); listener.executionFinished(TestIdentifier.from(engineDescriptor), successful()); assertThat(out.toString()).containsSubsequence("Could not write XML report", "Exception", "at "); @@ -397,7 +399,7 @@ void writesReportEntriesToSystemOutElement() throws Exception { var engineDescriptor = new EngineDescriptor(UniqueId.forEngine("engine"), "Engine"); var childUniqueId = UniqueId.root("child", "test"); engineDescriptor.addChild(new TestDescriptorStub(childUniqueId, "test")); - var testPlan = TestPlan.from(Set.of(engineDescriptor), mock()); + var testPlan = TestPlan.from(Set.of(engineDescriptor), mock(), dummyOutputDirectoryProvider()); var out = new StringWriter(); var listener = new LegacyXmlReportGeneratingListener(tempDirectory, new PrintWriter(out)); diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportDataTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportDataTests.java index 8d685654c1fa..f2890b183884 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportDataTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportDataTests.java @@ -13,6 +13,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.platform.engine.TestExecutionResult.failed; import static org.junit.platform.engine.TestExecutionResult.successful; +import static org.junit.platform.launcher.core.OutputDirectoryProviders.dummyOutputDirectoryProvider; import static org.mockito.Mockito.mock; import java.time.Clock; @@ -37,7 +38,7 @@ void resultsOfTestIdentifierWithoutAnyReportedEventsAreEmpty() { var engineDescriptor = new EngineDescriptor(UniqueId.forEngine("engine"), "Engine"); var childUniqueId = UniqueId.root("child", "test"); engineDescriptor.addChild(new TestDescriptorStub(childUniqueId, "test")); - var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams); + var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams, dummyOutputDirectoryProvider()); var reportData = new XmlReportData(testPlan, Clock.systemDefaultZone()); var results = reportData.getResults(testPlan.getTestIdentifier(childUniqueId)); @@ -50,7 +51,7 @@ void resultsOfTestIdentifierWithoutReportedEventsContainsOnlyFailureOfAncestor() var engineDescriptor = new EngineDescriptor(UniqueId.forEngine("engine"), "Engine"); var childUniqueId = UniqueId.root("child", "test"); engineDescriptor.addChild(new TestDescriptorStub(childUniqueId, "test")); - var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams); + var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams, dummyOutputDirectoryProvider()); var reportData = new XmlReportData(testPlan, Clock.systemDefaultZone()); var failureOfAncestor = failed(new RuntimeException("failed!")); @@ -66,7 +67,7 @@ void resultsOfTestIdentifierWithoutReportedEventsContainsOnlySuccessOfAncestor() var engineDescriptor = new EngineDescriptor(UniqueId.forEngine("engine"), "Engine"); var childUniqueId = UniqueId.root("child", "test"); engineDescriptor.addChild(new TestDescriptorStub(childUniqueId, "test")); - var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams); + var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams, dummyOutputDirectoryProvider()); var reportData = new XmlReportData(testPlan, Clock.systemDefaultZone()); reportData.markFinished(testPlan.getTestIdentifier(engineDescriptor.getUniqueId()), successful()); diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java index ef81af430d6e..7f8a324c50de 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java @@ -19,6 +19,7 @@ import static org.junit.platform.engine.TestExecutionResult.successful; import static org.junit.platform.launcher.LauncherConstants.STDERR_REPORT_ENTRY_KEY; import static org.junit.platform.launcher.LauncherConstants.STDOUT_REPORT_ENTRY_KEY; +import static org.junit.platform.launcher.core.OutputDirectoryProviders.dummyOutputDirectoryProvider; import static org.junit.platform.reporting.legacy.xml.XmlReportAssertions.assertValidAccordingToJenkinsSchema; import static org.mockito.Mockito.mock; @@ -54,7 +55,7 @@ class XmlReportWriterTests { @Test void writesTestsuiteElementsWithoutTestcaseElementsWithoutAnyTests() throws Exception { - var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams); + var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams, dummyOutputDirectoryProvider()); var reportData = new XmlReportData(testPlan, Clock.systemDefaultZone()); @@ -72,7 +73,7 @@ void writesReportEntry() throws Exception { var uniqueId = engineDescriptor.getUniqueId().append("test", "test"); var testDescriptor = new TestDescriptorStub(uniqueId, "successfulTest"); engineDescriptor.addChild(testDescriptor); - var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams); + var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams, dummyOutputDirectoryProvider()); var reportData = new XmlReportData(testPlan, Clock.systemDefaultZone()); reportData.addReportEntry(TestIdentifier.from(testDescriptor), ReportEntry.from("myKey", "myValue")); @@ -90,7 +91,7 @@ void writesCapturedOutput() throws Exception { var uniqueId = engineDescriptor.getUniqueId().append("test", "test"); var testDescriptor = new TestDescriptorStub(uniqueId, "successfulTest"); engineDescriptor.addChild(testDescriptor); - var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams); + var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams, dummyOutputDirectoryProvider()); var reportData = new XmlReportData(testPlan, Clock.systemDefaultZone()); var reportEntry = ReportEntry.from(Map.of( // @@ -119,7 +120,7 @@ void writesCapturedOutput() throws Exception { void writesEmptySkippedElementForSkippedTestWithoutReason() throws Exception { var uniqueId = engineDescriptor.getUniqueId().append("test", "test"); engineDescriptor.addChild(new TestDescriptorStub(uniqueId, "skippedTest")); - var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams); + var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams, dummyOutputDirectoryProvider()); var reportData = new XmlReportData(testPlan, Clock.systemDefaultZone()); reportData.markSkipped(testPlan.getTestIdentifier(uniqueId), null); @@ -149,7 +150,7 @@ public String getLegacyReportingName() { return "failedTest"; } }); - var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams); + var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams, dummyOutputDirectoryProvider()); var reportData = new XmlReportData(testPlan, Clock.systemDefaultZone()); reportData.markFinished(testPlan.getTestIdentifier(uniqueId), failed(null)); @@ -169,7 +170,7 @@ public String getLegacyReportingName() { void omitsMessageAttributeForFailedTestWithThrowableWithoutMessage() throws Exception { var uniqueId = engineDescriptor.getUniqueId().append("test", "test"); engineDescriptor.addChild(new TestDescriptorStub(uniqueId, "failedTest")); - var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams); + var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams, dummyOutputDirectoryProvider()); var reportData = new XmlReportData(testPlan, Clock.systemDefaultZone()); reportData.markFinished(testPlan.getTestIdentifier(uniqueId), failed(new NullPointerException())); @@ -186,7 +187,7 @@ void omitsMessageAttributeForFailedTestWithThrowableWithoutMessage() throws Exce void writesValidXmlEvenIfExceptionMessageContainsCData() throws Exception { var uniqueId = engineDescriptor.getUniqueId().append("test", "test"); engineDescriptor.addChild(new TestDescriptorStub(uniqueId, "test")); - var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams); + var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams, dummyOutputDirectoryProvider()); var reportData = new XmlReportData(testPlan, Clock.systemDefaultZone()); var assertionError = new AssertionError(""); @@ -202,7 +203,7 @@ void writesValidXmlEvenIfExceptionMessageContainsCData() throws Exception { void escapesInvalidCharactersInSystemPropertiesAndExceptionMessages() throws Exception { var uniqueId = engineDescriptor.getUniqueId().append("test", "test"); engineDescriptor.addChild(new TestDescriptorStub(uniqueId, "test")); - var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams); + var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams, dummyOutputDirectoryProvider()); var reportData = new XmlReportData(testPlan, Clock.systemDefaultZone()); var assertionError = new AssertionError("expected: but was: "); @@ -231,7 +232,7 @@ void escapesInvalidCharactersInSystemPropertiesAndExceptionMessages() throws Exc void doesNotReopenCDataWithinCDataContent() throws Exception { var uniqueId = engineDescriptor.getUniqueId().append("test", "test"); engineDescriptor.addChild(new TestDescriptorStub(uniqueId, "test")); - var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams); + var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams, dummyOutputDirectoryProvider()); var reportData = new XmlReportData(testPlan, Clock.systemDefaultZone()); var assertionError = new AssertionError(""); diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java index eb4a1df8cb2a..cd7792776187 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java @@ -15,14 +15,14 @@ import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.io.CleanupMode.ON_SUCCESS; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId; +import static org.junit.platform.launcher.LauncherConstants.OUTPUT_DIR_PROPERTY_NAME; +import static org.junit.platform.launcher.LauncherConstants.OUTPUT_DIR_UNIQUE_NUMBER_PLACEHOLDER; import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; import static org.junit.platform.launcher.core.LauncherFactoryForTestingPurposesOnly.createLauncher; import static org.junit.platform.reporting.open.xml.OpenTestReportGeneratingListener.ENABLED_PROPERTY_NAME; -import static org.junit.platform.reporting.open.xml.OpenTestReportGeneratingListener.OUTPUT_DIR_PROPERTY_NAME; +import static org.junit.platform.reporting.testutil.FileUtils.findPath; -import java.io.IOException; import java.net.URISyntaxException; -import java.nio.file.Files; import java.nio.file.Path; import java.util.regex.Pattern; @@ -58,11 +58,14 @@ void writesValidXmlReport() throws Exception { executeTests(engine); - var xmlFile = findXmlReport(); + var xmlFile = findPath(tempDirectory, "glob:**/open-test-report.xml"); + assertThat(tempDirectory.relativize(xmlFile).toString()) // + .matches("junit-\\d+[/\\\\]open-test-report.xml"); assertThat(validate(xmlFile)).isEmpty(); var expected = """ - testClass) { var launcher = mock(Launcher.class); var captor = ArgumentCaptor.forClass(LauncherDiscoveryRequest.class); - when(launcher.discover(captor.capture())).thenReturn(TestPlan.from(Set.of(), mock())); + when(launcher.discover(captor.capture())).thenReturn( + TestPlan.from(Set.of(), mock(), dummyOutputDirectoryProvider())); new JUnitPlatform(testClass, launcher); diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/SuiteEngineTests.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/SuiteEngineTests.java index 24d683c3397d..9675f662c5b8 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/SuiteEngineTests.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/SuiteEngineTests.java @@ -10,9 +10,11 @@ package org.junit.platform.suite.engine; +import static org.assertj.core.api.Assertions.assertThat; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId; import static org.junit.platform.launcher.TagFilter.excludeTags; +import static org.junit.platform.launcher.core.OutputDirectoryProviders.hierarchicalOutputDirectoryProvider; import static org.junit.platform.suite.engine.SuiteEngineDescriptor.ENGINE_ID; import static org.junit.platform.testkit.engine.EventConditions.container; import static org.junit.platform.testkit.engine.EventConditions.displayName; @@ -24,7 +26,10 @@ import static org.junit.platform.testkit.engine.TestExecutionResultConditions.instanceOf; import static org.junit.platform.testkit.engine.TestExecutionResultConditions.message; +import java.nio.file.Path; + import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.engine.descriptor.ClassTestDescriptor; import org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor; import org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor; @@ -65,11 +70,15 @@ */ class SuiteEngineTests { + @TempDir + private Path outputDir; + @Test void selectClasses() { // @formatter:off EngineTestKit.engine(ENGINE_ID) .selectors(selectClass(SelectClassesSuite.class)) + .outputDirectoryProvider(hierarchicalOutputDirectoryProvider(outputDir)) .execute() .testEvents() .assertThatEvents() @@ -168,6 +177,7 @@ void suiteSuite() { // @formatter:off EngineTestKit.engine(ENGINE_ID) .selectors(selectClass(SuiteSuite.class)) + .outputDirectoryProvider(hierarchicalOutputDirectoryProvider(outputDir)) .execute() .testEvents() .assertThatEvents() @@ -184,6 +194,7 @@ void selectClassesByUniqueId() { .append(SuiteTestDescriptor.SEGMENT_TYPE, SelectClassesSuite.class.getName()); EngineTestKit.engine(ENGINE_ID) .selectors(selectUniqueId(uniqId)) + .outputDirectoryProvider(hierarchicalOutputDirectoryProvider(outputDir)) .execute() .testEvents() .assertThatEvents() @@ -239,6 +250,7 @@ void selectMethodAndSuiteInTestPlanByUniqueId() { EngineTestKit.engine(ENGINE_ID) .selectors(selectUniqueId(uniqueId)) .selectors(selectClass(SelectClassesSuite.class)) + .outputDirectoryProvider(hierarchicalOutputDirectoryProvider(outputDir)) .execute() .testEvents() .assertThatEvents() @@ -391,6 +403,7 @@ void cyclicSuite() { // @formatter:off EngineTestKit.engine(ENGINE_ID) .selectors(selectClass(CyclicSuite.class)) + .outputDirectoryProvider(hierarchicalOutputDirectoryProvider(outputDir)) .execute() .allEvents() .assertThatEvents() @@ -417,6 +430,7 @@ void threePartCyclicSuite() { // @formatter:off EngineTestKit.engine(ENGINE_ID) .selectors(selectClass(ThreePartCyclicSuite.PartA.class)) + .outputDirectoryProvider(hierarchicalOutputDirectoryProvider(outputDir)) .execute() .allEvents() .assertThatEvents() @@ -429,6 +443,7 @@ void selectByIdentifier() { // @formatter:off EngineTestKit.engine(ENGINE_ID) .selectors(selectClass(SelectByIdentifierSuite.class)) + .outputDirectoryProvider(hierarchicalOutputDirectoryProvider(outputDir)) .execute() .testEvents() .assertThatEvents() @@ -437,6 +452,21 @@ void selectByIdentifier() { // @formatter:on } + @Test + void passesOutputDirectoryProviderToEnginesInSuite() { + // @formatter:off + EngineTestKit.engine(ENGINE_ID) + .selectors(selectClass(SelectClassesSuite.class)) + .outputDirectoryProvider(hierarchicalOutputDirectoryProvider(outputDir)) + .execute() + .testEvents() + .assertThatEvents() + .haveExactly(1, event(test(SingleTestTestCase.class.getName()), finishedSuccessfully())); + // @formatter:on + + assertThat(outputDir).isDirectoryRecursivelyContaining("glob:**/test.txt"); + } + @Suite @SelectClasses(SingleTestTestCase.class) private static class PrivateSuite { diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/SuiteTestDescriptorTests.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/SuiteTestDescriptorTests.java index 02ad36b35029..2f9507a01dc1 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/SuiteTestDescriptorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/SuiteTestDescriptorTests.java @@ -19,6 +19,7 @@ import java.util.Set; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestReporter; import org.junit.jupiter.engine.descriptor.ClassTestDescriptor; import org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor; import org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor; @@ -26,6 +27,8 @@ import org.junit.platform.engine.ConfigurationParameters; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.UniqueId; +import org.junit.platform.engine.reporting.OutputDirectoryProvider; +import org.junit.platform.launcher.core.OutputDirectoryProviders; import org.junit.platform.suite.api.Suite; import org.junit.platform.suite.engine.testcases.SingleTestTestCase; import org.junit.platform.suite.engine.testsuites.SelectClassesSuite; @@ -40,10 +43,13 @@ class SuiteTestDescriptorTests { final UniqueId jupiterEngineId = suiteId.append("engine", JupiterEngineDescriptor.ENGINE_ID); final UniqueId testClassId = jupiterEngineId.append(ClassTestDescriptor.SEGMENT_TYPE, SingleTestTestCase.class.getName()); - final UniqueId methodId = testClassId.append(TestMethodTestDescriptor.SEGMENT_TYPE, "test()"); + final UniqueId methodId = testClassId.append(TestMethodTestDescriptor.SEGMENT_TYPE, + "test(%s)".formatted(TestReporter.class.getName())); final ConfigurationParameters configurationParameters = new EmptyConfigurationParameters(); - final SuiteTestDescriptor suite = new SuiteTestDescriptor(suiteId, TestSuite.class, configurationParameters); + final OutputDirectoryProvider outputDirectoryProvider = OutputDirectoryProviders.dummyOutputDirectoryProvider(); + final SuiteTestDescriptor suite = new SuiteTestDescriptor(suiteId, TestSuite.class, configurationParameters, + outputDirectoryProvider); @Test void suiteIsEmptyBeforeDiscovery() { diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/SingleTestTestCase.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/SingleTestTestCase.java index fb0c0230e18d..eb6dc4734034 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/SingleTestTestCase.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/SingleTestTestCase.java @@ -10,7 +10,10 @@ package org.junit.platform.suite.engine.testcases; +import java.nio.file.Files; + import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestReporter; /** * @since 1.8 @@ -18,6 +21,7 @@ public class SingleTestTestCase { @Test - void test() { + void test(TestReporter testReporter) { + testReporter.publishFile("test.txt", file -> Files.writeString(file, "test")); } } diff --git a/platform-tests/src/test/resources/listeners/uidtracking/gradle/groovy/build.gradle b/platform-tests/src/test/resources/listeners/uidtracking/gradle/groovy/build.gradle deleted file mode 100644 index a4185e83967b..000000000000 --- a/platform-tests/src/test/resources/listeners/uidtracking/gradle/groovy/build.gradle +++ /dev/null @@ -1 +0,0 @@ -// This file is used in tests for the UniqueIdTrackingListener diff --git a/platform-tests/src/test/resources/listeners/uidtracking/gradle/groovy/sub-project/sub-project.gradle b/platform-tests/src/test/resources/listeners/uidtracking/gradle/groovy/sub-project/sub-project.gradle deleted file mode 100644 index a4185e83967b..000000000000 --- a/platform-tests/src/test/resources/listeners/uidtracking/gradle/groovy/sub-project/sub-project.gradle +++ /dev/null @@ -1 +0,0 @@ -// This file is used in tests for the UniqueIdTrackingListener diff --git a/platform-tests/src/test/resources/listeners/uidtracking/gradle/kotlin/build.gradle.kts b/platform-tests/src/test/resources/listeners/uidtracking/gradle/kotlin/build.gradle.kts deleted file mode 100644 index a4185e83967b..000000000000 --- a/platform-tests/src/test/resources/listeners/uidtracking/gradle/kotlin/build.gradle.kts +++ /dev/null @@ -1 +0,0 @@ -// This file is used in tests for the UniqueIdTrackingListener diff --git a/platform-tests/src/test/resources/listeners/uidtracking/gradle/kotlin/sub-project/sub-project.gradle.kts b/platform-tests/src/test/resources/listeners/uidtracking/gradle/kotlin/sub-project/sub-project.gradle.kts deleted file mode 100644 index a4185e83967b..000000000000 --- a/platform-tests/src/test/resources/listeners/uidtracking/gradle/kotlin/sub-project/sub-project.gradle.kts +++ /dev/null @@ -1 +0,0 @@ -// This file is used in tests for the UniqueIdTrackingListener diff --git a/platform-tests/src/test/resources/listeners/uidtracking/maven/pom.xml b/platform-tests/src/test/resources/listeners/uidtracking/maven/pom.xml deleted file mode 100644 index 1a462ec9525d..000000000000 --- a/platform-tests/src/test/resources/listeners/uidtracking/maven/pom.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/platform-tooling-support-tests/projects/graalvm-starter/build.gradle.kts b/platform-tooling-support-tests/projects/graalvm-starter/build.gradle.kts index c83d5d840ada..398dabc34424 100644 --- a/platform-tooling-support-tests/projects/graalvm-starter/build.gradle.kts +++ b/platform-tooling-support-tests/projects/graalvm-starter/build.gradle.kts @@ -31,6 +31,8 @@ tasks.test { graalvmNative { binaries { named("test") { + // TODO #3040 Add to native-image.properties + buildArgs.add("--initialize-at-build-time=org.junit.platform.launcher.core.HierarchicalOutputDirectoryProvider") buildArgs.add("-H:+ReportExceptionStackTraces") } } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java index 3f56478ef293..f9f66055fecd 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java @@ -10,9 +10,8 @@ package platform.tooling.support.tests; -import java.io.IOException; -import java.io.UncheckedIOException; -import java.nio.file.Files; +import static org.junit.platform.reporting.testutil.FileUtils.findPath; + import java.nio.file.Path; import java.util.regex.Pattern; @@ -22,22 +21,18 @@ class XmlAssertions { static void verifyContainsExpectedStartedOpenTestReport(Path testResultsDir) { - try (var files = Files.list(testResultsDir)) { - Path xmlFile = files.filter(it -> it.getFileName().toString().startsWith("junit-platform-events-")) // - .findAny() // - .orElseThrow(() -> new AssertionError("Missing open-test-reporting XML file in " + testResultsDir)); - verifyContent(xmlFile); - } - catch (IOException e) { - throw new UncheckedIOException(e); - } + var xmlFile = findPath(testResultsDir, "glob:**/open-test-report.xml"); + verifyContent(xmlFile); } private static void verifyContent(Path xmlFile) { var expected = """ - ${xmlunit.ignore} From b6ea45f2d69dd7ff524c799477f9675ac1464614 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 4 Oct 2024 13:51:22 +0200 Subject: [PATCH 320/611] Remove reference to 5.10.4 in 5.11.2 release notes --- .../docs/asciidoc/release-notes/release-notes-5.11.2.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.2.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.2.adoc index aecdaa23aac2..0bb4b292e1d9 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.2.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.2.adoc @@ -16,9 +16,9 @@ on GitHub. [[release-notes-5.11.2-junit-platform-bug-fixes]] ==== Bug Fixes -* Fix regression in parallel execution that was introduced in 5.10.4/5.11.1 regarding - global read-write locks. When such a lock was declared on descendants of top-level nodes - in the test tree, such as Cucumber scenarios, test execution failed. +* Fix regression in parallel execution that was introduced in 5.11.1 regarding global + read-write locks. When such a lock was declared on descendants of top-level nodes in the + test tree, such as Cucumber scenarios, test execution failed. [[release-notes-5.11.2-junit-jupiter]] From 0c2285aa5be9b74485d9faf153567bb38c735b45 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 10:37:46 +0100 Subject: [PATCH 321/611] Removed entry backported to 5.11.1 Resolves #3997. --- .../docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc | 2 -- 1 file changed, 2 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index fe84142c29d7..175b2c5c8de2 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -16,8 +16,6 @@ JUnit repository on GitHub. [[release-notes-5.12.0-M1-junit-platform-bug-fixes]] ==== Bug Fixes -* Fix support for disabling ANSI colors on the console when the `NO_COLOR` environment - variable is available. * Enable auto-flushing of output in the `ConsoleLauncher` to fix issues with buffering, in particular when using the `--details=testfeed` option. From 4cb0978358be5bd404bcdf562f4526f846c9885a Mon Sep 17 00:00:00 2001 From: Christian Stein Date: Wed, 27 Nov 2024 12:33:11 +0100 Subject: [PATCH 322/611] Prevent `execute` subcommand warning to be emitted --- .../projects/multi-release-jar/default/pom.xml | 2 +- .../tooling/support/tests/MultiReleaseJarTests.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml b/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml index 599ad6302bef..8b057424f19a 100644 --- a/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml +++ b/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml @@ -45,7 +45,7 @@ de.sormuras.junit junit-platform-maven-plugin - 1.1.7 + 1.1.8 true JAVA diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java index 434c4f6bfe53..ecb6920a5898 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java @@ -76,12 +76,15 @@ void checkDefault() throws Exception { var result = mvn(variant); - result.getOutputLines("out").forEach(System.out::println); + var outputLines = result.getOutputLines("out"); + outputLines.forEach(System.out::println); result.getOutputLines("err").forEach(System.err::println); assertEquals(0, result.getExitCode()); assertEquals("", result.getOutput("err")); - assertTrue(result.getOutputLines("out").contains("[INFO] BUILD SUCCESS")); + assertTrue(outputLines.contains("[INFO] BUILD SUCCESS")); + assertFalse(outputLines.contains("[WARNING] "), "Warning marker detected"); + assertFalse(outputLines.contains("[ERROR] "), "Error marker detected"); var workspace = Path.of("build/test-workspace/multi-release-jar", variant); var actualLines = Files.readAllLines(workspace.resolve("target/junit-platform/console-launcher.out.log")); From 9f1fd85113d43abd4fc621798fec10df461992bc Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 27 Nov 2024 12:47:51 +0000 Subject: [PATCH 323/611] Update bnd to v7.1.0 (#4154) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2494b410f2e8..23c1b9760369 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,7 +4,7 @@ apiguardian = "1.1.2" asciidoctorj-pdf = "2.3.19" asciidoctor-plugins = "4.0.3" # Check if workaround in documentation.gradle.kts can be removed when upgrading assertj = "3.26.3" -bnd = "7.0.0" +bnd = "7.1.0" checkstyle = "10.20.1" eclipse = "4.32.0" jackson = "2.18.1" From 7a110329c44ffc559dda07e3b667c47f18a6a0e0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 27 Nov 2024 17:43:29 +0000 Subject: [PATCH 324/611] Update plugin org.jetbrains.kotlin.jvm to v2.1.0 --- .../projects/gradle-kotlin-extensions/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts b/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts index 0f271d75bde1..e0803533465b 100644 --- a/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts +++ b/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts @@ -1,7 +1,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - kotlin("jvm") version "2.0.21" + kotlin("jvm") version "2.1.0" } repositories { From 58c09e1d802b3ed2eaa57b452e946a46d09d5eff Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 21:19:23 +0100 Subject: [PATCH 325/611] Clean report dir before running tests to avoid test failures --- documentation/documentation.gradle.kts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/documentation/documentation.gradle.kts b/documentation/documentation.gradle.kts index feeab7ed25f5..c19537403b9c 100644 --- a/documentation/documentation.gradle.kts +++ b/documentation/documentation.gradle.kts @@ -6,7 +6,7 @@ import junitbuild.javadoc.ModuleSpecificJavadocFileOption import org.asciidoctor.gradle.base.AsciidoctorAttributeProvider import org.asciidoctor.gradle.jvm.AbstractAsciidoctorTask import org.gradle.api.tasks.PathSensitivity.RELATIVE -import java.nio.file.Files +import org.jetbrains.kotlin.incremental.deleteRecursivelyOrThrow plugins { alias(libs.plugins.asciidoctorConvert) @@ -165,9 +165,7 @@ tasks { args.addAll("--exclude-tag", "timeout") doFirst { - consoleLauncherTestEventXmlFiles.files.forEach { - Files.delete(it.toPath()) - } + consoleLauncherTestReportsDir.get().asFile.deleteRecursivelyOrThrow() } finalizedBy(generateOpenTestHtmlReport) From ce59bef08acf414b7ebf13b115adf90cb38d9f39 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 21:44:11 +0100 Subject: [PATCH 326/611] Fix config parameter referenced in error message --- .../DefaultParallelExecutionConfigurationStrategy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/DefaultParallelExecutionConfigurationStrategy.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/DefaultParallelExecutionConfigurationStrategy.java index c81c192b8cc7..b8883dd2a941 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/DefaultParallelExecutionConfigurationStrategy.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/DefaultParallelExecutionConfigurationStrategy.java @@ -77,7 +77,7 @@ public ParallelExecutionConfiguration createConfiguration(ConfigurationParameter Preconditions.condition(maxPoolSizeFactor.compareTo(BigDecimal.ONE) >= 0, () -> String.format( "Factor '%s' specified via configuration parameter '%s' must be greater than or equal to 1", - factor, CONFIG_DYNAMIC_FACTOR_PROPERTY_NAME)); + factor, CONFIG_DYNAMIC_MAX_POOL_SIZE_FACTOR_PROPERTY_NAME)); return maxPoolSizeFactor.multiply(BigDecimal.valueOf(parallelism)).intValue(); }).orElseGet(() -> 256 + parallelism); From 7bb5f39eee24aed0b1a56cdf25f6e108b2018be6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 28 Nov 2024 04:04:09 +0000 Subject: [PATCH 327/611] Update jackson monorepo to v2.18.2 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 23c1b9760369..6fb73de6f0f1 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,7 @@ assertj = "3.26.3" bnd = "7.1.0" checkstyle = "10.20.1" eclipse = "4.32.0" -jackson = "2.18.1" +jackson = "2.18.2" jacoco = "0.8.12" jmh = "1.37" junit4 = "4.13.2" From bb76a7ed64f5455a2e2f587b6645cf2d4ab5894a Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 12:45:12 +0100 Subject: [PATCH 328/611] Configure default timeout for all tests --- .../platform/tooling/support/tests/GraalVmStarterTests.java | 3 +++ .../src/test/resources/junit-platform.properties | 2 ++ 2 files changed, 5 insertions(+) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java index 7e17084628f4..16a30b593976 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java @@ -10,6 +10,7 @@ package platform.tooling.support.tests; +import static java.util.concurrent.TimeUnit.MINUTES; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -21,6 +22,7 @@ import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; import org.junit.jupiter.api.extension.DisabledOnOpenJ9; import org.junit.jupiter.api.parallel.ResourceLock; @@ -40,6 +42,7 @@ class GraalVmStarterTests { @ResourceLock(Projects.GRAALVM_STARTER) @Test + @Timeout(value = 10, unit = MINUTES) void runsTestsInNativeImage() { var request = Request.builder() // .setTool(new GradleWrapper(Paths.get(".."))) // diff --git a/platform-tooling-support-tests/src/test/resources/junit-platform.properties b/platform-tooling-support-tests/src/test/resources/junit-platform.properties index 1ddeedc6a798..3d0a67b57d8a 100644 --- a/platform-tooling-support-tests/src/test/resources/junit-platform.properties +++ b/platform-tooling-support-tests/src/test/resources/junit-platform.properties @@ -5,3 +5,5 @@ junit.jupiter.execution.parallel.config.dynamic.factor=0.25 junit.jupiter.testclass.order.default = \ org.junit.jupiter.api.ClassOrderer$OrderAnnotation + +junit.jupiter.execution.timeout.default = 3 m From 09d4daf788c14aeb069d793f77ef16bba708a63f Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 12:46:07 +0100 Subject: [PATCH 329/611] Introduce custom wrapper around ProcessBuilder --- .../support/process/ProcessResult.java | 10 ++ .../support/process/ProcessStarter.java | 91 +++++++++++++++++++ .../support/process/WatchedOutput.java | 25 +++++ .../support/process/WatchedProcess.java | 49 ++++++++++ .../support/tests/AntStarterTests.java | 35 ++++--- .../tooling/support/tests/Projects.java | 9 ++ .../tooling/support/tests/XmlAssertions.java | 4 - 7 files changed, 201 insertions(+), 22 deletions(-) create mode 100644 platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessResult.java create mode 100644 platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarter.java create mode 100644 platform-tooling-support-tests/src/test/java/platform/tooling/support/process/WatchedOutput.java create mode 100644 platform-tooling-support-tests/src/test/java/platform/tooling/support/process/WatchedProcess.java diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessResult.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessResult.java new file mode 100644 index 000000000000..006ba5a89a71 --- /dev/null +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessResult.java @@ -0,0 +1,10 @@ +package platform.tooling.support.process; + +import java.time.Duration; +import java.util.List; + +public record ProcessResult(int exitCode, Duration duration, String stdOut, String stdErr) { + public List stdOutLines() { + return stdOut.lines().toList(); + } +} diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarter.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarter.java new file mode 100644 index 000000000000..c36dabad7d0d --- /dev/null +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarter.java @@ -0,0 +1,91 @@ +package platform.tooling.support.process; + +import static org.codehaus.groovy.runtime.ProcessGroovyMethods.consumeProcessErrorStream; +import static org.codehaus.groovy.runtime.ProcessGroovyMethods.consumeProcessOutputStream; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.Path; +import java.time.Instant; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Stream; + +import org.apache.commons.io.output.TeeOutputStream; + +public class ProcessStarter { + + public static ProcessStarter java() { + return javaCommand(currentJdkHome(), "java"); + } + + private static Path currentJdkHome() { + var executable = ProcessHandle.current().info().command().map(Path::of).orElseThrow(); + // path element count is 3 or higher: "/bin/java[.exe]" + return executable.getParent().getParent().toAbsolutePath(); + } + + public static ProcessStarter java(Path javaHome) { + return javaCommand(javaHome, "java"); + } + + private static ProcessStarter javaCommand(Path javaHome, String commandName) { + return new ProcessStarter() // + .executable(javaHome.resolve("bin").resolve(commandName)) // + .putEnvironment("JAVA_HOME", javaHome.toString()); + } + + private Path executable; + private Path workingDir; + private final List arguments = new ArrayList<>(); + private final Map environment = new LinkedHashMap<>(); + + public ProcessStarter executable(Path executable) { + this.executable = executable; + return this; + } + + public ProcessStarter workingDir(Path workingDir) { + this.workingDir = workingDir; + return this; + } + + public ProcessStarter addArguments(String... arguments) { + this.arguments.addAll(List.of(arguments)); + return this; + } + + public ProcessStarter putEnvironment(String key, String value) { + environment.put(key, value); + return this; + } + + public ProcessResult startAndWait() throws InterruptedException { + return start().waitFor(); + } + + public WatchedProcess start() { + var command = Stream.concat(Stream.of(executable.toAbsolutePath().toString()), arguments.stream()).toList(); + try { + var builder = new ProcessBuilder().command(command); + if (workingDir != null) { + builder.directory(workingDir.toFile()); + } + builder.environment().putAll(environment); + var start = Instant.now(); + var out = new ByteArrayOutputStream(); + var err = new ByteArrayOutputStream(); + var process = builder.start(); + var outThread = consumeProcessOutputStream(process, new TeeOutputStream(System.out, out)); + var errThread = consumeProcessErrorStream(process, new TeeOutputStream(System.err, err)); + return new WatchedProcess(start, process, new WatchedOutput(outThread, out), + new WatchedOutput(errThread, err)); + } + catch (IOException e) { + throw new UncheckedIOException("Failed to start process: " + command, e); + } + } +} diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/WatchedOutput.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/WatchedOutput.java new file mode 100644 index 000000000000..b92dbfe81727 --- /dev/null +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/WatchedOutput.java @@ -0,0 +1,25 @@ +package platform.tooling.support.process; + +import java.io.ByteArrayOutputStream; +import java.nio.charset.Charset; + +public class WatchedOutput { + + private static final Charset CHARSET = Charset.forName(System.getProperty("native.encoding")); + + private final Thread thread; + private final ByteArrayOutputStream stream; + + WatchedOutput(Thread thread, ByteArrayOutputStream stream) { + this.thread = thread; + this.stream = stream; + } + + void join() throws InterruptedException { + thread.join(); + } + + public String getStreamAsString() { + return stream.toString(CHARSET); + } +} diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/WatchedProcess.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/WatchedProcess.java new file mode 100644 index 000000000000..4be31152d2cd --- /dev/null +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/WatchedProcess.java @@ -0,0 +1,49 @@ +package platform.tooling.support.process; + +import java.time.Duration; +import java.time.Instant; + +public class WatchedProcess { + + private final Instant start; + private final Process process; + private final WatchedOutput out; + private final WatchedOutput err; + + WatchedProcess(Instant start, Process process, WatchedOutput out, WatchedOutput err) { + this.start = start; + this.process = process; + this.out = out; + this.err = err; + } + + ProcessResult waitFor() throws InterruptedException { + try { + int exitCode; + Instant end; + try { + try { + exitCode = process.waitFor(); + end = Instant.now(); + } + catch (InterruptedException e) { + process.destroyForcibly(); + throw e; + } + } + finally { + try { + out.join(); + } + finally { + err.join(); + } + } + return new ProcessResult(exitCode, Duration.between(start, end), out.getStreamAsString(), + err.getStreamAsString()); + } + finally { + process.destroyForcibly(); + } + } +} diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java index cfcda9130c05..8bd3a0212ecb 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java @@ -11,19 +11,20 @@ package platform.tooling.support.tests; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertLinesMatch; +import static platform.tooling.support.tests.Projects.copyToWorkspace; import static platform.tooling.support.tests.XmlAssertions.verifyContainsExpectedStartedOpenTestReport; +import java.nio.file.Path; import java.util.List; -import de.sormuras.bartholdy.tool.Java; - import org.apache.tools.ant.Main; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Timeout; +import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.api.parallel.ResourceLock; -import platform.tooling.support.Request; +import platform.tooling.support.process.ProcessStarter; /** * @since 1.3 @@ -32,20 +33,17 @@ class AntStarterTests { @ResourceLock(Projects.ANT_STARTER) @Test - void ant_starter() { - var request = Request.builder() // - .setTool(new Java()) // - .setProject(Projects.ANT_STARTER) // - .addArguments("-cp", System.getProperty("antJars"), Main.class.getName()) // - .addArguments("-verbose") // - .build(); - - var result = request.run(); + @Timeout(60) + void ant_starter(@TempDir Path workspace) throws Exception { + copyToWorkspace(Projects.ANT_STARTER, workspace); - assertFalse(result.isTimedOut(), () -> "tool timed out: " + result); + var result = ProcessStarter.java() // + .workingDir(workspace) // + .addArguments("-cp", System.getProperty("antJars"), Main.class.getName()) // + .startAndWait(); - assertEquals(0, result.getExitCode()); - assertEquals("", result.getOutput("err"), "error log isn't empty"); + assertEquals(0, result.exitCode()); + assertEquals("", result.stdErr(), "error log isn't empty"); assertLinesMatch(List.of(">> HEAD >>", // "test.junit.launcher:", // ">>>>", // @@ -58,9 +56,10 @@ void ant_starter() { " \\[java\\] \\[ 5 tests successful \\]", // " \\[java\\] \\[ 0 tests failed \\]", // ">> TAIL >>"), // - result.getOutputLines("out")); + result.stdOutLines()); - var testResultsDir = Request.WORKSPACE.resolve(request.getWorkspace()).resolve("build/test-report"); + var testResultsDir = workspace.resolve("build/test-report"); verifyContainsExpectedStartedOpenTestReport(testResultsDir); } + } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/Projects.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/Projects.java index 87f8920d16a6..c02f3391c27d 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/Projects.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/Projects.java @@ -10,6 +10,11 @@ package platform.tooling.support.tests; +import java.io.IOException; +import java.nio.file.Path; + +import org.apache.commons.io.file.PathUtils; + public class Projects { public static final String ANT_STARTER = "ant-starter"; @@ -28,4 +33,8 @@ public class Projects { private Projects() { } + + static void copyToWorkspace(String antStarter, Path workspace) throws IOException { + PathUtils.copyDirectory(Path.of("projects").resolve(antStarter), workspace); + } } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java index f9f66055fecd..052b3208e681 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java @@ -42,10 +42,6 @@ private static void verifyContent(Path xmlFile) { ${xmlunit.ignore} ${xmlunit.ignore} - - ${xmlunit.ignore} - ${xmlunit.matchesRegex#[0-9a-f]{40}#} - ${xmlunit.ignore} From 14a4c305d66ffbad84cde3be8a45fe4d0aa896a8 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 13:00:00 +0100 Subject: [PATCH 330/611] Adapt GraalVmStarterTests --- .../java/platform/tooling/support/Helper.java | 4 -- .../support/process/ProcessResult.java | 10 ++++ .../support/process/ProcessStarter.java | 36 +++++------ .../support/process/ProcessStarters.java | 59 +++++++++++++++++++ .../support/process/WatchedOutput.java | 10 ++++ .../support/process/WatchedProcess.java | 12 +++- .../support/tests/AntStarterTests.java | 8 +-- .../support/tests/GraalVmStarterTests.java | 31 ++++------ .../tests/GradleKotlinExtensionsTests.java | 3 +- .../tests/GradleMissingEngineTests.java | 3 +- .../support/tests/GradleStarterTests.java | 3 +- .../tooling/support/tests/Projects.java | 3 +- .../tests/ReflectionCompatibilityTests.java | 3 +- .../tests/VintageGradleIntegrationTests.java | 3 +- 14 files changed, 130 insertions(+), 58 deletions(-) create mode 100644 platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarters.java diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/Helper.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/Helper.java index 80867959a310..4bb2c6c73ad6 100644 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/Helper.java +++ b/platform-tooling-support-tests/src/main/java/platform/tooling/support/Helper.java @@ -114,10 +114,6 @@ public static List loadJarFiles() { return loadModuleDirectoryNames().stream().map(Helper::createJarFile).collect(Collectors.toList()); } - public static Optional getGradleJavaHome() { - return getJavaHome(System.getProperty("gradle.java.version")); - } - public static Optional getJavaHome(String version) { // First, try various system sources... var sources = Stream.of( // diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessResult.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessResult.java index 006ba5a89a71..df8226218577 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessResult.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessResult.java @@ -1,3 +1,13 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + package platform.tooling.support.process; import java.time.Duration; diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarter.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarter.java index c36dabad7d0d..562c786d7478 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarter.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarter.java @@ -1,3 +1,13 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + package platform.tooling.support.process; import static org.codehaus.groovy.runtime.ProcessGroovyMethods.consumeProcessErrorStream; @@ -18,26 +28,6 @@ public class ProcessStarter { - public static ProcessStarter java() { - return javaCommand(currentJdkHome(), "java"); - } - - private static Path currentJdkHome() { - var executable = ProcessHandle.current().info().command().map(Path::of).orElseThrow(); - // path element count is 3 or higher: "/bin/java[.exe]" - return executable.getParent().getParent().toAbsolutePath(); - } - - public static ProcessStarter java(Path javaHome) { - return javaCommand(javaHome, "java"); - } - - private static ProcessStarter javaCommand(Path javaHome, String commandName) { - return new ProcessStarter() // - .executable(javaHome.resolve("bin").resolve(commandName)) // - .putEnvironment("JAVA_HOME", javaHome.toString()); - } - private Path executable; private Path workingDir; private final List arguments = new ArrayList<>(); @@ -58,6 +48,10 @@ public ProcessStarter addArguments(String... arguments) { return this; } + public ProcessStarter putEnvironment(String key, Path value) { + return putEnvironment(key, value.toAbsolutePath().toString()); + } + public ProcessStarter putEnvironment(String key, String value) { environment.put(key, value); return this; @@ -82,7 +76,7 @@ public WatchedProcess start() { var outThread = consumeProcessOutputStream(process, new TeeOutputStream(System.out, out)); var errThread = consumeProcessErrorStream(process, new TeeOutputStream(System.err, err)); return new WatchedProcess(start, process, new WatchedOutput(outThread, out), - new WatchedOutput(errThread, err)); + new WatchedOutput(errThread, err)); } catch (IOException e) { throw new UncheckedIOException("Failed to start process: " + command, e); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarters.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarters.java new file mode 100644 index 000000000000..18d362cfd22d --- /dev/null +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarters.java @@ -0,0 +1,59 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package platform.tooling.support.process; + +import java.nio.file.Path; +import java.util.Optional; + +import org.opentest4j.TestAbortedException; + +import platform.tooling.support.Helper; + +public class ProcessStarters { + + public static ProcessStarter java() { + return javaCommand(currentJdkHome(), "java"); + } + + private static Path currentJdkHome() { + var executable = ProcessHandle.current().info().command().map(Path::of).orElseThrow(); + // path element count is 3 or higher: "/bin/java[.exe]" + return executable.getParent().getParent().toAbsolutePath(); + } + + public static ProcessStarter java(Path javaHome) { + return javaCommand(javaHome, "java"); + } + + private static ProcessStarter javaCommand(Path javaHome, String commandName) { + return new ProcessStarter() // + .executable(javaHome.resolve("bin").resolve(commandName)) // + .putEnvironment("JAVA_HOME", javaHome); + } + + public static ProcessStarter gradlew() { + var starter = new ProcessStarter() // + .executable(Path.of("..").resolve("gradlew")) // + .putEnvironment("JAVA_HOME", getGradleJavaHome().orElseThrow(TestAbortedException::new)); + return withCommonEnvironmentVariables(starter); + } + + private static ProcessStarter withCommonEnvironmentVariables(ProcessStarter starter) { + starter.putEnvironment("JUNIT_JUPITER_VERSION", Helper.version("junit-jupiter")); + starter.putEnvironment("JUNIT_VINTAGE_VERSION", Helper.version("junit-vintage")); + starter.putEnvironment("JUNIT_PLATFORM_VERSION", Helper.version("junit-platform")); + return starter; + } + + public static Optional getGradleJavaHome() { + return Helper.getJavaHome(System.getProperty("gradle.java.version")); + } +} diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/WatchedOutput.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/WatchedOutput.java index b92dbfe81727..a86e411d101a 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/WatchedOutput.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/WatchedOutput.java @@ -1,3 +1,13 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + package platform.tooling.support.process; import java.io.ByteArrayOutputStream; diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/WatchedProcess.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/WatchedProcess.java index 4be31152d2cd..199cfe929b6e 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/WatchedProcess.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/WatchedProcess.java @@ -1,3 +1,13 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + package platform.tooling.support.process; import java.time.Duration; @@ -40,7 +50,7 @@ ProcessResult waitFor() throws InterruptedException { } } return new ProcessResult(exitCode, Duration.between(start, end), out.getStreamAsString(), - err.getStreamAsString()); + err.getStreamAsString()); } finally { process.destroyForcibly(); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java index 8bd3a0212ecb..a44b00ac20a8 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java @@ -24,7 +24,7 @@ import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.api.parallel.ResourceLock; -import platform.tooling.support.process.ProcessStarter; +import platform.tooling.support.process.ProcessStarters; /** * @since 1.3 @@ -35,10 +35,8 @@ class AntStarterTests { @Test @Timeout(60) void ant_starter(@TempDir Path workspace) throws Exception { - copyToWorkspace(Projects.ANT_STARTER, workspace); - - var result = ProcessStarter.java() // - .workingDir(workspace) // + var result = ProcessStarters.java() // + .workingDir(copyToWorkspace(Projects.ANT_STARTER, workspace)) // .addArguments("-cp", System.getProperty("antJars"), Main.class.getName()) // .startAndWait(); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java index 16a30b593976..3f011c6e6d70 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java @@ -13,24 +13,20 @@ import static java.util.concurrent.TimeUnit.MINUTES; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; +import static platform.tooling.support.tests.Projects.copyToWorkspace; -import java.nio.file.Paths; -import java.time.Duration; - -import de.sormuras.bartholdy.tool.GradleWrapper; +import java.nio.file.Path; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; import org.junit.jupiter.api.extension.DisabledOnOpenJ9; +import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.api.parallel.ResourceLock; -import org.opentest4j.TestAbortedException; -import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; -import platform.tooling.support.Request; +import platform.tooling.support.process.ProcessStarters; /** * @since 1.9.1 @@ -43,23 +39,16 @@ class GraalVmStarterTests { @ResourceLock(Projects.GRAALVM_STARTER) @Test @Timeout(value = 10, unit = MINUTES) - void runsTestsInNativeImage() { - var request = Request.builder() // - .setTool(new GradleWrapper(Paths.get(".."))) // - .setProject(Projects.GRAALVM_STARTER) // - .setJavaHome(Helper.getGradleJavaHome().orElseThrow(TestAbortedException::new)) // + void runsTestsInNativeImage(@TempDir Path workspace) throws Exception { + var result = ProcessStarters.gradlew() // + .workingDir(copyToWorkspace(Projects.GRAALVM_STARTER, workspace)) // .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("javaToolchains", "nativeTest", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // - .setTimeout(Duration.ofMinutes(10)) // - .build(); - - var result = request.run(); - - assertFalse(result.isTimedOut(), () -> "tool timed out: " + result); + .startAndWait(); - assertEquals(0, result.getExitCode()); - assertThat(result.getOutputLines("out")) // + assertEquals(0, result.exitCode()); + assertThat(result.stdOutLines()) // .anyMatch(line -> line.contains("CalculatorTests > 1 + 1 = 2 SUCCESSFUL")) // .anyMatch(line -> line.contains("CalculatorTests > 1 + 100 = 101 SUCCESSFUL")) // .anyMatch(line -> line.contains("ClassLevelAnnotationTests$Inner > test() SUCCESSFUL")) // diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java index 672d1c031a4e..353b636a573b 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java @@ -26,6 +26,7 @@ import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; import platform.tooling.support.Request; +import platform.tooling.support.process.ProcessStarters; /** * @since 1.3 @@ -42,7 +43,7 @@ void gradle_wrapper() { .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // .setTimeout(TOOL_TIMEOUT) // .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // - .setJavaHome(Helper.getGradleJavaHome().orElseThrow(TestAbortedException::new)) // + .setJavaHome(ProcessStarters.getGradleJavaHome().orElseThrow(TestAbortedException::new)) // .build() // .run(); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java index b78000f7b808..c5f90cb2529c 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java @@ -28,6 +28,7 @@ import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; import platform.tooling.support.Request; +import platform.tooling.support.process.ProcessStarters; /** * @since 1.3 @@ -47,7 +48,7 @@ private void test(Tool gradle) { .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // - .setJavaHome(Helper.getGradleJavaHome().orElseThrow(TestAbortedException::new)) // + .setJavaHome(ProcessStarters.getGradleJavaHome().orElseThrow(TestAbortedException::new)) // .setTimeout(TOOL_TIMEOUT) // .build(); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java index 3b0cb3620040..9cdf3871bf5d 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java @@ -28,6 +28,7 @@ import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; import platform.tooling.support.Request; +import platform.tooling.support.process.ProcessStarters; /** * @since 1.3 @@ -44,7 +45,7 @@ void gradle_wrapper() { .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // .setTimeout(TOOL_TIMEOUT) // .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // - .setJavaHome(Helper.getGradleJavaHome().orElseThrow(TestAbortedException::new)) // + .setJavaHome(ProcessStarters.getGradleJavaHome().orElseThrow(TestAbortedException::new)) // .build(); var result = request.run(); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/Projects.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/Projects.java index c02f3391c27d..478785268f35 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/Projects.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/Projects.java @@ -34,7 +34,8 @@ public class Projects { private Projects() { } - static void copyToWorkspace(String antStarter, Path workspace) throws IOException { + static Path copyToWorkspace(String antStarter, Path workspace) throws IOException { PathUtils.copyDirectory(Path.of("projects").resolve(antStarter), workspace); + return workspace; } } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java index 7744835cc548..6b409a78151f 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java @@ -27,6 +27,7 @@ import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; import platform.tooling.support.Request; +import platform.tooling.support.process.ProcessStarters; /** * @since 1.11 @@ -43,7 +44,7 @@ void gradle_wrapper() { .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // .setTimeout(TOOL_TIMEOUT) // .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // - .setJavaHome(Helper.getGradleJavaHome().orElseThrow(TestAbortedException::new)) // + .setJavaHome(ProcessStarters.getGradleJavaHome().orElseThrow(TestAbortedException::new)) // .build(); var result = request.run(); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java index 2028c9232d9d..495a055a29ec 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java @@ -27,6 +27,7 @@ import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; import platform.tooling.support.Request; +import platform.tooling.support.process.ProcessStarters; class VintageGradleIntegrationTests { @@ -58,7 +59,7 @@ private Result run(String version) { var result = Request.builder() // .setTool(new GradleWrapper(Paths.get(".."))) // .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // - .setJavaHome(Helper.getGradleJavaHome().orElseThrow(TestAbortedException::new)) // + .setJavaHome(ProcessStarters.getGradleJavaHome().orElseThrow(TestAbortedException::new)) // .setProject(Projects.VINTAGE) // .setWorkspace("vintage-gradle-" + version) // .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // From a70e47051190f36ad246ce1799ae071116ba3372 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 13:01:35 +0100 Subject: [PATCH 331/611] Adapt GradleKotlinExtensionsTests --- .../tests/GradleKotlinExtensionsTests.java | 27 +++++++------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java index 353b636a573b..cf716722e703 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java @@ -11,21 +11,18 @@ package platform.tooling.support.tests; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import static platform.tooling.support.Helper.TOOL_TIMEOUT; +import static platform.tooling.support.tests.Projects.copyToWorkspace; -import java.nio.file.Paths; - -import de.sormuras.bartholdy.tool.GradleWrapper; +import java.nio.file.Path; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.api.parallel.ResourceLock; import org.opentest4j.TestAbortedException; import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; -import platform.tooling.support.Request; import platform.tooling.support.process.ProcessStarters; /** @@ -35,21 +32,15 @@ class GradleKotlinExtensionsTests { @ResourceLock(Projects.GRADLE_KOTLIN_EXTENSIONS) @Test - void gradle_wrapper() { - var result = Request.builder() // - .setTool(new GradleWrapper(Paths.get(".."))) // - .setProject(Projects.GRADLE_KOTLIN_EXTENSIONS) // + void gradle_wrapper(@TempDir Path workspace) throws Exception { + var result = ProcessStarters.gradlew() // + .workingDir(copyToWorkspace(Projects.GRADLE_KOTLIN_EXTENSIONS, workspace)) // .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // - .setTimeout(TOOL_TIMEOUT) // .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // - .setJavaHome(ProcessStarters.getGradleJavaHome().orElseThrow(TestAbortedException::new)) // - .build() // - .run(); - - assertFalse(result.isTimedOut(), () -> "tool timed out: " + result); + .startAndWait(); - assertEquals(0, result.getExitCode(), "result=" + result); - assertTrue(result.getOutputLines("out").stream().anyMatch(line -> line.contains("BUILD SUCCESSFUL"))); + assertEquals(0, result.exitCode(), "result=" + result); + assertTrue(result.stdOut().lines().anyMatch(line -> line.contains("BUILD SUCCESSFUL"))); } } From 4fc8f8233967cacea368df165d7b205b5b9faf05 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 13:03:49 +0100 Subject: [PATCH 332/611] Adapt GradleMissingEngineTests --- .../support/process/ProcessResult.java | 4 +++ .../tests/GradleMissingEngineTests.java | 36 ++++++------------- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessResult.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessResult.java index df8226218577..171cad168451 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessResult.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessResult.java @@ -17,4 +17,8 @@ public record ProcessResult(int exitCode, Duration duration, String stdOut, Stri public List stdOutLines() { return stdOut.lines().toList(); } + + public List stdErrLines() { + return stdErr.lines().toList(); + } } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java index c5f90cb2529c..1dd58386e4c2 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java @@ -12,22 +12,18 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static platform.tooling.support.Helper.TOOL_TIMEOUT; +import static platform.tooling.support.tests.Projects.copyToWorkspace; -import java.nio.file.Paths; - -import de.sormuras.bartholdy.Tool; -import de.sormuras.bartholdy.tool.GradleWrapper; +import java.nio.file.Path; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.api.parallel.ResourceLock; import org.junit.platform.reporting.testutil.FileUtils; import org.opentest4j.TestAbortedException; import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; -import platform.tooling.support.Request; import platform.tooling.support.process.ProcessStarters; /** @@ -37,31 +33,19 @@ class GradleMissingEngineTests { @ResourceLock(Projects.GRADLE_MISSING_ENGINE) @Test - void gradle_wrapper() { - test(new GradleWrapper(Paths.get(".."))); - } - - private void test(Tool gradle) { - var request = Request.builder() // - .setProject(Projects.GRADLE_MISSING_ENGINE) // - .setTool(gradle) // + void gradle_wrapper(@TempDir Path workspace) throws Exception { + var result = ProcessStarters.gradlew() // + .workingDir(copyToWorkspace(Projects.GRADLE_MISSING_ENGINE, workspace)) // .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // - .setJavaHome(ProcessStarters.getGradleJavaHome().orElseThrow(TestAbortedException::new)) // - .setTimeout(TOOL_TIMEOUT) // - .build(); - - var result = request.run(); - - assertFalse(result.isTimedOut(), () -> "tool timed out: " + result); + .startAndWait(); - assertEquals(1, result.getExitCode()); - assertThat(result.getOutputLines("err")) // + assertEquals(1, result.exitCode()); + assertThat(result.stdErrLines()) // .contains("FAILURE: Build failed with an exception."); - var htmlFile = FileUtils.findPath(Request.WORKSPACE.resolve(request.getWorkspace()), - "glob:**/build/reports/tests/test/classes/*.html"); + var htmlFile = FileUtils.findPath(workspace, "glob:**/build/reports/tests/test/classes/*.html"); assertThat(htmlFile).content() // .contains("Cannot create Launcher without at least one TestEngine"); } From c08cd32bb3125840f2fad4e993c5dfbfa7723fd4 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 13:05:21 +0100 Subject: [PATCH 333/611] Adapt GradleStarterTests --- .../support/tests/GradleStarterTests.java | 32 +++++++------------ 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java index 9cdf3871bf5d..d4a991c8e762 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java @@ -12,22 +12,19 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import static platform.tooling.support.Helper.TOOL_TIMEOUT; +import static platform.tooling.support.tests.Projects.copyToWorkspace; import static platform.tooling.support.tests.XmlAssertions.verifyContainsExpectedStartedOpenTestReport; -import java.nio.file.Paths; - -import de.sormuras.bartholdy.tool.GradleWrapper; +import java.nio.file.Path; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.api.parallel.ResourceLock; import org.opentest4j.TestAbortedException; import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; -import platform.tooling.support.Request; import platform.tooling.support.process.ProcessStarters; /** @@ -37,26 +34,19 @@ class GradleStarterTests { @ResourceLock(Projects.GRADLE_STARTER) @Test - void gradle_wrapper() { - var request = Request.builder() // - .setTool(new GradleWrapper(Paths.get(".."))) // - .setProject(Projects.GRADLE_STARTER) // + void gradle_wrapper(@TempDir Path workspace) throws Exception { + var result = ProcessStarters.gradlew() // + .workingDir(copyToWorkspace(Projects.GRADLE_STARTER, workspace)) // .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // - .setTimeout(TOOL_TIMEOUT) // .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // - .setJavaHome(ProcessStarters.getGradleJavaHome().orElseThrow(TestAbortedException::new)) // - .build(); - - var result = request.run(); - - assertFalse(result.isTimedOut(), () -> "tool timed out: " + result); + .startAndWait(); - assertEquals(0, result.getExitCode()); - assertTrue(result.getOutputLines("out").stream().anyMatch(line -> line.contains("BUILD SUCCESSFUL"))); - assertThat(result.getOutput("out")).contains("Using Java version: 1.8"); + assertEquals(0, result.exitCode()); + assertTrue(result.stdOut().lines().anyMatch(line -> line.contains("BUILD SUCCESSFUL"))); + assertThat(result.stdOut()).contains("Using Java version: 1.8"); - var testResultsDir = Request.WORKSPACE.resolve(request.getWorkspace()).resolve("build/test-results/test"); + var testResultsDir = workspace.resolve("build/test-results/test"); verifyContainsExpectedStartedOpenTestReport(testResultsDir); } } From e56437d628c6c79cb2cd3f26ec39c37019a868af Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 15:24:07 +0100 Subject: [PATCH 334/611] Adapt JarDescribeModuleTests --- .../support/process/ProcessStarters.java | 6 ++- .../support/tests/JarDescribeModuleTests.java | 41 ++++++------------- .../tooling/support/tests/Projects.java | 4 ++ 3 files changed, 22 insertions(+), 29 deletions(-) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarters.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarters.java index 18d362cfd22d..3dd66e0c4fb1 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarters.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarters.java @@ -33,7 +33,11 @@ public static ProcessStarter java(Path javaHome) { return javaCommand(javaHome, "java"); } - private static ProcessStarter javaCommand(Path javaHome, String commandName) { + public static ProcessStarter javaCommand(String commandName) { + return javaCommand(currentJdkHome(), commandName); + } + + public static ProcessStarter javaCommand(Path javaHome, String commandName) { return new ProcessStarter() // .executable(javaHome.resolve("bin").resolve(commandName)) // .putEnvironment("JAVA_HOME", javaHome); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java index afb87c75534c..2b113e359790 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java @@ -11,26 +11,20 @@ package platform.tooling.support.tests; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertLinesMatch; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; +import static platform.tooling.support.tests.Projects.getSourceDirectory; import java.lang.module.ModuleFinder; import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -import de.sormuras.bartholdy.jdk.Jar; import org.junit.jupiter.api.Order; -import org.junit.jupiter.api.parallel.ResourceLock; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; -import platform.tooling.support.Request; +import platform.tooling.support.process.ProcessStarters; /** * @since 1.3 @@ -38,32 +32,23 @@ @Order(Integer.MAX_VALUE) class JarDescribeModuleTests { - @ResourceLock(Projects.JAR_DESCRIBE_MODULE) @ParameterizedTest @MethodSource("platform.tooling.support.Helper#loadModuleDirectoryNames") void describeModule(String module) throws Exception { + var sourceDirectory = getSourceDirectory(Projects.JAR_DESCRIBE_MODULE); var modulePath = MavenRepo.jar(module); - var result = Request.builder() // - .setTool(new Jar()) // - .setProject(Projects.JAR_DESCRIBE_MODULE) // - .setProjectToWorkspaceCopyFileFilter(file -> file.getName().startsWith(module)) // - .setWorkspace("jar-describe-module/" + module) // - .addArguments("--describe-module", "--file", modulePath) // - .build() // - .run(); - assertFalse(result.isTimedOut(), () -> "tool timed out: " + result); + var result = ProcessStarters.javaCommand("jar") // + .workingDir(sourceDirectory) // + .addArguments("--describe-module", "--file", modulePath.toAbsolutePath().toString()) // + .startAndWait(); - assertEquals(0, result.getExitCode()); - assertEquals("", result.getOutput("err"), "error log isn't empty"); - var expected = Paths.get("build", "test-workspace", "jar-describe-module", module, module + ".expected.txt"); - if (Files.notExists(expected)) { - result.getOutputLines("out").forEach(System.err::println); - fail("No such file: " + expected); - } - var expectedLines = Files.lines(expected).map(Helper::replaceVersionPlaceholders).toList(); - var origin = Path.of("projects", "jar-describe-module", module + ".expected.txt").toUri(); - assertLinesMatch(expectedLines, result.getOutputLines("out"), () -> String.format("%s\nError", origin)); + assertEquals(0, result.exitCode()); + assertEquals("", result.stdErr(), "error log isn't empty"); + + var expectedLines = Helper.replaceVersionPlaceholders( + Files.readString(sourceDirectory.resolve(module + ".expected.txt")).trim()); + assertLinesMatch(expectedLines.lines().toList(), result.stdOut().trim().lines().toList()); } @ParameterizedTest diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/Projects.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/Projects.java index 478785268f35..dd1344d8836d 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/Projects.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/Projects.java @@ -38,4 +38,8 @@ static Path copyToWorkspace(String antStarter, Path workspace) throws IOExceptio PathUtils.copyDirectory(Path.of("projects").resolve(antStarter), workspace); return workspace; } + + static Path getSourceDirectory(String project) { + return Path.of("projects").resolve(project); + } } From 26187f0083a284721846f0f9602ea0faff1edee7 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 19:43:55 +0100 Subject: [PATCH 335/611] Adapt JavaVersionsTests --- .../support/process/ProcessStarter.java | 5 +++ .../support/process/ProcessStarters.java | 7 ++++ .../support/tests/JavaVersionsTests.java | 40 +++++++++---------- 3 files changed, 31 insertions(+), 21 deletions(-) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarter.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarter.java index 562c786d7478..b46dbeb61503 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarter.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarter.java @@ -57,6 +57,11 @@ public ProcessStarter putEnvironment(String key, String value) { return this; } + public ProcessStarter putEnvironment(Map values) { + environment.putAll(values); + return this; + } + public ProcessResult startAndWait() throws InterruptedException { return start().waitFor(); } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarters.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarters.java index 3dd66e0c4fb1..6857774f4a18 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarters.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarters.java @@ -50,6 +50,13 @@ public static ProcessStarter gradlew() { return withCommonEnvironmentVariables(starter); } + public static ProcessStarter maven() { + var starter = new ProcessStarter() // + .executable(Path.of(System.getProperty("mavenDistribution")).resolve("bin/mvn")) // + .putEnvironment("JAVA_HOME", getGradleJavaHome().orElseThrow(TestAbortedException::new)); + return withCommonEnvironmentVariables(starter); + } + private static ProcessStarter withCommonEnvironmentVariables(ProcessStarter starter) { starter.putEnvironment("JUNIT_JUPITER_VERSION", Helper.version("junit-jupiter")); starter.putEnvironment("JUNIT_VINTAGE_VERSION", Helper.version("junit-vintage")); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java index 12528bddb994..2f6cb410d1cb 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java @@ -11,10 +11,9 @@ package platform.tooling.support.tests; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assumptions.assumeTrue; -import static platform.tooling.support.Helper.TOOL_TIMEOUT; +import static platform.tooling.support.tests.Projects.copyToWorkspace; import java.nio.file.Path; import java.util.List; @@ -23,10 +22,11 @@ import de.sormuras.bartholdy.tool.Java; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; -import platform.tooling.support.Request; +import platform.tooling.support.process.ProcessStarters; /** * @since 1.4 @@ -36,39 +36,37 @@ class JavaVersionsTests { @GlobalResource LocalMavenRepo localMavenRepo; + @TempDir + Path workspace; + @Test - void java_8() { + void java_8() throws Exception { var java8Home = Helper.getJavaHome("8"); assumeTrue(java8Home.isPresent(), "Java 8 installation directory not found!"); - var actualLines = execute("8", java8Home.get(), Map.of()); + var actualLines = execute(java8Home.get(), Map.of()); assertTrue(actualLines.contains("[WARNING] Tests run: 2, Failures: 0, Errors: 0, Skipped: 1")); } @Test - void java_default() { - var actualLines = execute("default", new Java().getHome(), MavenEnvVars.FOR_JDK24_AND_LATER); + void java_default() throws Exception { + var actualLines = execute(new Java().getHome(), MavenEnvVars.FOR_JDK24_AND_LATER); assertTrue(actualLines.contains("[WARNING] Tests run: 2, Failures: 0, Errors: 0, Skipped: 1")); } - List execute(String version, Path javaHome, Map environmentVars) { - var builder = Request.builder() // - .setTool(Request.maven()) // - .setProject(Projects.JAVA_VERSIONS) // - .setWorkspace("java-versions-" + version) // + List execute(Path javaHome, Map environmentVars) throws Exception { + var result = ProcessStarters.maven() // + .workingDir(copyToWorkspace(Projects.JAVA_VERSIONS, workspace)) // + .putEnvironment("JAVA_HOME", javaHome) // + .putEnvironment(environmentVars) // .addArguments(localMavenRepo.toCliArgument(), "-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("--update-snapshots", "--batch-mode", "verify") // - .setTimeout(TOOL_TIMEOUT) // - .setJavaHome(javaHome); - environmentVars.forEach(builder::putEnvironment); - - var result = builder.build().run(); + .startAndWait(); - assertFalse(result.isTimedOut(), () -> "tool timed out: " + result); - assertEquals(0, result.getExitCode()); - assertEquals("", result.getOutput("err")); - return result.getOutputLines("out"); + assertEquals(0, result.exitCode()); + assertEquals("", result.stdErr()); + return result.stdOutLines(); } } From a9b4db2f140e338bffb431f509f1f9079f9b6682 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 19:48:20 +0100 Subject: [PATCH 336/611] Adapt MavenStarterTests --- .../support/tests/MavenStarterTests.java | 36 +++++++++---------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java index d69df0020425..c3cc848eaf62 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java @@ -12,18 +12,20 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import static platform.tooling.support.Helper.TOOL_TIMEOUT; +import static platform.tooling.support.tests.Projects.copyToWorkspace; import static platform.tooling.support.tests.XmlAssertions.verifyContainsExpectedStartedOpenTestReport; +import java.nio.file.Path; + import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.api.parallel.ResourceLock; import org.opentest4j.TestAbortedException; import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; -import platform.tooling.support.Request; +import platform.tooling.support.process.ProcessStarters; /** * @since 1.3 @@ -38,28 +40,22 @@ class MavenStarterTests { @ResourceLock(Projects.MAVEN_STARTER) @Test - void verifyMavenStarterProject() { - var request = Request.builder() // - .setTool(Request.maven()) // - .setProject(Projects.MAVEN_STARTER) // + void verifyMavenStarterProject(@TempDir Path workspace) throws Exception { + var result = ProcessStarters.maven() // + .workingDir(copyToWorkspace(Projects.MAVEN_STARTER, workspace)) // .addArguments(localMavenRepo.toCliArgument(), "-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("-Dsnapshot.repo.url=" + mavenRepoProxy.getBaseUri()) // .addArguments("--update-snapshots", "--batch-mode", "verify") // - .setTimeout(TOOL_TIMEOUT) // - .setJavaHome(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // - .build(); - - var result = request.run(); - - assertFalse(result.isTimedOut(), () -> "tool timed out: " + result); + .putEnvironment("JAVA_HOME", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // + .startAndWait(); - assertEquals(0, result.getExitCode()); - assertEquals("", result.getOutput("err")); - assertTrue(result.getOutputLines("out").contains("[INFO] BUILD SUCCESS")); - assertTrue(result.getOutputLines("out").contains("[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0")); - assertThat(result.getOutput("out")).contains("Using Java version: 1.8"); + assertEquals(0, result.exitCode()); + assertEquals("", result.stdErr()); + assertTrue(result.stdOutLines().contains("[INFO] BUILD SUCCESS")); + assertTrue(result.stdOutLines().contains("[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0")); + assertThat(result.stdOut()).contains("Using Java version: 1.8"); - var testResultsDir = Request.WORKSPACE.resolve(request.getWorkspace()).resolve("target/surefire-reports"); + var testResultsDir = workspace.resolve("target/surefire-reports"); verifyContainsExpectedStartedOpenTestReport(testResultsDir); } } From 0027edc7f8b658c2840af7a0fb12d1ab2864a526 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 19:51:25 +0100 Subject: [PATCH 337/611] Adapt MavenSurefireCompatibilityTests --- .../MavenSurefireCompatibilityTests.java | 37 ++++++++----------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java index 4188637a2744..56258a919186 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java @@ -12,21 +12,20 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import static platform.tooling.support.Helper.TOOL_TIMEOUT; +import static platform.tooling.support.tests.Projects.copyToWorkspace; -import java.io.IOException; import java.nio.file.Files; +import java.nio.file.Path; -import org.junit.jupiter.api.parallel.ResourceLock; +import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; import org.opentest4j.TestAbortedException; import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; -import platform.tooling.support.Request; +import platform.tooling.support.process.ProcessStarters; /** * @since 1.9.2 @@ -36,37 +35,31 @@ class MavenSurefireCompatibilityTests { @GlobalResource LocalMavenRepo localMavenRepo; - @ResourceLock(Projects.MAVEN_SUREFIRE_COMPATIBILITY) @ParameterizedTest @CsvSource(delimiter = '|', nullValues = "", textBlock = """ 2.22.2 | --activate-profiles=manual-platform-dependency 3.0.0-M4 | """) - void testMavenSurefireCompatibilityProject(String surefireVersion, String extraArg) throws IOException { - var extraArgs = extraArg == null ? new Object[0] : new Object[] { extraArg }; - var request = Request.builder() // - .setTool(Request.maven()) // - .setProject(Projects.MAVEN_SUREFIRE_COMPATIBILITY) // + void testMavenSurefireCompatibilityProject(String surefireVersion, String extraArg, @TempDir Path workspace) + throws Exception { + var extraArgs = extraArg == null ? new String[0] : new String[] { extraArg }; + var result = ProcessStarters.maven() // + .workingDir(copyToWorkspace(Projects.MAVEN_SUREFIRE_COMPATIBILITY, workspace)) // .addArguments(localMavenRepo.toCliArgument(), "-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("-Dsurefire.version=" + surefireVersion) // .addArguments("--update-snapshots", "--batch-mode", "test") // .addArguments(extraArgs) // - .setTimeout(TOOL_TIMEOUT) // - .setJavaHome(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // - .build(); + .putEnvironment("JAVA_HOME", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // + .startAndWait(); - var result = request.run(); + assertEquals(0, result.exitCode()); + assertEquals("", result.stdErr()); - assertFalse(result.isTimedOut(), () -> "tool timed out: " + result); - - assertEquals(0, result.getExitCode()); - assertEquals("", result.getOutput("err")); - - var output = result.getOutputLines("out"); + var output = result.stdOutLines(); assertTrue(output.contains("[INFO] BUILD SUCCESS")); assertTrue(output.contains("[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0")); - var targetDir = Request.WORKSPACE.resolve(request.getWorkspace()).resolve("target"); + var targetDir = workspace.resolve("target"); try (var stream = Files.list(targetDir)) { assertThat(stream.filter(file -> file.getFileName().toString().startsWith("junit-platform-unique-ids"))) // .hasSize(1); From e3349ac6b31c95fc643c622a9804dcdfc366851d Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 19:59:10 +0100 Subject: [PATCH 338/611] Adapt MultiReleaseJarTests --- .../multi-release-jar/{default => }/pom.xml | 0 .../integration/JupiterIntegrationTests.java | 0 .../integration/ModuleUtilsTests.java | 0 .../support/tests/MultiReleaseJarTests.java | 51 ++++++------------- 4 files changed, 15 insertions(+), 36 deletions(-) rename platform-tooling-support-tests/projects/multi-release-jar/{default => }/pom.xml (100%) rename platform-tooling-support-tests/projects/multi-release-jar/{default => }/src/test/java/integration/integration/JupiterIntegrationTests.java (100%) rename platform-tooling-support-tests/projects/multi-release-jar/{default => }/src/test/java/integration/integration/ModuleUtilsTests.java (100%) diff --git a/platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml b/platform-tooling-support-tests/projects/multi-release-jar/pom.xml similarity index 100% rename from platform-tooling-support-tests/projects/multi-release-jar/default/pom.xml rename to platform-tooling-support-tests/projects/multi-release-jar/pom.xml diff --git a/platform-tooling-support-tests/projects/multi-release-jar/default/src/test/java/integration/integration/JupiterIntegrationTests.java b/platform-tooling-support-tests/projects/multi-release-jar/src/test/java/integration/integration/JupiterIntegrationTests.java similarity index 100% rename from platform-tooling-support-tests/projects/multi-release-jar/default/src/test/java/integration/integration/JupiterIntegrationTests.java rename to platform-tooling-support-tests/projects/multi-release-jar/src/test/java/integration/integration/JupiterIntegrationTests.java diff --git a/platform-tooling-support-tests/projects/multi-release-jar/default/src/test/java/integration/integration/ModuleUtilsTests.java b/platform-tooling-support-tests/projects/multi-release-jar/src/test/java/integration/integration/ModuleUtilsTests.java similarity index 100% rename from platform-tooling-support-tests/projects/multi-release-jar/default/src/test/java/integration/integration/ModuleUtilsTests.java rename to platform-tooling-support-tests/projects/multi-release-jar/src/test/java/integration/integration/ModuleUtilsTests.java diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java index ecb6920a5898..4647adc2bc2f 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java @@ -14,20 +14,17 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertLinesMatch; import static org.junit.jupiter.api.Assertions.assertTrue; -import static platform.tooling.support.Helper.TOOL_TIMEOUT; +import static platform.tooling.support.tests.Projects.copyToWorkspace; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; -import java.util.Map; - -import de.sormuras.bartholdy.Result; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.parallel.ResourceLock; +import org.junit.jupiter.api.io.TempDir; import platform.tooling.support.MavenRepo; -import platform.tooling.support.Request; +import platform.tooling.support.process.ProcessStarters; /** * @since 1.4 @@ -40,10 +37,8 @@ class MultiReleaseJarTests { @GlobalResource MavenRepoProxy mavenRepoProxy; - @ResourceLock(Projects.MULTI_RELEASE_JAR) @Test - void checkDefault() throws Exception { - var variant = "default"; + void checkDefault(@TempDir Path workspace) throws Exception { var expectedLines = List.of( // ">> BANNER >>", // ".", // @@ -74,41 +69,25 @@ void checkDefault() throws Exception { "" // ); - var result = mvn(variant); + var result = ProcessStarters.maven() // + .workingDir(copyToWorkspace(Projects.MULTI_RELEASE_JAR, workspace)) // + .addArguments(localMavenRepo.toCliArgument(), "-Dmaven.repo=" + MavenRepo.dir()) // + .addArguments("-Dsnapshot.repo.url=" + mavenRepoProxy.getBaseUri()) // + .addArguments("--update-snapshots", "--show-version", "--errors", "--batch-mode") // + .addArguments("test") // + .putEnvironment(MavenEnvVars.FOR_JDK24_AND_LATER) // + .startAndWait(); - var outputLines = result.getOutputLines("out"); - outputLines.forEach(System.out::println); - result.getOutputLines("err").forEach(System.err::println); + assertEquals(0, result.exitCode()); + assertEquals("", result.stdErr()); - assertEquals(0, result.getExitCode()); - assertEquals("", result.getOutput("err")); + var outputLines = result.stdOutLines(); assertTrue(outputLines.contains("[INFO] BUILD SUCCESS")); assertFalse(outputLines.contains("[WARNING] "), "Warning marker detected"); assertFalse(outputLines.contains("[ERROR] "), "Error marker detected"); - var workspace = Path.of("build/test-workspace/multi-release-jar", variant); var actualLines = Files.readAllLines(workspace.resolve("target/junit-platform/console-launcher.out.log")); assertLinesMatch(expectedLines, actualLines); } - private Result mvn(String variant) { - Map environmentVars = MavenEnvVars.FOR_JDK24_AND_LATER; - - var builder = Request.builder() // - .setTool(Request.maven()) // - .setProject(Projects.MULTI_RELEASE_JAR) // - .addArguments(localMavenRepo.toCliArgument(), "-Dmaven.repo=" + MavenRepo.dir()) // - .addArguments("-Dsnapshot.repo.url=" + mavenRepoProxy.getBaseUri()) // - .addArguments("--update-snapshots", "--show-version", "--errors", "--batch-mode", "--file", variant, - "test") // - .setTimeout(TOOL_TIMEOUT); - environmentVars.forEach(builder::putEnvironment); - - var result = builder.build().run(); - - assertFalse(result.isTimedOut(), () -> "tool timed out: " + result); - - return result; - } - } From 2f114a29502e1d2382bb4077fd27091a54bfbb52 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 20:01:08 +0100 Subject: [PATCH 339/611] Adapt ReflectionCompatibilityTests --- .../tests/ReflectionCompatibilityTests.java | 32 ++++++------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java index 6b409a78151f..89bed056c907 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java @@ -12,21 +12,17 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import static platform.tooling.support.Helper.TOOL_TIMEOUT; +import static platform.tooling.support.tests.Projects.copyToWorkspace; -import java.nio.file.Paths; - -import de.sormuras.bartholdy.tool.GradleWrapper; +import java.nio.file.Path; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.parallel.ResourceLock; +import org.junit.jupiter.api.io.TempDir; import org.opentest4j.TestAbortedException; import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; -import platform.tooling.support.Request; import platform.tooling.support.process.ProcessStarters; /** @@ -34,25 +30,17 @@ */ class ReflectionCompatibilityTests { - @ResourceLock(Projects.REFLECTION_TESTS) @Test - void gradle_wrapper() { - var request = Request.builder() // - .setTool(new GradleWrapper(Paths.get(".."))) // - .setProject(Projects.REFLECTION_TESTS) // + void gradle_wrapper(@TempDir Path workspace) throws Exception { + var result = ProcessStarters.gradlew() // + .workingDir(copyToWorkspace(Projects.REFLECTION_TESTS, workspace)) // .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // - .setTimeout(TOOL_TIMEOUT) // .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // - .setJavaHome(ProcessStarters.getGradleJavaHome().orElseThrow(TestAbortedException::new)) // - .build(); - - var result = request.run(); - - assertFalse(result.isTimedOut(), () -> "tool timed out: " + result); + .startAndWait(); - assertEquals(0, result.getExitCode()); - assertTrue(result.getOutputLines("out").stream().anyMatch(line -> line.contains("BUILD SUCCESSFUL"))); - assertThat(result.getOutput("out")).contains("Using Java version: 1.8"); + assertEquals(0, result.exitCode()); + assertTrue(result.stdOut().lines().anyMatch(line -> line.contains("BUILD SUCCESSFUL"))); + assertThat(result.stdOut()).contains("Using Java version: 1.8"); } } From ed2f7045b76e6fd1b8ae1e294c9c6073e65f4ed0 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 20:26:30 +0100 Subject: [PATCH 340/611] Adapt StandaloneTests --- .../tooling/support/tests/Projects.java | 4 +- .../support/tests/StandaloneTests.java | 301 ++++++++---------- 2 files changed, 135 insertions(+), 170 deletions(-) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/Projects.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/Projects.java index dd1344d8836d..b2e64d2848df 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/Projects.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/Projects.java @@ -34,8 +34,8 @@ public class Projects { private Projects() { } - static Path copyToWorkspace(String antStarter, Path workspace) throws IOException { - PathUtils.copyDirectory(Path.of("projects").resolve(antStarter), workspace); + static Path copyToWorkspace(String project, Path workspace) throws IOException { + PathUtils.copyDirectory(getSourceDirectory(project), workspace); return workspace; } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java index fcca116f5b83..4dfc9424923d 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java @@ -15,6 +15,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertLinesMatch; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.parallel.ExecutionMode.CONCURRENT; +import static org.junit.jupiter.api.parallel.ExecutionMode.SAME_THREAD; +import static platform.tooling.support.tests.Projects.copyToWorkspace; +import static platform.tooling.support.tests.Projects.getSourceDirectory; import java.io.File; import java.io.IOException; @@ -25,31 +29,38 @@ import java.util.List; import java.util.stream.Stream; -import de.sormuras.bartholdy.Result; -import de.sormuras.bartholdy.jdk.Jar; -import de.sormuras.bartholdy.jdk.Javac; -import de.sormuras.bartholdy.tool.Java; - +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; -import org.junit.jupiter.api.parallel.ResourceLock; +import org.junit.jupiter.api.io.TempDir; +import org.junit.jupiter.api.parallel.Execution; import org.opentest4j.TestAbortedException; import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; import platform.tooling.support.Request; import platform.tooling.support.ThirdPartyJars; +import platform.tooling.support.process.ProcessResult; +import platform.tooling.support.process.ProcessStarters; /** * @since 1.4 */ @TestMethodOrder(MethodOrderer.OrderAnnotation.class) +@Execution(CONCURRENT) class StandaloneTests { - @ResourceLock(Projects.STANDALONE) + @TempDir + static Path workspace; + + @BeforeAll + static void prepareWorkspace() throws IOException { + copyToWorkspace(Projects.STANDALONE, workspace); + } + @Test void jarFileWithoutCompiledModuleDescriptorClass() throws Exception { var jar = MavenRepo.jar("junit-platform-console-standalone"); @@ -66,17 +77,15 @@ void jarFileWithoutCompiledModuleDescriptorClass() throws Exception { assertTrue(found.isEmpty(), jar + " must not contain any " + name + " files: " + found); } - @ResourceLock(Projects.STANDALONE) @Test - void listAllObservableEngines() { - var result = Request.builder() // - .setTool(new Java()) // - .setProject(Projects.STANDALONE) // - .addArguments("-jar", MavenRepo.jar("junit-platform-console-standalone")) // - .addArguments("engines", "--disable-ansi-colors", "--disable-banner").build() // - .run(false); + void listAllObservableEngines() throws Exception { + var result = ProcessStarters.java() // + .workingDir(getSourceDirectory(Projects.STANDALONE)) // + .addArguments("-jar", MavenRepo.jar("junit-platform-console-standalone").toString()) // + .addArguments("engines", "--disable-ansi-colors", "--disable-banner") // + .startAndWait(); - assertEquals(0, result.getExitCode(), () -> getExitCodeMessage(result)); + assertEquals(0, result.exitCode()); var jupiterVersion = Helper.version("junit-jupiter-engine"); var suiteVersion = Helper.version("junit-platform-suite-engine"); @@ -86,22 +95,19 @@ void listAllObservableEngines() { junit-platform-suite (org.junit.platform:junit-platform-suite-engine:%s) junit-vintage (org.junit.vintage:junit-vintage-engine:%s) """.formatted(jupiterVersion, suiteVersion, vintageVersion).lines(), // - result.getOutput("out").lines()); + result.stdOut().lines()); } - @ResourceLock(Projects.STANDALONE) @Test - void printVersionViaJar() { - var result = Request.builder() // - .setTool(new Java()) // - .setProject(Projects.STANDALONE) // - .addArguments("-jar", MavenRepo.jar("junit-platform-console-standalone")) // + void printVersionViaJar() throws Exception { + var result = ProcessStarters.java() // + .workingDir(getSourceDirectory(Projects.STANDALONE)) // + .addArguments("-jar", MavenRepo.jar("junit-platform-console-standalone").toString()) // .addArguments("--version", "--disable-ansi-colors") // .putEnvironment("CLICOLOR_FORCE", "1") // enable ANSI colors by default (see https://picocli.info/#_heuristics_for_enabling_ansi) - .build() // - .run(); + .startAndWait(); - assertEquals(0, result.getExitCode(), () -> getExitCodeMessage(result)); + assertEquals(0, result.exitCode()); var version = Helper.version("junit-platform-console"); assertLinesMatch(""" @@ -109,12 +115,11 @@ void printVersionViaJar() { JVM: .* OS: .* """.formatted(version).lines(), // - result.getOutputLines("out").stream()); + result.stdOut().lines()); } - @ResourceLock(Projects.STANDALONE) @Test - void printVersionViaModule() { + void printVersionViaModule() throws Exception { var junitJars = Stream.of("junit-platform-console", "junit-platform-reporting", "junit-platform-engine", "junit-platform-launcher", "junit-platform-commons") // .map(MavenRepo::jar); @@ -125,17 +130,15 @@ void printVersionViaModule() { var modulePath = Stream.concat(junitJars, thirdPartyJars) // .map(String::valueOf) // .collect(joining(File.pathSeparator)); - var result = Request.builder() // - .setTool(new Java()) // - .setProject(Projects.STANDALONE) // + var result = ProcessStarters.java() // + .workingDir(getSourceDirectory(Projects.STANDALONE)) // .addArguments("--module-path", modulePath) // .addArguments("--module", "org.junit.platform.console") // .addArguments("--version", "--disable-ansi-colors") // .putEnvironment("CLICOLOR_FORCE", "1") // enable ANSI colors by default (see https://picocli.info/#_heuristics_for_enabling_ansi) - .build() // - .run(); + .startAndWait(); - assertEquals(0, result.getExitCode(), () -> getExitCodeMessage(result)); + assertEquals(0, result.exitCode()); var version = Helper.version("junit-platform-console"); assertLinesMatch(""" @@ -143,49 +146,46 @@ void printVersionViaModule() { JVM: .* OS: .* """.formatted(version).lines(), // - result.getOutputLines("out").stream()); + result.stdOut().lines()); } - @ResourceLock(Projects.STANDALONE) @Test @Order(1) + @Execution(SAME_THREAD) void compile() throws Exception { - var workspace = Request.WORKSPACE.resolve(Projects.STANDALONE); - var result = Request.builder() // - .setTool(new Javac()) // - .setProject(Projects.STANDALONE) // + var result = ProcessStarters.javaCommand("javac") // + .workingDir(workspace) // .addArguments("-Xlint:-options") // .addArguments("--release", "8") // .addArguments("-proc:none") // - .addArguments("-d", workspace.resolve("bin")) // - .addArguments("--class-path", MavenRepo.jar("junit-platform-console-standalone")) // - .addArguments(workspace.resolve("src/standalone/JupiterIntegration.java")) // - .addArguments(workspace.resolve("src/standalone/JupiterParamsIntegration.java")) // - .addArguments(workspace.resolve("src/standalone/SuiteIntegration.java")) // - .addArguments(workspace.resolve("src/standalone/VintageIntegration.java")).build() // - .run(); - - assertEquals(0, result.getExitCode(), () -> getExitCodeMessage(result)); - assertTrue(result.getOutput("out").isEmpty()); - assertTrue(result.getOutput("err").isEmpty()); + .addArguments("-d", workspace.resolve("bin").toString()) // + .addArguments("--class-path", MavenRepo.jar("junit-platform-console-standalone").toString()) // + .addArguments(workspace.resolve("src/standalone/JupiterIntegration.java").toString()) // + .addArguments(workspace.resolve("src/standalone/JupiterParamsIntegration.java").toString()) // + .addArguments(workspace.resolve("src/standalone/SuiteIntegration.java").toString()) // + .addArguments(workspace.resolve("src/standalone/VintageIntegration.java").toString()) // + .startAndWait(); + + assertEquals(0, result.exitCode()); + assertTrue(result.stdOut().isEmpty()); + assertTrue(result.stdErr().isEmpty()); // create "tests.jar" that'll be picked-up by "testWithJarredTestClasses()" later var jarFolder = Files.createDirectories(workspace.resolve("jar")); - var jarResult = Request.builder() // - .setTool(new Jar()) // - .setProject(Projects.STANDALONE) // + var jarResult = ProcessStarters.javaCommand("jar") // + .workingDir(workspace) // .addArguments("--create") // - .addArguments("--file", jarFolder.resolve("tests.jar")) // - .addArguments("-C", workspace.resolve("bin"), ".") // - .build().run(false); - assertEquals(0, jarResult.getExitCode(), String.join("\n", jarResult.getOutputLines("out"))); + .addArguments("--file", jarFolder.resolve("tests.jar").toString()) // + .addArguments("-C", workspace.resolve("bin").toString(), ".") // + .startAndWait(); + assertEquals(0, jarResult.exitCode()); } - @ResourceLock(Projects.STANDALONE) @Test @Order(2) - void discoverTree() { - Result result = discover("--details-theme=ascii"); + @Execution(SAME_THREAD) + void discoverTree() throws Exception { + var result = discover("--details-theme=ascii"); var expected = """ . @@ -214,14 +214,14 @@ void discoverTree() { [ 9 tests found ] """.stripIndent(); - assertLinesMatch(expected.lines(), result.getOutputLines("out").stream()); + assertLinesMatch(expected.lines(), result.stdOut().lines()); } - @ResourceLock(Projects.STANDALONE) @Test @Order(2) - void discoverFlat() { - Result result = discover("--details=flat"); + @Execution(SAME_THREAD) + void discoverFlat() throws Exception { + var result = discover("--details=flat"); var expected = """ JUnit Platform Suite ([engine:junit-platform-suite]) @@ -249,13 +249,14 @@ JUnit Vintage ([engine:junit-vintage]) [ 9 tests found ] """.stripIndent(); - assertLinesMatch(expected.lines(), result.getOutputLines("out").stream()); + assertLinesMatch(expected.lines(), result.stdOut().lines()); } @Test @Order(2) - void discoverVerbose() { - Result result = discover("--details=verbose", "--details-theme=ascii"); + @Execution(SAME_THREAD) + void discoverVerbose() throws Exception { + var result = discover("--details=verbose", "--details-theme=ascii"); var expected = """ +-- JUnit Platform Suite @@ -333,23 +334,23 @@ void discoverVerbose() { [ 9 tests found ] """.stripIndent(); - assertLinesMatch(expected.lines(), result.getOutputLines("out").stream()); + assertLinesMatch(expected.lines(), result.stdOut().lines()); } - @ResourceLock(Projects.STANDALONE) @Test @Order(2) - void discoverNone() { - Result result = discover("--details=none"); + @Execution(SAME_THREAD) + void discoverNone() throws Exception { + var result = discover("--details=none"); - assertThat(result.getOutputLines("out")).isEmpty(); + assertThat(result.stdOut()).isEmpty(); } - @ResourceLock(Projects.STANDALONE) @Test @Order(2) - void discoverSummary() { - Result result = discover("--details=summary"); + @Execution(SAME_THREAD) + void discoverSummary() throws Exception { + var result = discover("--details=summary"); var expected = """ @@ -357,14 +358,14 @@ void discoverSummary() { [ 9 tests found ] """.stripIndent(); - assertLinesMatch(expected.lines(), result.getOutputLines("out").stream()); + assertLinesMatch(expected.lines(), result.stdOut().lines()); } - @ResourceLock(Projects.STANDALONE) @Test @Order(2) - void discoverTestFeed() { - Result result = discover("--details=testfeed"); + @Execution(SAME_THREAD) + void discoverTestFeed() throws Exception { + var result = discover("--details=testfeed"); var expected = """ JUnit Platform Suite > SuiteIntegration > JUnit Jupiter > SuiteIntegration$SingleTestContainer > successful() JUnit Jupiter > JupiterIntegration > successful() @@ -381,55 +382,51 @@ JUnit Jupiter > JupiterIntegration > disabled() """.stripIndent(); - assertLinesMatch(expected.lines(), result.getOutputLines("out").stream()); + assertLinesMatch(expected.lines(), result.stdOut().lines()); } - private static Result discover(String... args) { - var result = Request.builder() // + private static ProcessResult discover(String... args) throws Exception { + var result = ProcessStarters.java() // + .workingDir(workspace) // .putEnvironment("NO_COLOR", "1") // --disable-ansi-colors - .setTool(new Java()) // - .setProject(Projects.STANDALONE) // - .addArguments("-jar", MavenRepo.jar("junit-platform-console-standalone")) // + .addArguments("-jar", MavenRepo.jar("junit-platform-console-standalone").toString()) // .addArguments("discover") // .addArguments("--scan-class-path") // .addArguments("--disable-banner") // .addArguments("--include-classname", "standalone.*") // .addArguments("--classpath", "bin") // - .addArguments((Object[]) args) // - .build() // - .run(false); + .addArguments(args) // + .startAndWait(); - assertEquals(0, result.getExitCode(), () -> getExitCodeMessage(result)); + assertEquals(0, result.exitCode()); return result; } - @ResourceLock(Projects.STANDALONE) @Test @Order(3) - void execute() throws IOException { - var result = Request.builder() // + @Execution(SAME_THREAD) + void execute() throws Exception { + var result = ProcessStarters.java() // + .workingDir(workspace) // .putEnvironment("NO_COLOR", "1") // --disable-ansi-colors - .setTool(new Java()) // - .setProject(Projects.STANDALONE) // .addArguments("--show-version") // .addArguments("-enableassertions") // .addArguments("-Djava.util.logging.config.file=logging.properties") // .addArguments("-Djunit.platform.launcher.interceptors.enabled=true") // - .addArguments("-jar", MavenRepo.jar("junit-platform-console-standalone")) // + .addArguments("-jar", MavenRepo.jar("junit-platform-console-standalone").toString()) // .addArguments("execute") // .addArguments("--scan-class-path") // .addArguments("--disable-banner") // .addArguments("--include-classname", "standalone.*") // - .addArguments("--classpath", "bin").build() // - .run(false); + .addArguments("--classpath", "bin") // + .startAndWait(); - assertEquals(1, result.getExitCode(), () -> getExitCodeMessage(result)); + assertEquals(1, result.exitCode()); - var workspace = Request.WORKSPACE.resolve(Projects.STANDALONE); var expectedOutLines = Files.readAllLines(workspace.resolve("expected-out.txt")); var expectedErrLines = Files.readAllLines(workspace.resolve("expected-err.txt")); - assertLinesMatch(expectedOutLines, result.getOutputLines("out")); - List actualErrLines = result.getOutputLines("err"); + assertLinesMatch(expectedOutLines, result.stdOutLines()); + var actualErrLines = result.stdErrLines(); if (actualErrLines.getFirst().contains("stty: /dev/tty: No such device or address")) { // Happens intermittently on GitHub Actions on Windows actualErrLines = new ArrayList<>(actualErrLines); @@ -439,84 +436,78 @@ void execute() throws IOException { var jupiterVersion = Helper.version("junit-jupiter-engine"); var vintageVersion = Helper.version("junit-vintage-engine"); - assertTrue(result.getOutput("err").contains("junit-jupiter" + assertTrue(result.stdErr().contains("junit-jupiter" + " (group ID: org.junit.jupiter, artifact ID: junit-jupiter-engine, version: " + jupiterVersion)); - assertTrue(result.getOutput("err").contains("junit-vintage" + assertTrue(result.stdErr().contains("junit-vintage" + " (group ID: org.junit.vintage, artifact ID: junit-vintage-engine, version: " + vintageVersion)); } - @ResourceLock(Projects.STANDALONE) @Test @Order(4) - void executeOnJava8() throws IOException { - Java java8 = getJava8(); - var result = Request.builder() // - .setTool(java8) // - .setJavaHome(java8.getHome()) // - .setProject(Projects.STANDALONE) // + @Execution(SAME_THREAD) + void executeOnJava8() throws Exception { + var java8Home = Helper.getJavaHome("8").orElseThrow(TestAbortedException::new); + var result = ProcessStarters.java(java8Home) // + .workingDir(workspace) // .addArguments("-showversion") // .addArguments("-enableassertions") // .addArguments("-Djava.util.logging.config.file=logging.properties") // .addArguments("-Djunit.platform.launcher.interceptors.enabled=true") // - .addArguments("-jar", MavenRepo.jar("junit-platform-console-standalone")) // + .addArguments("-jar", MavenRepo.jar("junit-platform-console-standalone").toString()) // .addArguments("execute") // .addArguments("--scan-class-path") // .addArguments("--disable-banner") // .addArguments("--include-classname", "standalone.*") // - .addArguments("--classpath", "bin").build() // - .run(false); + .addArguments("--classpath", "bin") // + .startAndWait(); - assertEquals(1, result.getExitCode(), () -> getExitCodeMessage(result)); + assertEquals(1, result.exitCode()); var workspace = Request.WORKSPACE.resolve(Projects.STANDALONE); var expectedOutLines = Files.readAllLines(workspace.resolve("expected-out.txt")); var expectedErrLines = getExpectedErrLinesOnJava8(workspace); - assertLinesMatch(expectedOutLines, result.getOutputLines("out")); - assertLinesMatch(expectedErrLines, result.getOutputLines("err")); + assertLinesMatch(expectedOutLines, result.stdOutLines()); + assertLinesMatch(expectedErrLines, result.stdErrLines()); var jupiterVersion = Helper.version("junit-jupiter-engine"); var vintageVersion = Helper.version("junit-vintage-engine"); - assertTrue(result.getOutput("err").contains("junit-jupiter" + assertTrue(result.stdErr().contains("junit-jupiter" + " (group ID: org.junit.jupiter, artifact ID: junit-jupiter-engine, version: " + jupiterVersion)); - assertTrue(result.getOutput("err").contains("junit-vintage" + assertTrue(result.stdErr().contains("junit-vintage" + " (group ID: org.junit.vintage, artifact ID: junit-vintage-engine, version: " + vintageVersion)); } - @ResourceLock(Projects.STANDALONE) @Test @Order(5) + @Execution(SAME_THREAD) // https://github.com/junit-team/junit5/issues/2600 - void executeOnJava8SelectPackage() throws IOException { - Java java8 = getJava8(); - var result = Request.builder() // - .setTool(java8) // - .setJavaHome(java8.getHome()) // - .setProject(Projects.STANDALONE) // - .addArguments("-showversion") // + void executeOnJava8SelectPackage() throws Exception { + var java8Home = Helper.getJavaHome("8").orElseThrow(TestAbortedException::new); + var result = ProcessStarters.java(java8Home) // + .workingDir(workspace).addArguments("-showversion") // .addArguments("-enableassertions") // .addArguments("-Djava.util.logging.config.file=logging.properties") // .addArguments("-Djunit.platform.launcher.interceptors.enabled=true") // - .addArguments("-jar", MavenRepo.jar("junit-platform-console-standalone")) // + .addArguments("-jar", MavenRepo.jar("junit-platform-console-standalone").toString()) // .addArguments("execute") // .addArguments("--select-package", Projects.STANDALONE) // .addArguments("--disable-banner") // .addArguments("--include-classname", "standalone.*") // - .addArguments("--classpath", "bin").build() // - .run(false); + .addArguments("--classpath", "bin") // + .startAndWait(); - assertEquals(1, result.getExitCode(), () -> getExitCodeMessage(result)); + assertEquals(1, result.exitCode()); - var workspace = Request.WORKSPACE.resolve(Projects.STANDALONE); var expectedOutLines = Files.readAllLines(workspace.resolve("expected-out.txt")); var expectedErrLines = getExpectedErrLinesOnJava8(workspace); - assertLinesMatch(expectedOutLines, result.getOutputLines("out")); - assertLinesMatch(expectedErrLines, result.getOutputLines("err")); + assertLinesMatch(expectedOutLines, result.stdOutLines()); + assertLinesMatch(expectedErrLines, result.stdErrLines()); var jupiterVersion = Helper.version("junit-jupiter-engine"); var vintageVersion = Helper.version("junit-vintage-engine"); - assertTrue(result.getOutput("err").contains("junit-jupiter" + assertTrue(result.stdErr().contains("junit-jupiter" + " (group ID: org.junit.jupiter, artifact ID: junit-jupiter-engine, version: " + jupiterVersion)); - assertTrue(result.getOutput("err").contains("junit-vintage" + assertTrue(result.stdErr().contains("junit-vintage" + " (group ID: org.junit.vintage, artifact ID: junit-vintage-engine, version: " + vintageVersion)); } @@ -527,19 +518,17 @@ private static List getExpectedErrLinesOnJava8(Path workspace) throws IO return expectedErrLines; } - @ResourceLock(Projects.STANDALONE) @Test @Order(6) + @Execution(SAME_THREAD) @Disabled("https://github.com/junit-team/junit5/issues/1724") - void executeWithJarredTestClasses() { + void executeWithJarredTestClasses() throws Exception { var jar = MavenRepo.jar("junit-platform-console-standalone"); var path = new ArrayList(); // path.add("bin"); // "exploded" test classes are found, see also test() above path.add(Request.WORKSPACE.resolve("standalone/jar/tests.jar").toAbsolutePath().toString()); path.add(jar.toString()); - var result = Request.builder() // - .setTool(new Java()) // - .setProject(Projects.STANDALONE) // + var result = ProcessStarters.java() // .addArguments("--show-version") // .addArguments("-enableassertions") // .addArguments("-Djava.util.logging.config.file=logging.properties") // @@ -550,32 +539,8 @@ void executeWithJarredTestClasses() { .addArguments("--disable-banner") // .addArguments("--include-classname", "standalone.*") // .addArguments("--fail-if-no-tests") // - .build() // - .run(false); + .startAndWait(); - assertEquals(1, result.getExitCode(), () -> getExitCodeMessage(result)); - } - - private static String getExitCodeMessage(Result result) { - return "Exit codes don't match. Stdout:\n" + result.getOutput("out") + // - "\n\nStderr:\n" + result.getOutput("err") + "\n"; - } - - /** - * Special override of class {@link Java} to resolve against a different {@code JAVA_HOME}. - */ - private static Java getJava8() { - Path java8Home = Helper.getJavaHome("8").orElseThrow(TestAbortedException::new); - return new Java() { - @Override - public Path getHome() { - return java8Home; - } - - @Override - public String getVersion() { - return "8"; - } - }; + assertEquals(1, result.exitCode()); } } From 5d0b83f07072f6c90d6d8891e978514314e69db7 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 20:29:47 +0100 Subject: [PATCH 341/611] Adapt VintageGradleIntegrationTests --- .../tests/VintageGradleIntegrationTests.java | 43 ++++++++----------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java index 495a055a29ec..89ccd6e220d0 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java @@ -11,65 +11,58 @@ package platform.tooling.support.tests; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static platform.tooling.support.Helper.TOOL_TIMEOUT; +import static platform.tooling.support.tests.Projects.copyToWorkspace; -import java.nio.file.Paths; - -import de.sormuras.bartholdy.Result; -import de.sormuras.bartholdy.tool.GradleWrapper; +import java.nio.file.Path; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; import org.opentest4j.TestAbortedException; import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; -import platform.tooling.support.Request; +import platform.tooling.support.process.ProcessResult; import platform.tooling.support.process.ProcessStarters; class VintageGradleIntegrationTests { + @TempDir + Path workspace; + @Test - void unsupportedVersion() { + void unsupportedVersion() throws Exception { var result = run("4.11"); - assertThat(result.getExitCode()).isGreaterThan(0); - assertThat(result.getOutput("out")) // + assertThat(result.exitCode()).isGreaterThan(0); + assertThat(result.stdOut()) // .doesNotContain("STARTED") // .contains("Unsupported version of junit:junit: 4.11"); } @ParameterizedTest(name = "{0}") @ValueSource(strings = { "4.12", "4.13.2" }) - void supportedVersions(String version) { + void supportedVersions(String version) throws Exception { var result = run(version); - assertThat(result.getExitCode()).isGreaterThan(0); - assertThat(result.getOutput("out")) // + assertThat(result.exitCode()).isGreaterThan(0); + assertThat(result.stdOut()) // .contains("VintageTest > success PASSED") // .contains("VintageTest > failure FAILED"); - var testResultsDir = Request.WORKSPACE.resolve("vintage-gradle-" + version).resolve("build/test-results/test"); + var testResultsDir = workspace.resolve("build/test-results/test"); assertThat(testResultsDir.resolve("TEST-com.example.vintage.VintageTest.xml")).isRegularFile(); } - private Result run(String version) { - var result = Request.builder() // - .setTool(new GradleWrapper(Paths.get(".."))) // + private ProcessResult run(String version) throws Exception { + return ProcessStarters.gradlew() // + .workingDir(copyToWorkspace(Projects.VINTAGE, workspace)) // .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // - .setJavaHome(ProcessStarters.getGradleJavaHome().orElseThrow(TestAbortedException::new)) // - .setProject(Projects.VINTAGE) // - .setWorkspace("vintage-gradle-" + version) // .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("-Djunit4Version=" + version) // - .setTimeout(TOOL_TIMEOUT) // - .build() // - .run(); - assertFalse(result.isTimedOut(), () -> "tool timed out: " + result); - return result; + .startAndWait(); } } From a0beecb9f3f26077a3eabb26b68e02c24bda260b Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 20:33:31 +0100 Subject: [PATCH 342/611] Adapt VintageMavenIntegrationTests --- .../tests/VintageMavenIntegrationTests.java | 43 +++++++++---------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java index 217d40e1bbd0..e7d5788fc4be 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java @@ -11,66 +11,63 @@ package platform.tooling.support.tests; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static platform.tooling.support.Helper.TOOL_TIMEOUT; +import static platform.tooling.support.tests.Projects.copyToWorkspace; -import de.sormuras.bartholdy.Result; +import java.nio.file.Path; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; import org.opentest4j.TestAbortedException; import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; -import platform.tooling.support.Request; +import platform.tooling.support.process.ProcessResult; +import platform.tooling.support.process.ProcessStarters; class VintageMavenIntegrationTests { @GlobalResource LocalMavenRepo localMavenRepo; + @TempDir + Path workspace; + @Test - void unsupportedVersion() { + void unsupportedVersion() throws Exception { var result = run("4.11"); - assertThat(result.getExitCode()).isEqualTo(1); - assertThat(result.getOutput("out")) // + assertThat(result.exitCode()).isEqualTo(1); + assertThat(result.stdOut()) // .contains("TestEngine with ID 'junit-vintage' failed to discover tests") // .contains("Tests run: 0, Failures: 0, Errors: 0, Skipped: 0"); } @ParameterizedTest(name = "{0}") @ValueSource(strings = { "4.12", "4.13.2" }) - void supportedVersions(String version) { + void supportedVersions(String version) throws Exception { var result = run(version); - assertThat(result.getExitCode()).isGreaterThan(0); - assertThat(result.getOutput("out")) // + assertThat(result.exitCode()).isGreaterThan(0); + assertThat(result.stdOut()) // .contains("Running com.example.vintage.VintageTest") // .contains("VintageTest.failure:") // .contains("Tests run: 2, Failures: 1, Errors: 0, Skipped: 0"); - var surefireReportsDir = Request.WORKSPACE.resolve("vintage-maven-" + version).resolve( - "target/surefire-reports"); + var surefireReportsDir = workspace.resolve("target/surefire-reports"); assertThat(surefireReportsDir.resolve("com.example.vintage.VintageTest.txt")).isRegularFile(); assertThat(surefireReportsDir.resolve("TEST-com.example.vintage.VintageTest.xml")).isRegularFile(); } - private Result run(String version) { - var result = Request.builder() // - .setTool(Request.maven()) // - .setJavaHome(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // - .setProject(Projects.VINTAGE) // - .setWorkspace("vintage-maven-" + version) // + private ProcessResult run(String version) throws Exception { + return ProcessStarters.maven() // + .workingDir(copyToWorkspace(Projects.VINTAGE, workspace)) // + .putEnvironment("JAVA_HOME", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // .addArguments("clean", "test", "--update-snapshots", "--batch-mode") // .addArguments(localMavenRepo.toCliArgument(), "-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("-Djunit4Version=" + version) // - .setTimeout(TOOL_TIMEOUT) // - .build() // - .run(); - assertFalse(result.isTimedOut(), () -> "tool timed out: " + result); - return result; + .startAndWait(); } } From ff4d13f5c8b711fca14752242cbddaeb11bd0559 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 20:35:47 +0100 Subject: [PATCH 343/611] Remove Bartholdy reference --- .../platform/tooling/support/process/ProcessStarters.java | 2 +- .../platform/tooling/support/tests/JavaVersionsTests.java | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarters.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarters.java index 6857774f4a18..6d3b8cdb56fe 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarters.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarters.java @@ -23,7 +23,7 @@ public static ProcessStarter java() { return javaCommand(currentJdkHome(), "java"); } - private static Path currentJdkHome() { + public static Path currentJdkHome() { var executable = ProcessHandle.current().info().command().map(Path::of).orElseThrow(); // path element count is 3 or higher: "/bin/java[.exe]" return executable.getParent().getParent().toAbsolutePath(); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java index 2f6cb410d1cb..487580ba1f02 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java @@ -13,14 +13,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assumptions.assumeTrue; +import static platform.tooling.support.process.ProcessStarters.currentJdkHome; import static platform.tooling.support.tests.Projects.copyToWorkspace; import java.nio.file.Path; import java.util.List; import java.util.Map; -import de.sormuras.bartholdy.tool.Java; - import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; @@ -50,7 +49,7 @@ void java_8() throws Exception { @Test void java_default() throws Exception { - var actualLines = execute(new Java().getHome(), MavenEnvVars.FOR_JDK24_AND_LATER); + var actualLines = execute(currentJdkHome(), MavenEnvVars.FOR_JDK24_AND_LATER); assertTrue(actualLines.contains("[WARNING] Tests run: 2, Failures: 0, Errors: 0, Skipped: 1")); } From 7b488cf12184a9e08f9db75a3fb2076aa76c5bfd Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 20:36:12 +0100 Subject: [PATCH 344/611] Delete package cycle test as it's covered by ArchUnit --- .../tests/PackageCyclesDetectionTests.java | 52 ------------------- 1 file changed, 52 deletions(-) delete mode 100644 platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/PackageCyclesDetectionTests.java diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/PackageCyclesDetectionTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/PackageCyclesDetectionTests.java deleted file mode 100644 index 9b2126bec212..000000000000 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/PackageCyclesDetectionTests.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2015-2024 the original author or authors. - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v2.0 which - * accompanies this distribution and is available at - * - * https://www.eclipse.org/legal/epl-v20.html - */ - -package platform.tooling.support.tests; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import de.sormuras.bartholdy.Configuration; -import de.sormuras.bartholdy.tool.CyclesDetector; - -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.MethodSource; - -import platform.tooling.support.MavenRepo; - -/** - * @since 1.3 - */ -class PackageCyclesDetectionTests { - - @ParameterizedTest - @MethodSource("platform.tooling.support.Helper#loadModuleDirectoryNames") - @Disabled("Need to pass --module-path...") - void moduleDoesNotContainCyclicPackageReferences(String module) { - var jar = MavenRepo.jar(module); - var result = new CyclesDetector(jar, this::ignore).run(Configuration.of()); - assertEquals(0, result.getExitCode(), "result=" + result); - } - - private boolean ignore(String source, String target) { - if (source.equals(target)) { - return true; - } - if (source.startsWith("org.junit.jupiter.params.shadow.com.univocity.parsers.")) { - return true; - } - //noinspection RedundantIfStatement - if (!target.startsWith("org.junit.")) { - return true; - } - return false; - } - -} From 483e1cf11b25935d0084b9dacb46f48c172e0045 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 20:40:49 +0100 Subject: [PATCH 345/611] Remove more references to Bartholdy --- .../tooling/support/tests/StandaloneTests.java | 4 +--- .../tooling/support/tests/ToolProviderTests.java | 13 +++++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java index 4dfc9424923d..fa99a9d53e6f 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java @@ -41,7 +41,6 @@ import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; -import platform.tooling.support.Request; import platform.tooling.support.ThirdPartyJars; import platform.tooling.support.process.ProcessResult; import platform.tooling.support.process.ProcessStarters; @@ -463,7 +462,6 @@ void executeOnJava8() throws Exception { assertEquals(1, result.exitCode()); - var workspace = Request.WORKSPACE.resolve(Projects.STANDALONE); var expectedOutLines = Files.readAllLines(workspace.resolve("expected-out.txt")); var expectedErrLines = getExpectedErrLinesOnJava8(workspace); assertLinesMatch(expectedOutLines, result.stdOutLines()); @@ -526,7 +524,7 @@ void executeWithJarredTestClasses() throws Exception { var jar = MavenRepo.jar("junit-platform-console-standalone"); var path = new ArrayList(); // path.add("bin"); // "exploded" test classes are found, see also test() above - path.add(Request.WORKSPACE.resolve("standalone/jar/tests.jar").toAbsolutePath().toString()); + path.add(workspace.resolve("standalone/jar/tests.jar").toAbsolutePath().toString()); path.add(jar.toString()); var result = ProcessStarters.java() // .addArguments("--show-version") // diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ToolProviderTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ToolProviderTests.java index 0b979d1dff44..753cc873819a 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ToolProviderTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ToolProviderTests.java @@ -37,10 +37,10 @@ import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.DisabledOnOpenJ9; +import org.junit.jupiter.api.io.TempDir; import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; -import platform.tooling.support.Request; import platform.tooling.support.ThirdPartyJars; /** @@ -49,12 +49,13 @@ @Order(Integer.MAX_VALUE) class ToolProviderTests { - private static final Path LIB = Request.WORKSPACE.resolve("tool-provider-tests/lib"); + @TempDir + static Path lib; @BeforeAll static void prepareLocalLibraryDirectoryWithJUnitPlatformModules() { try { - var lib = Files.createDirectories(LIB); + var lib = Files.createDirectories(ToolProviderTests.lib); try (var directoryStream = Files.newDirectoryStream(lib, "*.jar")) { for (Path jarFile : directoryStream) { Files.delete(jarFile); @@ -77,11 +78,11 @@ static void prepareLocalLibraryDirectoryWithJUnitPlatformModules() { @Test void findAndRunJUnitOnTheClassPath() { - try (var loader = new URLClassLoader("junit", urls(LIB), ClassLoader.getPlatformClassLoader())) { + try (var loader = new URLClassLoader("junit", urls(lib), ClassLoader.getPlatformClassLoader())) { var sl = ServiceLoader.load(ToolProvider.class, loader); var junit = StreamSupport.stream(sl.spliterator(), false).filter(p -> p.name().equals("junit")).findFirst(); - assertTrue(junit.isPresent(), "Tool 'junit' not found in: " + LIB); + assertTrue(junit.isPresent(), "Tool 'junit' not found in: " + lib); assertJUnitPrintsHelpMessage(junit.get()); } catch (IOException e) { @@ -92,7 +93,7 @@ void findAndRunJUnitOnTheClassPath() { @Test @DisabledOnOpenJ9 void findAndRunJUnitOnTheModulePath() { - var finder = ModuleFinder.of(LIB); + var finder = ModuleFinder.of(lib); var modules = finder.findAll().stream() // .map(ModuleReference::descriptor) // .map(ModuleDescriptor::toNameAndVersion) // From 2f732678b7a1c32d579c802bdd620294419ee4e3 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 21:04:37 +0100 Subject: [PATCH 346/611] Adapt ModularUserGuideTests --- .../support/tests/ModularUserGuideTests.java | 84 +++++++------------ 1 file changed, 28 insertions(+), 56 deletions(-) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java index 5f3f6190d069..1ef24d82e44d 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java @@ -13,7 +13,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertLinesMatch; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; import java.io.File; import java.io.PrintWriter; @@ -25,13 +24,14 @@ import java.util.List; import java.util.spi.ToolProvider; -import org.codehaus.groovy.runtime.ProcessGroovyMethods; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.DisabledOnOpenJ9; import org.junit.jupiter.api.io.TempDir; +import org.junit.platform.launcher.LauncherConstants; import platform.tooling.support.Helper; import platform.tooling.support.ThirdPartyJars; +import platform.tooling.support.process.ProcessStarters; /** * @since 1.5 @@ -118,61 +118,33 @@ private static List compile(Path temp, Writer out, Writer err) throws Ex return args; } - private static void junit(Path temp, Writer out, Writer err) throws Exception { - var command = new ArrayList(); + private static void junit(Path temp) throws Exception { var projectDir = Path.of("../documentation"); - command.add(Path.of(System.getProperty("java.home"), "bin", "java").toString()); - command.add("-XX:StartFlightRecording:filename=" + temp.resolve("user-guide.jfr")); - - command.add("--show-version"); - command.add("--show-module-resolution"); - - command.add("--module-path"); - command.add(String.join(File.pathSeparator, // - temp.resolve("destination").toString(), // - temp.resolve("lib").toString() // - )); - - command.add("--add-modules"); - command.add("documentation"); - - // TODO This `patch-module` should work! Why doesn't it? - // command.add("--patch-module"); - // command.add("documentation=../documentation/src/test/resources/"); - Files.copy(projectDir.resolve("src/test/resources/two-column.csv"), - temp.resolve("destination/documentation/two-column.csv")); - - command.add("--module"); - command.add("org.junit.platform.console"); - - command.add("execute"); - command.add("--scan-modules"); - - command.add("--config"); - command.add("enableHttpServer=true"); - - command.add("--fail-if-no-tests"); - command.add("--include-classname"); - command.add(".*Tests"); - command.add("--include-classname"); - command.add(".*Demo"); - command.add("--exclude-tag"); - command.add("exclude"); - - // System.out.println("______________"); - // command.forEach(System.out::println); - - var builder = new ProcessBuilder(command).directory(projectDir.toFile()); - var java = builder.start(); - ProcessGroovyMethods.waitForProcessOutput(java, out, err); - var code = java.exitValue(); - - if (code != 0) { - System.out.println(out); - System.err.println(err); - fail("Unexpected exit code: " + code); - } + var result = ProcessStarters.java() // + .workingDir(projectDir) // + .addArguments("-XX:StartFlightRecording:filename=" + temp.resolve("user-guide.jfr")) // + .addArguments("--show-version", "--show-module-resolution") // + .addArguments("--module-path", String.join(File.pathSeparator, // + temp.resolve("destination").toString(), // + temp.resolve("lib").toString() // + )) // + .addArguments("--add-modules", "documentation") // + .addArguments("--patch-module", + "documentation=" + projectDir.resolve("src/test/resources").toAbsolutePath()) // + .addArguments("--module", "org.junit.platform.console") // + .addArguments("execute") // + .addArguments("--scan-modules") // + .addArguments("--config", "enableHttpServer=true") // + .addArguments("--config", LauncherConstants.OUTPUT_DIR_PROPERTY_NAME + "=" + temp.resolve("reports")) // + .addArguments("--fail-if-no-tests") // + .addArguments("--include-classname", ".*Tests") // + .addArguments("--include-classname", ".*Demo") // + .addArguments("--exclude-tag", "exclude") // + .addArguments("--exclude-tag", "exclude") // + .startAndWait(); + + assertEquals(0, result.exitCode()); } @Test @@ -205,7 +177,7 @@ void runTestsFromUserGuideWithinModularBoundaries(@TempDir Path temp) throws Exc // System.out.println("______________"); // listing.forEach(System.out::println); - junit(temp, out, err); + junit(temp); } } From d94324e0ebfabf9e20214450b34396d99ae1bf2d Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 21:05:31 +0100 Subject: [PATCH 347/611] Move process ProcessStarter to main source set --- .../platform-tooling-support-tests.gradle.kts | 11 +++++++---- .../tooling/support/process/ProcessResult.java | 1 + .../tooling/support/process/ProcessStarter.java | 0 .../tooling/support/process/ProcessStarters.java | 3 +-- .../tooling/support/process/WatchedOutput.java | 0 .../tooling/support/process/WatchedProcess.java | 0 .../tooling/support/process/package-info.java | 7 +++++++ 7 files changed, 16 insertions(+), 6 deletions(-) rename platform-tooling-support-tests/src/{test => main}/java/platform/tooling/support/process/ProcessResult.java (99%) rename platform-tooling-support-tests/src/{test => main}/java/platform/tooling/support/process/ProcessStarter.java (100%) rename platform-tooling-support-tests/src/{test => main}/java/platform/tooling/support/process/ProcessStarters.java (95%) rename platform-tooling-support-tests/src/{test => main}/java/platform/tooling/support/process/WatchedOutput.java (100%) rename platform-tooling-support-tests/src/{test => main}/java/platform/tooling/support/process/WatchedProcess.java (100%) create mode 100644 platform-tooling-support-tests/src/main/java/platform/tooling/support/process/package-info.java diff --git a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts index 8e4ca649887c..642eeba76ba4 100644 --- a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts +++ b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts @@ -13,7 +13,7 @@ plugins { } javaLibrary { - mainJavaVersion = JavaVersion.VERSION_11 + mainJavaVersion = JavaVersion.VERSION_21 } spotless { @@ -50,6 +50,12 @@ dependencies { implementation(libs.commons.io) { because("moving/deleting directory trees") } + implementation(libs.groovy4) { + because("it provides convenience methods to handle process output") + } + implementation(libs.opentest4j) { + because("it throws TestAbortedException to abort tests") + } testImplementation(libs.archunit) { because("checking the architecture of JUnit 5") @@ -57,9 +63,6 @@ dependencies { testImplementation(libs.apiguardian) { because("we validate that public classes are annotated") } - testImplementation(libs.groovy4) { - because("it provides convenience methods to handle process output") - } testImplementation(libs.bndlib) { because("parsing OSGi metadata") } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessResult.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessResult.java similarity index 99% rename from platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessResult.java rename to platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessResult.java index 171cad168451..7fa058d8e932 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessResult.java +++ b/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessResult.java @@ -14,6 +14,7 @@ import java.util.List; public record ProcessResult(int exitCode, Duration duration, String stdOut, String stdErr) { + public List stdOutLines() { return stdOut.lines().toList(); } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarter.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessStarter.java similarity index 100% rename from platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarter.java rename to platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessStarter.java diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarters.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessStarters.java similarity index 95% rename from platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarters.java rename to platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessStarters.java index 6d3b8cdb56fe..8eb49cb35d1d 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/ProcessStarters.java +++ b/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessStarters.java @@ -52,8 +52,7 @@ public static ProcessStarter gradlew() { public static ProcessStarter maven() { var starter = new ProcessStarter() // - .executable(Path.of(System.getProperty("mavenDistribution")).resolve("bin/mvn")) // - .putEnvironment("JAVA_HOME", getGradleJavaHome().orElseThrow(TestAbortedException::new)); + .executable(Path.of(System.getProperty("mavenDistribution")).resolve("bin/mvn")); return withCommonEnvironmentVariables(starter); } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/WatchedOutput.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/WatchedOutput.java similarity index 100% rename from platform-tooling-support-tests/src/test/java/platform/tooling/support/process/WatchedOutput.java rename to platform-tooling-support-tests/src/main/java/platform/tooling/support/process/WatchedOutput.java diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/process/WatchedProcess.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/WatchedProcess.java similarity index 100% rename from platform-tooling-support-tests/src/test/java/platform/tooling/support/process/WatchedProcess.java rename to platform-tooling-support-tests/src/main/java/platform/tooling/support/process/WatchedProcess.java diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/package-info.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/package-info.java new file mode 100644 index 000000000000..27abc7fb7956 --- /dev/null +++ b/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/package-info.java @@ -0,0 +1,7 @@ +/** + * Utilities for working with processes. + * + * @since 1.12 + */ + +package platform.tooling.support.process; From 6e43e2749dc928fc4a70950b9528f79a8f8a8e4d Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 21:05:51 +0100 Subject: [PATCH 348/611] Remove dependency on Bartholdy --- gradle/libs.versions.toml | 1 - .../platform-tooling-support-tests.gradle.kts | 3 - .../platform/tooling/support/Request.java | 183 ------------------ 3 files changed, 187 deletions(-) delete mode 100644 platform-tooling-support-tests/src/main/java/platform/tooling/support/Request.java diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6fb73de6f0f1..49b3b30278fc 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -30,7 +30,6 @@ apiguardian = { module = "org.apiguardian:apiguardian-api", version.ref = "apigu archunit = { module = "com.tngtech.archunit:archunit-junit5", version = "1.3.0" } assertj = { module = "org.assertj:assertj-core", version.ref = "assertj" } -bartholdy = { module = "de.sormuras:bartholdy", version = "0.2.3" } bndlib = { module = "biz.aQute.bnd:biz.aQute.bndlib", version.ref = "bnd" } checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checkstyle" } classgraph = { module = "io.github.classgraph:classgraph", version = "4.8.179" } diff --git a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts index 642eeba76ba4..fe110ae96276 100644 --- a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts +++ b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts @@ -44,9 +44,6 @@ val mavenDistributionClasspath = configurations.resolvable("mavenDistributionCla } dependencies { - implementation(libs.bartholdy) { - because("manage external tool installations") - } implementation(libs.commons.io) { because("moving/deleting directory trees") } diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/Request.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/Request.java deleted file mode 100644 index 3ccaac91edee..000000000000 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/Request.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright 2015-2024 the original author or authors. - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v2.0 which - * accompanies this distribution and is available at - * - * https://www.eclipse.org/legal/epl-v20.html - */ - -package platform.tooling.support; - -import java.io.FileFilter; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.time.Duration; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Stream; - -import de.sormuras.bartholdy.Configuration; -import de.sormuras.bartholdy.Result; -import de.sormuras.bartholdy.Tool; -import de.sormuras.bartholdy.tool.Maven; - -import org.apache.commons.io.FileUtils; - -/** - * @since 1.3 - */ -public class Request { - - public static final Path PROJECTS = Paths.get("projects"); - private static final Path TOOLS = Paths.get("build", "test-tools"); - public static final Path WORKSPACE = Paths.get("build", "test-workspace"); - - public static Builder builder() { - return new Builder(); - } - - public static Maven maven() { - return new Maven(Path.of(System.getProperty("mavenDistribution"))); - } - - private Tool tool; - private String project; - private String workspace; - private List arguments = new ArrayList<>(); - private Map environment = new HashMap<>(); - private FileFilter copyProjectToWorkspaceFileFilter; - private Duration timeout = Duration.ofMinutes(1); - - public String getProject() { - return project; - } - - public FileFilter getCopyProjectToWorkspaceFileFilter() { - return copyProjectToWorkspaceFileFilter; - } - - public String getWorkspace() { - return workspace; - } - - public Map getEnvironment() { - return environment; - } - - public List getArguments() { - return arguments; - } - - public Duration getTimeout() { - return timeout; - } - - public Result run() { - return run(true); - } - - public Result run(boolean cleanWorkspace) { - try { - // sanity check - if (!Files.isDirectory(PROJECTS)) { - var cwd = Paths.get(".").normalize().toAbsolutePath(); - throw new IllegalStateException("Directory " + PROJECTS + " not found in: " + cwd); - } - - Files.createDirectories(TOOLS); - Files.createDirectories(WORKSPACE); - - var workspace = WORKSPACE.resolve(getWorkspace()); - if (cleanWorkspace) { - FileUtils.deleteQuietly(workspace.toFile()); - var project = PROJECTS.resolve(getProject()); - if (Files.isDirectory(project)) { - var filter = getCopyProjectToWorkspaceFileFilter(); - FileUtils.copyDirectory(project.toFile(), workspace.toFile(), filter); - } - } - - var configuration = Configuration.builder(); - configuration.setArguments(getArguments()); - configuration.setWorkingDirectory(workspace); - configuration.setTimeout(getTimeout()); - configuration.getEnvironment().putAll(getEnvironment()); - - var result = tool.run(configuration.build()); - System.out.println(result.getOutput("out")); - System.err.println(result.getOutput("err")); - return result; - } - catch (Exception e) { - throw new IllegalStateException("run failed", e); - } - } - - public static class Builder { - - private final Request request = new Request(); - - public Request build() { - if (request.project == null) { - throw new IllegalStateException("project must not be null"); - } - if (request.workspace == null) { - request.workspace = request.project; - } - buildEnvironment(request.environment); - request.arguments = List.copyOf(request.arguments); - request.environment = Map.copyOf(request.environment); - return request; - } - - private void buildEnvironment(Map environment) { - environment.computeIfAbsent("JUNIT_JUPITER_VERSION", key -> Helper.version("junit-jupiter")); - environment.computeIfAbsent("JUNIT_VINTAGE_VERSION", key -> Helper.version("junit-vintage")); - environment.computeIfAbsent("JUNIT_PLATFORM_VERSION", key -> Helper.version("junit-platform")); - } - - public Builder setTool(Tool tool) { - request.tool = tool; - return this; - } - - public Builder setJavaHome(Path javaHome) { - return putEnvironment("JAVA_HOME", javaHome.normalize().toAbsolutePath().toString()); - } - - public Builder setProject(String project) { - request.project = project; - return this; - } - - public Builder setProjectToWorkspaceCopyFileFilter(FileFilter copyProjectToWorkspaceFileFilter) { - request.copyProjectToWorkspaceFileFilter = copyProjectToWorkspaceFileFilter; - return this; - } - - public Builder setWorkspace(String workspace) { - request.workspace = workspace; - return this; - } - - public Builder addArguments(Object... arguments) { - Stream.of(arguments).map(Object::toString).forEach(request.arguments::add); - return this; - } - - public Builder putEnvironment(String key, String value) { - request.environment.put(key, value); - return this; - } - - public Builder setTimeout(Duration timeout) { - request.timeout = timeout; - return this; - } - } -} From 45930ab07ba86154590c97bad9e6415a8df29323 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 21:16:27 +0100 Subject: [PATCH 349/611] Remove no longer necessary resource locks --- .../java/platform/tooling/support/tests/AntStarterTests.java | 2 -- .../platform/tooling/support/tests/GraalVmStarterTests.java | 2 -- .../tooling/support/tests/GradleKotlinExtensionsTests.java | 2 -- .../tooling/support/tests/GradleMissingEngineTests.java | 2 -- .../java/platform/tooling/support/tests/GradleStarterTests.java | 2 -- .../java/platform/tooling/support/tests/MavenStarterTests.java | 2 -- 6 files changed, 12 deletions(-) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java index a44b00ac20a8..331a423210a3 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java @@ -22,7 +22,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.io.TempDir; -import org.junit.jupiter.api.parallel.ResourceLock; import platform.tooling.support.process.ProcessStarters; @@ -31,7 +30,6 @@ */ class AntStarterTests { - @ResourceLock(Projects.ANT_STARTER) @Test @Timeout(60) void ant_starter(@TempDir Path workspace) throws Exception { diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java index 3f011c6e6d70..0a32046ba9ab 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java @@ -23,7 +23,6 @@ import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; import org.junit.jupiter.api.extension.DisabledOnOpenJ9; import org.junit.jupiter.api.io.TempDir; -import org.junit.jupiter.api.parallel.ResourceLock; import platform.tooling.support.MavenRepo; import platform.tooling.support.process.ProcessStarters; @@ -36,7 +35,6 @@ @EnabledIfEnvironmentVariable(named = "GRAALVM_HOME", matches = ".+") class GraalVmStarterTests { - @ResourceLock(Projects.GRAALVM_STARTER) @Test @Timeout(value = 10, unit = MINUTES) void runsTestsInNativeImage(@TempDir Path workspace) throws Exception { diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java index cf716722e703..f3f05d27a7e3 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java @@ -18,7 +18,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -import org.junit.jupiter.api.parallel.ResourceLock; import org.opentest4j.TestAbortedException; import platform.tooling.support.Helper; @@ -30,7 +29,6 @@ */ class GradleKotlinExtensionsTests { - @ResourceLock(Projects.GRADLE_KOTLIN_EXTENSIONS) @Test void gradle_wrapper(@TempDir Path workspace) throws Exception { var result = ProcessStarters.gradlew() // diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java index 1dd58386e4c2..4c685ba56553 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java @@ -18,7 +18,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -import org.junit.jupiter.api.parallel.ResourceLock; import org.junit.platform.reporting.testutil.FileUtils; import org.opentest4j.TestAbortedException; @@ -31,7 +30,6 @@ */ class GradleMissingEngineTests { - @ResourceLock(Projects.GRADLE_MISSING_ENGINE) @Test void gradle_wrapper(@TempDir Path workspace) throws Exception { var result = ProcessStarters.gradlew() // diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java index d4a991c8e762..8ca672d197bb 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java @@ -20,7 +20,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -import org.junit.jupiter.api.parallel.ResourceLock; import org.opentest4j.TestAbortedException; import platform.tooling.support.Helper; @@ -32,7 +31,6 @@ */ class GradleStarterTests { - @ResourceLock(Projects.GRADLE_STARTER) @Test void gradle_wrapper(@TempDir Path workspace) throws Exception { var result = ProcessStarters.gradlew() // diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java index c3cc848eaf62..6d1d30f7c8ad 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java @@ -20,7 +20,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; -import org.junit.jupiter.api.parallel.ResourceLock; import org.opentest4j.TestAbortedException; import platform.tooling.support.Helper; @@ -38,7 +37,6 @@ class MavenStarterTests { @GlobalResource MavenRepoProxy mavenRepoProxy; - @ResourceLock(Projects.MAVEN_STARTER) @Test void verifyMavenStarterProject(@TempDir Path workspace) throws Exception { var result = ProcessStarters.maven() // From 0839b2b95f95f0de133f61e6d109efe048ad29f3 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 27 Nov 2024 21:43:21 +0100 Subject: [PATCH 350/611] Set max pool size for parallel execution --- .../src/test/resources/junit-platform.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform-tooling-support-tests/src/test/resources/junit-platform.properties b/platform-tooling-support-tests/src/test/resources/junit-platform.properties index 3d0a67b57d8a..d24bbed7d3d9 100644 --- a/platform-tooling-support-tests/src/test/resources/junit-platform.properties +++ b/platform-tooling-support-tests/src/test/resources/junit-platform.properties @@ -2,8 +2,9 @@ junit.jupiter.execution.parallel.enabled=true junit.jupiter.execution.parallel.mode.default=concurrent junit.jupiter.execution.parallel.config.strategy=dynamic junit.jupiter.execution.parallel.config.dynamic.factor=0.25 +junit.jupiter.execution.parallel.config.dynamic.max-pool-size-factor=1 junit.jupiter.testclass.order.default = \ org.junit.jupiter.api.ClassOrderer$OrderAnnotation -junit.jupiter.execution.timeout.default = 3 m +junit.jupiter.execution.timeout.default = 3m From 4ca5bfd86e740d3a508aea7703116fb2584b2862 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 28 Nov 2024 08:00:12 +0100 Subject: [PATCH 351/611] Reduce number of Helper methods --- .../java/platform/tooling/support/Helper.java | 87 ++----------------- .../platform/tooling/support/MavenRepo.java | 14 ++- .../tooling/support/tests/ArchUnitTests.java | 25 +++++- .../support/tests/JarDescribeModuleTests.java | 9 +- .../support/tests/ModularUserGuideTests.java | 34 +++++++- 5 files changed, 81 insertions(+), 88 deletions(-) diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/Helper.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/Helper.java index 4bb2c6c73ad6..9f5d3f08d1ee 100644 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/Helper.java +++ b/platform-tooling-support-tests/src/main/java/platform/tooling/support/Helper.java @@ -10,23 +10,15 @@ package platform.tooling.support; -import java.io.IOException; -import java.io.UncheckedIOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.time.Duration; -import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.Optional; import java.util.Properties; -import java.util.function.Consumer; -import java.util.function.Predicate; -import java.util.jar.JarFile; import java.util.regex.Matcher; import java.util.regex.Pattern; -import java.util.stream.Collectors; import java.util.stream.Stream; /** @@ -34,8 +26,6 @@ */ public class Helper { - public static final Duration TOOL_TIMEOUT = Duration.ofMinutes(3); - private static final Path ROOT = Paths.get(".."); private static final Path GRADLE_PROPERTIES = ROOT.resolve("gradle.properties"); private static final Path SETTINGS_GRADLE = ROOT.resolve("settings.gradle.kts"); @@ -64,56 +54,21 @@ public static String version(String module) { throw new AssertionError("Unknown module: " + module); } - static String groupId(String artifactId) { - if (artifactId.startsWith("junit-jupiter")) { - return "org.junit.jupiter"; - } - if (artifactId.startsWith("junit-platform")) { - return "org.junit.platform"; - } - if (artifactId.startsWith("junit-vintage")) { - return "org.junit.vintage"; - } - return "org.junit"; - } - - public static String replaceVersionPlaceholders(String line) { - line = line.replace("${jupiterVersion}", version("junit-jupiter")); - line = line.replace("${vintageVersion}", version("junit-vintage")); - line = line.replace("${platformVersion}", version("junit-platform")); - return line; - } - public static List loadModuleDirectoryNames() { var moduleLinePattern = Pattern.compile("include\\(\"(.+)\"\\)"); - try (var stream = Files.lines(SETTINGS_GRADLE) // - .map(moduleLinePattern::matcher) // - .filter(Matcher::matches) // - .map(matcher -> matcher.group(1)) // - .filter(name -> name.startsWith("junit-")) // - .filter(name -> !name.equals("junit-bom")) // - .filter(name -> !name.equals("junit-platform-console-standalone"))) { - return stream.collect(Collectors.toList()); + try (var stream = Files.lines(SETTINGS_GRADLE)) { + return stream.map(moduleLinePattern::matcher) // + .filter(Matcher::matches) // + .map(matcher -> matcher.group(1)) // + .filter(name -> name.startsWith("junit-")) // + .filter(name -> !name.equals("junit-bom")) // + .filter(name -> !name.equals("junit-platform-console-standalone")).toList(); } catch (Exception e) { throw new AssertionError("loading module directory names failed: " + SETTINGS_GRADLE); } } - static JarFile createJarFile(String module) { - var path = MavenRepo.jar(module); - try { - return new JarFile(path.toFile()); - } - catch (IOException e) { - throw new UncheckedIOException("Creating JarFile for '" + path + "' failed.", e); - } - } - - public static List loadJarFiles() { - return loadModuleDirectoryNames().stream().map(Helper::createJarFile).collect(Collectors.toList()); - } - public static Optional getJavaHome(String version) { // First, try various system sources... var sources = Stream.of( // @@ -127,32 +82,4 @@ public static Optional getJavaHome(String version) { ); return sources.filter(Objects::nonNull).findFirst().map(Path::of); } - - /** Load, here copy, modular jar files to the given target directory. */ - public static void loadAllJUnitModules(Path target) throws Exception { - for (var module : loadModuleDirectoryNames()) { - var jar = MavenRepo.jar(module); - Files.copy(jar, target.resolve(jar.getFileName())); - } - } - - /** Walk directory tree structure. */ - public static List treeWalk(Path root) { - var lines = new ArrayList(); - treeWalk(root, lines::add); - return lines; - } - - /** Walk directory tree structure. */ - public static void treeWalk(Path root, Consumer out) { - try (var stream = Files.walk(root)) { - stream.map(root::relativize) // - .map(path -> path.toString().replace('\\', '/')) // - .sorted().filter(Predicate.not(String::isEmpty)) // - .forEach(out); - } - catch (Exception e) { - throw new Error("Walking tree failed: " + root, e); - } - } } diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/MavenRepo.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/MavenRepo.java index 2ba22ebeb8cc..84e47bfd98b8 100644 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/MavenRepo.java +++ b/platform-tooling-support-tests/src/main/java/platform/tooling/support/MavenRepo.java @@ -45,7 +45,7 @@ public static Path pom(String artifactId) { private static Path artifact(String artifactId, Predicate fileNamePredicate) { var parentDir = dir() // - .resolve(Helper.groupId(artifactId).replace('.', File.separatorChar)) // + .resolve(groupId(artifactId).replace('.', File.separatorChar)) // .resolve(artifactId) // .resolve(Helper.version(artifactId)); try (var files = Files.list(parentDir)) { @@ -57,4 +57,16 @@ private static Path artifact(String artifactId, Predicate fileNamePredic } } + private static String groupId(String artifactId) { + if (artifactId.startsWith("junit-jupiter")) { + return "org.junit.jupiter"; + } + if (artifactId.startsWith("junit-platform")) { + return "org.junit.platform"; + } + if (artifactId.startsWith("junit-vintage")) { + return "org.junit.vintage"; + } + return "org.junit"; + } } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java index 21c7e2076f30..54c297c863c8 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java @@ -26,9 +26,11 @@ import static com.tngtech.archunit.lang.conditions.ArchPredicates.have; import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes; import static com.tngtech.archunit.library.dependencies.SlicesRuleDefinition.slices; +import static java.util.stream.Collectors.toSet; import static org.junit.jupiter.api.Assertions.assertTrue; -import static platform.tooling.support.Helper.loadJarFiles; +import java.io.IOException; +import java.io.UncheckedIOException; import java.lang.annotation.Annotation; import java.lang.annotation.Repeatable; import java.lang.annotation.Retention; @@ -36,7 +38,8 @@ import java.util.Arrays; import java.util.Set; import java.util.function.BiPredicate; -import java.util.stream.Collectors; +import java.util.jar.JarFile; +import java.util.stream.Stream; import com.tngtech.archunit.base.DescribedPredicate; import com.tngtech.archunit.core.domain.JavaClass; @@ -51,6 +54,9 @@ import org.apiguardian.api.API; +import platform.tooling.support.Helper; +import platform.tooling.support.MavenRepo; + @AnalyzeClasses(locations = ArchUnitTests.AllJars.class) class ArchUnitTests { @@ -133,9 +139,22 @@ static class AllJars implements LocationProvider { @Override public Set get(Class testClass) { - return loadJarFiles().stream().map(Location::of).collect(Collectors.toSet()); + return loadJarFiles().map(Location::of).collect(toSet()); + } + + private static Stream loadJarFiles() { + return Helper.loadModuleDirectoryNames().stream().map(AllJars::createJarFile); } + private static JarFile createJarFile(String module) { + var path = MavenRepo.jar(module); + try { + return new JarFile(path.toFile()); + } + catch (IOException e) { + throw new UncheckedIOException("Creating JarFile for '" + path + "' failed.", e); + } + } } private static class RepeatableAnnotationPredicate extends DescribedPredicate { diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java index 2b113e359790..1f4df71f454b 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java @@ -46,7 +46,7 @@ void describeModule(String module) throws Exception { assertEquals(0, result.exitCode()); assertEquals("", result.stdErr(), "error log isn't empty"); - var expectedLines = Helper.replaceVersionPlaceholders( + var expectedLines = replaceVersionPlaceholders( Files.readString(sourceDirectory.resolve(module + ".expected.txt")).trim()); assertLinesMatch(expectedLines.lines().toList(), result.stdOut().trim().lines().toList()); } @@ -62,4 +62,11 @@ void packageNamesStartWithNameOfTheModule(String module) { } } + private static String replaceVersionPlaceholders(String line) { + line = line.replace("${jupiterVersion}", Helper.version("junit-jupiter")); + line = line.replace("${vintageVersion}", Helper.version("junit-vintage")); + line = line.replace("${platformVersion}", Helper.version("junit-platform")); + return line; + } + } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java index 1ef24d82e44d..a386d06244a6 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java @@ -13,6 +13,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertLinesMatch; import static org.junit.jupiter.api.Assertions.assertTrue; +import static platform.tooling.support.Helper.loadModuleDirectoryNames; import java.io.File; import java.io.PrintWriter; @@ -22,6 +23,8 @@ import java.nio.file.Path; import java.util.ArrayList; import java.util.List; +import java.util.function.Consumer; +import java.util.function.Predicate; import java.util.spi.ToolProvider; import org.junit.jupiter.api.Test; @@ -29,7 +32,7 @@ import org.junit.jupiter.api.io.TempDir; import org.junit.platform.launcher.LauncherConstants; -import platform.tooling.support.Helper; +import platform.tooling.support.MavenRepo; import platform.tooling.support.ThirdPartyJars; import platform.tooling.support.process.ProcessStarters; @@ -89,7 +92,7 @@ private static List compile(Path temp, Writer out, Writer err) throws Ex ThirdPartyJars.copy(lib, "org.opentest4j.reporting", "open-test-reporting-tooling-spi"); ThirdPartyJars.copy(lib, "com.google.jimfs", "jimfs"); ThirdPartyJars.copy(lib, "com.google.guava", "guava"); - Helper.loadAllJUnitModules(lib); + loadAllJUnitModules(lib); args.add("--module-path"); args.add(lib.toString()); @@ -156,7 +159,7 @@ void runTestsFromUserGuideWithinModularBoundaries(@TempDir Path temp) throws Exc // args.forEach(System.out::println); assertTrue(err.toString().isBlank(), () -> err + "\n\n" + String.join("\n", args)); - var listing = Helper.treeWalk(temp); + var listing = treeWalk(temp); assertLinesMatch(List.of( // "destination", // ">> CLASSES >>", // @@ -180,4 +183,29 @@ void runTestsFromUserGuideWithinModularBoundaries(@TempDir Path temp) throws Exc junit(temp); } + private static void loadAllJUnitModules(Path target) throws Exception { + for (var module : loadModuleDirectoryNames()) { + var jar = MavenRepo.jar(module); + Files.copy(jar, target.resolve(jar.getFileName())); + } + } + + private static List treeWalk(Path root) { + var lines = new ArrayList(); + treeWalk(root, lines::add); + return lines; + } + + private static void treeWalk(Path root, Consumer out) { + try (var stream = Files.walk(root)) { + stream.map(root::relativize) // + .map(path -> path.toString().replace('\\', '/')) // + .sorted().filter(Predicate.not(String::isEmpty)) // + .forEach(out); + } + catch (Exception e) { + throw new Error("Walking tree failed: " + root, e); + } + } + } From 7a4ee8e0200b4ee6cdc93e173b87fe92754340a3 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 28 Nov 2024 08:05:53 +0100 Subject: [PATCH 352/611] Choose right executable on Windows --- .../platform-tooling-support-tests.gradle.kts | 4 ++-- .../tooling/support/process/ProcessStarters.java | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts index fe110ae96276..552dd30f0912 100644 --- a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts +++ b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts @@ -50,8 +50,8 @@ dependencies { implementation(libs.groovy4) { because("it provides convenience methods to handle process output") } - implementation(libs.opentest4j) { - because("it throws TestAbortedException to abort tests") + implementation(projects.junitJupiterApi) { + because("it throws TestAbortedException to abort tests and uses the OS enum") } testImplementation(libs.archunit) { diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessStarters.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessStarters.java index 8eb49cb35d1d..379b206b4a23 100644 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessStarters.java +++ b/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessStarters.java @@ -13,6 +13,7 @@ import java.nio.file.Path; import java.util.Optional; +import org.junit.jupiter.api.condition.OS; import org.opentest4j.TestAbortedException; import platform.tooling.support.Helper; @@ -45,17 +46,22 @@ public static ProcessStarter javaCommand(Path javaHome, String commandName) { public static ProcessStarter gradlew() { var starter = new ProcessStarter() // - .executable(Path.of("..").resolve("gradlew")) // + .executable(Path.of("..").resolve(windowsOrOtherExecutable("gradlew.bat", "gradlew"))) // .putEnvironment("JAVA_HOME", getGradleJavaHome().orElseThrow(TestAbortedException::new)); return withCommonEnvironmentVariables(starter); } public static ProcessStarter maven() { var starter = new ProcessStarter() // - .executable(Path.of(System.getProperty("mavenDistribution")).resolve("bin/mvn")); + .executable(Path.of(System.getProperty("mavenDistribution")).resolve("bin").resolve( + windowsOrOtherExecutable("mvn.cmd", "mvn"))); return withCommonEnvironmentVariables(starter); } + private static String windowsOrOtherExecutable(String cmdOrExe, String other) { + return OS.current() == OS.WINDOWS ? cmdOrExe : other; + } + private static ProcessStarter withCommonEnvironmentVariables(ProcessStarter starter) { starter.putEnvironment("JUNIT_JUPITER_VERSION", Helper.version("junit-jupiter")); starter.putEnvironment("JUNIT_VINTAGE_VERSION", Helper.version("junit-vintage")); From 164f59076a12481e7807983b1ce4e8af6226e109 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 28 Nov 2024 08:26:24 +0100 Subject: [PATCH 353/611] Inject versions into Gradle and Maven builds more idiomatically --- .../projects/graalvm-starter/build.gradle.kts | 4 ++-- .../gradle-kotlin-extensions/build.gradle.kts | 5 ++-- .../gradle-missing-engine/build.gradle.kts | 21 ++-------------- .../projects/gradle-starter/build.gradle.kts | 5 ++-- .../projects/java-versions/pom.xml | 2 -- .../projects/maven-starter/pom.xml | 1 - .../maven-surefire-compatibility/pom.xml | 1 - .../projects/multi-release-jar/pom.xml | 3 --- .../reflection-tests/build.gradle.kts | 6 ++--- .../projects/vintage/build.gradle.kts | 5 ++-- .../projects/vintage/pom.xml | 3 +-- .../support/process/ProcessStarters.java | 24 +++++++++---------- 12 files changed, 25 insertions(+), 55 deletions(-) diff --git a/platform-tooling-support-tests/projects/graalvm-starter/build.gradle.kts b/platform-tooling-support-tests/projects/graalvm-starter/build.gradle.kts index 398dabc34424..77a7a5053c65 100644 --- a/platform-tooling-support-tests/projects/graalvm-starter/build.gradle.kts +++ b/platform-tooling-support-tests/projects/graalvm-starter/build.gradle.kts @@ -3,8 +3,8 @@ plugins { id("org.graalvm.buildtools.native") } -val jupiterVersion: String = System.getenv("JUNIT_JUPITER_VERSION") -val platformVersion: String = System.getenv("JUNIT_PLATFORM_VERSION") +val jupiterVersion: String by project +val platformVersion: String by project repositories { maven { url = uri(file(System.getProperty("maven.repo"))) } diff --git a/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts b/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts index e0803533465b..5f343d010524 100644 --- a/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts +++ b/platform-tooling-support-tests/projects/gradle-kotlin-extensions/build.gradle.kts @@ -9,9 +9,8 @@ repositories { mavenCentral() } -// grab jupiter version from system environment -val jupiterVersion = System.getenv("JUNIT_JUPITER_VERSION") -val platformVersion: String = System.getenv("JUNIT_PLATFORM_VERSION") +val jupiterVersion: String by project +val platformVersion: String by project dependencies { testImplementation(kotlin("stdlib-jdk8")) diff --git a/platform-tooling-support-tests/projects/gradle-missing-engine/build.gradle.kts b/platform-tooling-support-tests/projects/gradle-missing-engine/build.gradle.kts index 6eec5d884cae..50b4e7b2924b 100644 --- a/platform-tooling-support-tests/projects/gradle-missing-engine/build.gradle.kts +++ b/platform-tooling-support-tests/projects/gradle-missing-engine/build.gradle.kts @@ -2,25 +2,8 @@ plugins { java } -// grab jupiter version from system environment -val jupiterVersion: String = System.getenv("JUNIT_JUPITER_VERSION") -val vintageVersion: String = System.getenv("JUNIT_VINTAGE_VERSION") -val platformVersion: String = System.getenv("JUNIT_PLATFORM_VERSION") - -// emit default file encoding to a file -file("file.encoding.txt").writeText(System.getProperty("file.encoding")) - -// emit more Java runtime information -file("java.runtime.txt").writeText(""" -java.version=${System.getProperty("java.version")} -""") - -// emit versions of JUnit groups -file("junit.versions.txt").writeText(""" -jupiterVersion=$jupiterVersion -vintageVersion=$vintageVersion -platformVersion=$platformVersion -""") +val jupiterVersion: String by project +val platformVersion: String by project repositories { maven { url = uri(file(System.getProperty("maven.repo"))) } diff --git a/platform-tooling-support-tests/projects/gradle-starter/build.gradle.kts b/platform-tooling-support-tests/projects/gradle-starter/build.gradle.kts index c6957f5e185c..751889da23d0 100644 --- a/platform-tooling-support-tests/projects/gradle-starter/build.gradle.kts +++ b/platform-tooling-support-tests/projects/gradle-starter/build.gradle.kts @@ -2,9 +2,8 @@ plugins { java } -// grab jupiter version from system environment -val jupiterVersion: String = System.getenv("JUNIT_JUPITER_VERSION") -val platformVersion: String = System.getenv("JUNIT_PLATFORM_VERSION") +val jupiterVersion: String by project +val platformVersion: String by project repositories { maven { url = uri(file(System.getProperty("maven.repo"))) } diff --git a/platform-tooling-support-tests/projects/java-versions/pom.xml b/platform-tooling-support-tests/projects/java-versions/pom.xml index b71339842409..d9d22bbec6b6 100644 --- a/platform-tooling-support-tests/projects/java-versions/pom.xml +++ b/platform-tooling-support-tests/projects/java-versions/pom.xml @@ -9,8 +9,6 @@ UTF-8 - ${env.JUNIT_JUPITER_VERSION} - ${env.JUNIT_PLATFORM_VERSION} diff --git a/platform-tooling-support-tests/projects/maven-starter/pom.xml b/platform-tooling-support-tests/projects/maven-starter/pom.xml index 68525c5f3c37..4f1552a66cab 100644 --- a/platform-tooling-support-tests/projects/maven-starter/pom.xml +++ b/platform-tooling-support-tests/projects/maven-starter/pom.xml @@ -11,7 +11,6 @@ UTF-8 1.8 ${maven.compiler.source} - ${env.JUNIT_JUPITER_VERSION} diff --git a/platform-tooling-support-tests/projects/maven-surefire-compatibility/pom.xml b/platform-tooling-support-tests/projects/maven-surefire-compatibility/pom.xml index 087c319f5c44..3ac0876b2d8b 100644 --- a/platform-tooling-support-tests/projects/maven-surefire-compatibility/pom.xml +++ b/platform-tooling-support-tests/projects/maven-surefire-compatibility/pom.xml @@ -11,7 +11,6 @@ UTF-8 1.8 ${maven.compiler.source} - ${env.JUNIT_JUPITER_VERSION} diff --git a/platform-tooling-support-tests/projects/multi-release-jar/pom.xml b/platform-tooling-support-tests/projects/multi-release-jar/pom.xml index 8b057424f19a..9c96f86949bf 100644 --- a/platform-tooling-support-tests/projects/multi-release-jar/pom.xml +++ b/platform-tooling-support-tests/projects/multi-release-jar/pom.xml @@ -9,9 +9,6 @@ UTF-8 - ${env.JUNIT_JUPITER_VERSION} - ${env.JUNIT_VINTAGE_VERSION} - ${env.JUNIT_PLATFORM_VERSION} diff --git a/platform-tooling-support-tests/projects/reflection-tests/build.gradle.kts b/platform-tooling-support-tests/projects/reflection-tests/build.gradle.kts index 23053cf355d4..0dea5aab80a1 100644 --- a/platform-tooling-support-tests/projects/reflection-tests/build.gradle.kts +++ b/platform-tooling-support-tests/projects/reflection-tests/build.gradle.kts @@ -2,10 +2,8 @@ plugins { java } -// grab jupiter version from system environment -val jupiterVersion: String = System.getenv("JUNIT_JUPITER_VERSION") -val vintageVersion: String = System.getenv("JUNIT_VINTAGE_VERSION") -val platformVersion: String = System.getenv("JUNIT_PLATFORM_VERSION") +val jupiterVersion: String by project +val platformVersion: String by project repositories { maven { url = uri(file(System.getProperty("maven.repo"))) } diff --git a/platform-tooling-support-tests/projects/vintage/build.gradle.kts b/platform-tooling-support-tests/projects/vintage/build.gradle.kts index 80f15a7118e2..37bab7448d5b 100644 --- a/platform-tooling-support-tests/projects/vintage/build.gradle.kts +++ b/platform-tooling-support-tests/projects/vintage/build.gradle.kts @@ -9,17 +9,18 @@ repositories { mavenCentral() } +val platformVersion: String by project +val vintageVersion: String by project + dependencies { val junit4Version = System.getProperty("junit4Version", "4.12") testImplementation("junit:junit:$junit4Version") - val vintageVersion = System.getenv("JUNIT_VINTAGE_VERSION") ?: "5.3.2" testImplementation("org.junit.vintage:junit-vintage-engine:$vintageVersion") { exclude(group = "junit") because("we want to override it to test against different versions") } - val platformVersion: String = System.getenv("JUNIT_PLATFORM_VERSION") testRuntimeOnly("org.junit.platform:junit-platform-launcher:$platformVersion") } diff --git a/platform-tooling-support-tests/projects/vintage/pom.xml b/platform-tooling-support-tests/projects/vintage/pom.xml index e87d42d8d728..164570994740 100644 --- a/platform-tooling-support-tests/projects/vintage/pom.xml +++ b/platform-tooling-support-tests/projects/vintage/pom.xml @@ -11,14 +11,13 @@ UTF-8 1.8 ${maven.compiler.source} - ${env.JUNIT_VINTAGE_VERSION} org.junit.vintage junit-vintage-engine - ${vintageVersion} + ${junit.vintage.version} test diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessStarters.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessStarters.java index 379b206b4a23..27c78accc9ce 100644 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessStarters.java +++ b/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessStarters.java @@ -45,30 +45,28 @@ public static ProcessStarter javaCommand(Path javaHome, String commandName) { } public static ProcessStarter gradlew() { - var starter = new ProcessStarter() // + return new ProcessStarter() // .executable(Path.of("..").resolve(windowsOrOtherExecutable("gradlew.bat", "gradlew"))) // - .putEnvironment("JAVA_HOME", getGradleJavaHome().orElseThrow(TestAbortedException::new)); - return withCommonEnvironmentVariables(starter); + .putEnvironment("JAVA_HOME", getGradleJavaHome().orElseThrow(TestAbortedException::new)) // + .addArguments("-PjupiterVersion=" + Helper.version("junit-jupiter")) // + .addArguments("-PvintageVersion=" + Helper.version("junit-vintage")) // + .addArguments("-PplatformVersion=" + Helper.version("junit-platform")); } public static ProcessStarter maven() { - var starter = new ProcessStarter() // + return new ProcessStarter() // .executable(Path.of(System.getProperty("mavenDistribution")).resolve("bin").resolve( - windowsOrOtherExecutable("mvn.cmd", "mvn"))); - return withCommonEnvironmentVariables(starter); + windowsOrOtherExecutable("mvn.cmd", "mvn"))) // + .addArguments("-Djunit.jupiter.version=" + Helper.version("junit-jupiter")) // + .addArguments("-Djunit.bom.version=" + Helper.version("junit-jupiter")) // + .addArguments("-Djunit.vintage.version=" + Helper.version("junit-vintage")) // + .addArguments("-Djunit.platform.version=" + Helper.version("junit-platform")); } private static String windowsOrOtherExecutable(String cmdOrExe, String other) { return OS.current() == OS.WINDOWS ? cmdOrExe : other; } - private static ProcessStarter withCommonEnvironmentVariables(ProcessStarter starter) { - starter.putEnvironment("JUNIT_JUPITER_VERSION", Helper.version("junit-jupiter")); - starter.putEnvironment("JUNIT_VINTAGE_VERSION", Helper.version("junit-vintage")); - starter.putEnvironment("JUNIT_PLATFORM_VERSION", Helper.version("junit-platform")); - return starter; - } - public static Optional getGradleJavaHome() { return Helper.getJavaHome(System.getProperty("gradle.java.version")); } From eb9614423253a4adf2eaac2f6ee331087ef27fee Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 28 Nov 2024 08:45:56 +0100 Subject: [PATCH 354/611] Remove unused tracking of duration --- .../support/process/ProcessResult.java | 3 +-- .../support/process/ProcessStarter.java | 26 +++++++++++-------- .../support/process/WatchedProcess.java | 12 ++------- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessResult.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessResult.java index 7fa058d8e932..b69ecc77b5f1 100644 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessResult.java +++ b/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessResult.java @@ -10,10 +10,9 @@ package platform.tooling.support.process; -import java.time.Duration; import java.util.List; -public record ProcessResult(int exitCode, Duration duration, String stdOut, String stdErr) { +public record ProcessResult(int exitCode, String stdOut, String stdErr) { public List stdOutLines() { return stdOut.lines().toList(); diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessStarter.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessStarter.java index b46dbeb61503..519b2d601b57 100644 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessStarter.java +++ b/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessStarter.java @@ -10,21 +10,21 @@ package platform.tooling.support.process; -import static org.codehaus.groovy.runtime.ProcessGroovyMethods.consumeProcessErrorStream; -import static org.codehaus.groovy.runtime.ProcessGroovyMethods.consumeProcessOutputStream; - import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintStream; import java.io.UncheckedIOException; import java.nio.file.Path; -import java.time.Instant; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.function.BiFunction; import java.util.stream.Stream; import org.apache.commons.io.output.TeeOutputStream; +import org.codehaus.groovy.runtime.ProcessGroovyMethods; public class ProcessStarter { @@ -74,17 +74,21 @@ public WatchedProcess start() { builder.directory(workingDir.toFile()); } builder.environment().putAll(environment); - var start = Instant.now(); - var out = new ByteArrayOutputStream(); - var err = new ByteArrayOutputStream(); var process = builder.start(); - var outThread = consumeProcessOutputStream(process, new TeeOutputStream(System.out, out)); - var errThread = consumeProcessErrorStream(process, new TeeOutputStream(System.err, err)); - return new WatchedProcess(start, process, new WatchedOutput(outThread, out), - new WatchedOutput(errThread, err)); + var out = forwardAndCaptureOutput(process, System.out, ProcessGroovyMethods::consumeProcessOutputStream); + var err = forwardAndCaptureOutput(process, System.err, ProcessGroovyMethods::consumeProcessErrorStream); + return new WatchedProcess(process, out, err); } catch (IOException e) { throw new UncheckedIOException("Failed to start process: " + command, e); } } + + private static WatchedOutput forwardAndCaptureOutput(Process process, PrintStream delegate, + BiFunction captureAction) { + var capturingStream = new ByteArrayOutputStream(); + var thread = captureAction.apply(process, new TeeOutputStream(delegate, capturingStream)); + return new WatchedOutput(thread, capturingStream); + } + } diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/WatchedProcess.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/WatchedProcess.java index 199cfe929b6e..3e048e5b0caf 100644 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/WatchedProcess.java +++ b/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/WatchedProcess.java @@ -10,18 +10,13 @@ package platform.tooling.support.process; -import java.time.Duration; -import java.time.Instant; - public class WatchedProcess { - private final Instant start; private final Process process; private final WatchedOutput out; private final WatchedOutput err; - WatchedProcess(Instant start, Process process, WatchedOutput out, WatchedOutput err) { - this.start = start; + WatchedProcess(Process process, WatchedOutput out, WatchedOutput err) { this.process = process; this.out = out; this.err = err; @@ -30,11 +25,9 @@ public class WatchedProcess { ProcessResult waitFor() throws InterruptedException { try { int exitCode; - Instant end; try { try { exitCode = process.waitFor(); - end = Instant.now(); } catch (InterruptedException e) { process.destroyForcibly(); @@ -49,8 +42,7 @@ ProcessResult waitFor() throws InterruptedException { err.join(); } } - return new ProcessResult(exitCode, Duration.between(start, end), out.getStreamAsString(), - err.getStreamAsString()); + return new ProcessResult(exitCode, out.getStreamAsString(), err.getStreamAsString()); } finally { process.destroyForcibly(); From e2f5a434f9eec42321eba4cbb092517cd70ad2c9 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 28 Nov 2024 08:52:59 +0100 Subject: [PATCH 355/611] Try to force the JVM to release file handles on Windows --- .../tooling/support/tests/ToolProviderTests.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ToolProviderTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ToolProviderTests.java index 753cc873819a..b3dc357a59b1 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ToolProviderTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ToolProviderTests.java @@ -33,9 +33,11 @@ import java.util.spi.ToolProvider; import java.util.stream.StreamSupport; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.OS; import org.junit.jupiter.api.extension.DisabledOnOpenJ9; import org.junit.jupiter.api.io.TempDir; @@ -76,6 +78,14 @@ static void prepareLocalLibraryDirectoryWithJUnitPlatformModules() { } } + @AfterAll + static void triggerReleaseOfFileHandlesOnWindows() throws Exception { + if (OS.current() == OS.WINDOWS) { + System.gc(); + Thread.sleep(1_000); + } + } + @Test void findAndRunJUnitOnTheClassPath() { try (var loader = new URLClassLoader("junit", urls(lib), ClassLoader.getPlatformClassLoader())) { From 21c24aee45d01766e17461dbe28bf33d9b65a2d0 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 28 Nov 2024 08:59:45 +0100 Subject: [PATCH 356/611] Polishing --- .../tooling/support/tests/ModularUserGuideTests.java | 5 ++--- .../platform/tooling/support/tests/ToolProviderTests.java | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java index a386d06244a6..228d287c2c62 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java @@ -122,7 +122,7 @@ private static List compile(Path temp, Writer out, Writer err) throws Ex } private static void junit(Path temp) throws Exception { - var projectDir = Path.of("../documentation"); + var projectDir = Path.of("../documentation").toAbsolutePath(); var result = ProcessStarters.java() // .workingDir(projectDir) // @@ -133,8 +133,7 @@ private static void junit(Path temp) throws Exception { temp.resolve("lib").toString() // )) // .addArguments("--add-modules", "documentation") // - .addArguments("--patch-module", - "documentation=" + projectDir.resolve("src/test/resources").toAbsolutePath()) // + .addArguments("--patch-module", "documentation=" + projectDir.resolve("src/test/resources")) // .addArguments("--module", "org.junit.platform.console") // .addArguments("execute") // .addArguments("--scan-modules") // diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ToolProviderTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ToolProviderTests.java index b3dc357a59b1..792e2aa49667 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ToolProviderTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ToolProviderTests.java @@ -57,7 +57,7 @@ class ToolProviderTests { @BeforeAll static void prepareLocalLibraryDirectoryWithJUnitPlatformModules() { try { - var lib = Files.createDirectories(ToolProviderTests.lib); + Files.createDirectories(lib); try (var directoryStream = Files.newDirectoryStream(lib, "*.jar")) { for (Path jarFile : directoryStream) { Files.delete(jarFile); From 4e39fc31bad7c19eade5b93a2434046b7a8d6512 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 28 Nov 2024 09:43:54 +0100 Subject: [PATCH 357/611] Recordify WatchedOutput --- .../tooling/support/process/WatchedOutput.java | 16 ++-------------- .../tooling/support/process/WatchedProcess.java | 6 +++--- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/WatchedOutput.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/WatchedOutput.java index a86e411d101a..67019b147688 100644 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/WatchedOutput.java +++ b/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/WatchedOutput.java @@ -13,23 +13,11 @@ import java.io.ByteArrayOutputStream; import java.nio.charset.Charset; -public class WatchedOutput { +record WatchedOutput(Thread thread, ByteArrayOutputStream stream) { private static final Charset CHARSET = Charset.forName(System.getProperty("native.encoding")); - private final Thread thread; - private final ByteArrayOutputStream stream; - - WatchedOutput(Thread thread, ByteArrayOutputStream stream) { - this.thread = thread; - this.stream = stream; - } - - void join() throws InterruptedException { - thread.join(); - } - - public String getStreamAsString() { + String streamAsString() { return stream.toString(CHARSET); } } diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/WatchedProcess.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/WatchedProcess.java index 3e048e5b0caf..4b41d100e404 100644 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/WatchedProcess.java +++ b/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/WatchedProcess.java @@ -36,13 +36,13 @@ ProcessResult waitFor() throws InterruptedException { } finally { try { - out.join(); + out.thread().join(); } finally { - err.join(); + err.thread().join(); } } - return new ProcessResult(exitCode, out.getStreamAsString(), err.getStreamAsString()); + return new ProcessResult(exitCode, out.streamAsString(), err.streamAsString()); } finally { process.destroyForcibly(); From 79c2cdc15c83e1be69c3e0317768ed9020df3738 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 28 Nov 2024 09:56:50 +0100 Subject: [PATCH 358/611] Make test independent of local Git repo config --- .../xml/OpenTestReportGeneratingListener.java | 16 ++++++++++++---- .../OpenTestReportGeneratingListenerTests.java | 6 +----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java index c7fbef603e88..ba18a68c128b 100644 --- a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java +++ b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java @@ -58,6 +58,7 @@ import java.net.UnknownHostException; import java.nio.charset.Charset; import java.nio.file.Path; +import java.nio.file.Paths; import java.time.Instant; import java.util.Map; import java.util.Optional; @@ -108,9 +109,16 @@ public class OpenTestReportGeneratingListener implements TestExecutionListener { private final AtomicInteger idCounter = new AtomicInteger(); private final Map inProgressIds = new ConcurrentHashMap<>(); private DocumentWriter eventsFileWriter = DocumentWriter.noop(); + private final Path workingDir; private Path outputDir; + @SuppressWarnings("unused") // Used via ServiceLoader public OpenTestReportGeneratingListener() { + this(Paths.get(".").toAbsolutePath()); + } + + OpenTestReportGeneratingListener(Path workingDir) { + this.workingDir = workingDir; } @Override @@ -160,7 +168,7 @@ private void reportInfrastructure() { }); } - private static void addGitInfo(Infrastructure infrastructure) { + private void addGitInfo(Infrastructure infrastructure) { boolean gitInstalled = exec("git", "--version").isPresent(); if (gitInstalled) { exec("git", "config", "--get", "remote.origin.url") // @@ -179,7 +187,7 @@ private static void addGitInfo(Infrastructure infrastructure) { } } - static Optional exec(String... args) { + Optional exec(String... args) { Process process = startProcess(args); @@ -211,10 +219,10 @@ private static BufferedReader newBufferedReader(InputStream stream) { return new BufferedReader(new InputStreamReader(stream, Charset.defaultCharset())); } - private static Process startProcess(String[] args) { + private Process startProcess(String[] command) { Process process; try { - process = Runtime.getRuntime().exec(args); + process = new ProcessBuilder().directory(workingDir.toFile()).command(command).start(); } catch (IOException e) { throw new UncheckedIOException("Failed to start process", e); diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java index cd7792776187..dc6c84291505 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java @@ -79,10 +79,6 @@ void writesValidXmlReport() throws Exception { ${xmlunit.ignore} ${xmlunit.ignore} - - ${xmlunit.ignore} - ${xmlunit.matchesRegex#[0-9a-f]{40}#} - ${xmlunit.ignore} @@ -137,7 +133,7 @@ private void executeTests(TestEngine engine) { .configurationParameter(OUTPUT_DIR_PROPERTY_NAME, tempDirectory.resolve("junit-" + OUTPUT_DIR_UNIQUE_NUMBER_PLACEHOLDER).toString()) // .build(); - createLauncher(engine).execute(build, new OpenTestReportGeneratingListener()); + createLauncher(engine).execute(build, new OpenTestReportGeneratingListener(tempDirectory)); } } From 33679e7fd60c774ee6cf6939a3d15a1e674e991c Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 28 Nov 2024 10:17:29 +0100 Subject: [PATCH 359/611] Move ProcessStarter to separate source set to allow reuse --- platform-tests/platform-tests.gradle.kts | 38 ++++++++++++++++++- .../tests}/process/ProcessResult.java | 2 +- .../tests}/process/ProcessStarter.java | 2 +- .../tests}/process/WatchedOutput.java | 2 +- .../tests}/process/WatchedProcess.java | 2 +- .../platform/tests}/process/package-info.java | 2 +- .../platform-tooling-support-tests.gradle.kts | 8 ++-- .../{process => }/ProcessStarters.java | 5 +-- .../support/tests/AntStarterTests.java | 2 +- .../support/tests/GraalVmStarterTests.java | 2 +- .../tests/GradleKotlinExtensionsTests.java | 2 +- .../tests/GradleMissingEngineTests.java | 2 +- .../support/tests/GradleStarterTests.java | 2 +- .../support/tests/JarDescribeModuleTests.java | 2 +- .../support/tests/JavaVersionsTests.java | 4 +- .../support/tests/MavenStarterTests.java | 2 +- .../MavenSurefireCompatibilityTests.java | 2 +- .../support/tests/ModularUserGuideTests.java | 2 +- .../support/tests/MultiReleaseJarTests.java | 2 +- .../tests/ReflectionCompatibilityTests.java | 2 +- .../support/tests/StandaloneTests.java | 4 +- .../tests/VintageGradleIntegrationTests.java | 4 +- .../tests/VintageMavenIntegrationTests.java | 4 +- 23 files changed, 68 insertions(+), 31 deletions(-) rename {platform-tooling-support-tests/src/main/java/platform/tooling/support => platform-tests/src/processStarter/java/org/junit/platform/tests}/process/ProcessResult.java (93%) rename {platform-tooling-support-tests/src/main/java/platform/tooling/support => platform-tests/src/processStarter/java/org/junit/platform/tests}/process/ProcessStarter.java (98%) rename {platform-tooling-support-tests/src/main/java/platform/tooling/support => platform-tests/src/processStarter/java/org/junit/platform/tests}/process/WatchedOutput.java (93%) rename {platform-tooling-support-tests/src/main/java/platform/tooling/support => platform-tests/src/processStarter/java/org/junit/platform/tests}/process/WatchedProcess.java (96%) rename {platform-tooling-support-tests/src/main/java/platform/tooling/support => platform-tests/src/processStarter/java/org/junit/platform/tests}/process/package-info.java (61%) rename platform-tooling-support-tests/src/main/java/platform/tooling/support/{process => }/ProcessStarters.java (96%) diff --git a/platform-tests/platform-tests.gradle.kts b/platform-tests/platform-tests.gradle.kts index d5e7467c401e..cd4c8711fb40 100644 --- a/platform-tests/platform-tests.gradle.kts +++ b/platform-tests/platform-tests.gradle.kts @@ -1,3 +1,5 @@ + +import junitbuild.extensions.capitalized import org.gradle.api.tasks.PathSensitivity.NONE import org.gradle.api.tasks.PathSensitivity.RELATIVE import org.gradle.internal.os.OperatingSystem @@ -9,6 +11,18 @@ plugins { id("junitbuild.jmh-conventions") } +val processStarter by sourceSets.creating { + java { + srcDir("src/processStarter/java") + } +} + +java { + registerFeature(processStarter.name) { + usingSourceSet(processStarter) + } +} + dependencies { // --- Things we are testing -------------------------------------------------- testImplementation(projects.junitPlatformCommons) @@ -37,6 +51,11 @@ dependencies { testImplementation(libs.bundles.xmlunit) testImplementation(testFixtures(projects.junitJupiterApi)) testImplementation(testFixtures(projects.junitPlatformReporting)) + testImplementation(projects.platformTests) { + capabilities { + requireFeature("process-starter") + } + } // --- Test run-time dependencies --------------------------------------------- testRuntimeOnly(projects.junitVintageEngine) @@ -44,9 +63,20 @@ dependencies { because("`ReflectionUtilsTests.findNestedClassesWithInvalidNestedClassFile` needs it") } - // --- https://openjdk.java.net/projects/code-tools/jmh/ ----------------------- + // --- https://openjdk.java.net/projects/code-tools/jmh/ ---------------------- jmh(projects.junitJupiterApi) jmh(libs.junit4) + + // --- ProcessStarter dependencies -------------------------------------------- + processStarter.implementationConfigurationName(libs.groovy4) { + because("it provides convenience methods to handle process output") + } + processStarter.implementationConfigurationName(libs.commons.io) { + because("it uses TeeOutputStream") + } + processStarter.implementationConfigurationName(libs.opentest4j) { + because("it throws TestAbortedException") + } } jmh { @@ -80,6 +110,12 @@ tasks { includeTags("junit4") } } + named(processStarter.compileJavaTaskName).configure { + options.release = 21 + } + named("checkstyle${processStarter.name.capitalized()}").configure { + config = resources.text.fromFile(checkstyle.configDirectory.file("checkstyleMain.xml")) + } } eclipse { diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessResult.java b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/ProcessResult.java similarity index 93% rename from platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessResult.java rename to platform-tests/src/processStarter/java/org/junit/platform/tests/process/ProcessResult.java index b69ecc77b5f1..9c018e7aaf79 100644 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessResult.java +++ b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/ProcessResult.java @@ -8,7 +8,7 @@ * https://www.eclipse.org/legal/epl-v20.html */ -package platform.tooling.support.process; +package org.junit.platform.tests.process; import java.util.List; diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessStarter.java b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/ProcessStarter.java similarity index 98% rename from platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessStarter.java rename to platform-tests/src/processStarter/java/org/junit/platform/tests/process/ProcessStarter.java index 519b2d601b57..a7ad54a3fd7d 100644 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessStarter.java +++ b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/ProcessStarter.java @@ -8,7 +8,7 @@ * https://www.eclipse.org/legal/epl-v20.html */ -package platform.tooling.support.process; +package org.junit.platform.tests.process; import java.io.ByteArrayOutputStream; import java.io.IOException; diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/WatchedOutput.java b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/WatchedOutput.java similarity index 93% rename from platform-tooling-support-tests/src/main/java/platform/tooling/support/process/WatchedOutput.java rename to platform-tests/src/processStarter/java/org/junit/platform/tests/process/WatchedOutput.java index 67019b147688..47cf7e5c2c12 100644 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/WatchedOutput.java +++ b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/WatchedOutput.java @@ -8,7 +8,7 @@ * https://www.eclipse.org/legal/epl-v20.html */ -package platform.tooling.support.process; +package org.junit.platform.tests.process; import java.io.ByteArrayOutputStream; import java.nio.charset.Charset; diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/WatchedProcess.java b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/WatchedProcess.java similarity index 96% rename from platform-tooling-support-tests/src/main/java/platform/tooling/support/process/WatchedProcess.java rename to platform-tests/src/processStarter/java/org/junit/platform/tests/process/WatchedProcess.java index 4b41d100e404..4bf675244197 100644 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/WatchedProcess.java +++ b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/WatchedProcess.java @@ -8,7 +8,7 @@ * https://www.eclipse.org/legal/epl-v20.html */ -package platform.tooling.support.process; +package org.junit.platform.tests.process; public class WatchedProcess { diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/package-info.java b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/package-info.java similarity index 61% rename from platform-tooling-support-tests/src/main/java/platform/tooling/support/process/package-info.java rename to platform-tests/src/processStarter/java/org/junit/platform/tests/process/package-info.java index 27abc7fb7956..35d962f9c545 100644 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/package-info.java +++ b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/package-info.java @@ -4,4 +4,4 @@ * @since 1.12 */ -package platform.tooling.support.process; +package org.junit.platform.tests.process; diff --git a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts index 552dd30f0912..88f991589508 100644 --- a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts +++ b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts @@ -47,11 +47,13 @@ dependencies { implementation(libs.commons.io) { because("moving/deleting directory trees") } - implementation(libs.groovy4) { - because("it provides convenience methods to handle process output") + implementation(projects.platformTests) { + capabilities { + requireFeature("process-starter") + } } implementation(projects.junitJupiterApi) { - because("it throws TestAbortedException to abort tests and uses the OS enum") + because("it uses the OS enum to support Windows") } testImplementation(libs.archunit) { diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessStarters.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/ProcessStarters.java similarity index 96% rename from platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessStarters.java rename to platform-tooling-support-tests/src/main/java/platform/tooling/support/ProcessStarters.java index 27c78accc9ce..52a73ea8e6dc 100644 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/process/ProcessStarters.java +++ b/platform-tooling-support-tests/src/main/java/platform/tooling/support/ProcessStarters.java @@ -8,16 +8,15 @@ * https://www.eclipse.org/legal/epl-v20.html */ -package platform.tooling.support.process; +package platform.tooling.support; import java.nio.file.Path; import java.util.Optional; import org.junit.jupiter.api.condition.OS; +import org.junit.platform.tests.process.ProcessStarter; import org.opentest4j.TestAbortedException; -import platform.tooling.support.Helper; - public class ProcessStarters { public static ProcessStarter java() { diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java index 331a423210a3..b57d24f4f272 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java @@ -23,7 +23,7 @@ import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.io.TempDir; -import platform.tooling.support.process.ProcessStarters; +import platform.tooling.support.ProcessStarters; /** * @since 1.3 diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java index 0a32046ba9ab..b9f76e059010 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java @@ -25,7 +25,7 @@ import org.junit.jupiter.api.io.TempDir; import platform.tooling.support.MavenRepo; -import platform.tooling.support.process.ProcessStarters; +import platform.tooling.support.ProcessStarters; /** * @since 1.9.1 diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java index f3f05d27a7e3..042a06b066cc 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java @@ -22,7 +22,7 @@ import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; -import platform.tooling.support.process.ProcessStarters; +import platform.tooling.support.ProcessStarters; /** * @since 1.3 diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java index 4c685ba56553..6c51f84c5f71 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java @@ -23,7 +23,7 @@ import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; -import platform.tooling.support.process.ProcessStarters; +import platform.tooling.support.ProcessStarters; /** * @since 1.3 diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java index 8ca672d197bb..e2d9297dbd2a 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java @@ -24,7 +24,7 @@ import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; -import platform.tooling.support.process.ProcessStarters; +import platform.tooling.support.ProcessStarters; /** * @since 1.3 diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java index 1f4df71f454b..3bb8ca941ade 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java @@ -24,7 +24,7 @@ import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; -import platform.tooling.support.process.ProcessStarters; +import platform.tooling.support.ProcessStarters; /** * @since 1.3 diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java index 487580ba1f02..bd487d2289aa 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java @@ -13,7 +13,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assumptions.assumeTrue; -import static platform.tooling.support.process.ProcessStarters.currentJdkHome; +import static platform.tooling.support.ProcessStarters.currentJdkHome; import static platform.tooling.support.tests.Projects.copyToWorkspace; import java.nio.file.Path; @@ -25,7 +25,7 @@ import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; -import platform.tooling.support.process.ProcessStarters; +import platform.tooling.support.ProcessStarters; /** * @since 1.4 diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java index 6d1d30f7c8ad..88022bd095fd 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java @@ -24,7 +24,7 @@ import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; -import platform.tooling.support.process.ProcessStarters; +import platform.tooling.support.ProcessStarters; /** * @since 1.3 diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java index 56258a919186..59baf7e3d9e8 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java @@ -25,7 +25,7 @@ import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; -import platform.tooling.support.process.ProcessStarters; +import platform.tooling.support.ProcessStarters; /** * @since 1.9.2 diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java index 228d287c2c62..7aa591963757 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java @@ -33,8 +33,8 @@ import org.junit.platform.launcher.LauncherConstants; import platform.tooling.support.MavenRepo; +import platform.tooling.support.ProcessStarters; import platform.tooling.support.ThirdPartyJars; -import platform.tooling.support.process.ProcessStarters; /** * @since 1.5 diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java index 4647adc2bc2f..6f6ea1112d8c 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java @@ -24,7 +24,7 @@ import org.junit.jupiter.api.io.TempDir; import platform.tooling.support.MavenRepo; -import platform.tooling.support.process.ProcessStarters; +import platform.tooling.support.ProcessStarters; /** * @since 1.4 diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java index 89bed056c907..993e8e6012eb 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java @@ -23,7 +23,7 @@ import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; -import platform.tooling.support.process.ProcessStarters; +import platform.tooling.support.ProcessStarters; /** * @since 1.11 diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java index fa99a9d53e6f..20596d164e35 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java @@ -37,13 +37,13 @@ import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.api.parallel.Execution; +import org.junit.platform.tests.process.ProcessResult; import org.opentest4j.TestAbortedException; import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; +import platform.tooling.support.ProcessStarters; import platform.tooling.support.ThirdPartyJars; -import platform.tooling.support.process.ProcessResult; -import platform.tooling.support.process.ProcessStarters; /** * @since 1.4 diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java index 89ccd6e220d0..e6088c074900 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java @@ -19,12 +19,12 @@ import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import org.junit.platform.tests.process.ProcessResult; import org.opentest4j.TestAbortedException; import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; -import platform.tooling.support.process.ProcessResult; -import platform.tooling.support.process.ProcessStarters; +import platform.tooling.support.ProcessStarters; class VintageGradleIntegrationTests { diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java index e7d5788fc4be..79a7968131aa 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java @@ -19,12 +19,12 @@ import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import org.junit.platform.tests.process.ProcessResult; import org.opentest4j.TestAbortedException; import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; -import platform.tooling.support.process.ProcessResult; -import platform.tooling.support.process.ProcessStarters; +import platform.tooling.support.ProcessStarters; class VintageMavenIntegrationTests { From 3b846048f1034b2ef2f837df7420ce86eb6ab652 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 28 Nov 2024 11:20:22 +0100 Subject: [PATCH 360/611] Add tests for Git info in Open Test Reporting XML output --- .../tests/process/ProcessStarter.java | 2 +- ...OpenTestReportGeneratingListenerTests.java | 95 ++++++++++++++++--- .../tooling/support/ProcessStarters.java | 4 +- 3 files changed, 85 insertions(+), 16 deletions(-) diff --git a/platform-tests/src/processStarter/java/org/junit/platform/tests/process/ProcessStarter.java b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/ProcessStarter.java index a7ad54a3fd7d..329f1fab138f 100644 --- a/platform-tests/src/processStarter/java/org/junit/platform/tests/process/ProcessStarter.java +++ b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/ProcessStarter.java @@ -67,7 +67,7 @@ public ProcessResult startAndWait() throws InterruptedException { } public WatchedProcess start() { - var command = Stream.concat(Stream.of(executable.toAbsolutePath().toString()), arguments.stream()).toList(); + var command = Stream.concat(Stream.of(executable.toString()), arguments.stream()).toList(); try { var builder = new ProcessBuilder().command(command); if (workingDir != null) { diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java index dc6c84291505..4d1f9ebda5c5 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java @@ -12,8 +12,9 @@ import static java.util.Objects.requireNonNull; import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.fail; -import static org.junit.jupiter.api.io.CleanupMode.ON_SUCCESS; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId; import static org.junit.platform.launcher.LauncherConstants.OUTPUT_DIR_PROPERTY_NAME; import static org.junit.platform.launcher.LauncherConstants.OUTPUT_DIR_UNIQUE_NUMBER_PLACEHOLDER; @@ -23,15 +24,21 @@ import static org.junit.platform.reporting.testutil.FileUtils.findPath; import java.net.URISyntaxException; +import java.nio.file.Files; import java.nio.file.Path; -import java.util.regex.Pattern; +import java.util.Map; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; import org.junit.platform.engine.TestEngine; import org.junit.platform.engine.UniqueId; import org.junit.platform.engine.reporting.ReportEntry; import org.junit.platform.engine.support.hierarchical.DemoHierarchicalTestEngine; +import org.junit.platform.tests.process.ProcessResult; +import org.junit.platform.tests.process.ProcessStarter; +import org.opentest4j.reporting.schema.Namespace; import org.opentest4j.reporting.tooling.core.validator.DefaultValidator; import org.opentest4j.reporting.tooling.core.validator.ValidationResult; import org.xmlunit.assertj3.XmlAssert; @@ -44,11 +51,8 @@ */ public class OpenTestReportGeneratingListenerTests { - @TempDir(cleanup = ON_SUCCESS) - Path tempDirectory; - @Test - void writesValidXmlReport() throws Exception { + void writesValidXmlReport(@TempDir Path tempDirectory) throws Exception { var engine = new DemoHierarchicalTestEngine("dummy"); engine.addTest("failingTest", "display<-->Name 😎", (context, descriptor) -> { var listener = context.request.getEngineExecutionListener(); @@ -56,7 +60,7 @@ void writesValidXmlReport() throws Exception { fail("failure message"); }); - executeTests(engine); + executeTests(tempDirectory, engine, tempDirectory.resolve("junit-" + OUTPUT_DIR_UNIQUE_NUMBER_PLACEHOLDER)); var xmlFile = findPath(tempDirectory, "glob:**/open-test-report.xml"); assertThat(tempDirectory.relativize(xmlFile).toString()) // @@ -104,7 +108,7 @@ void writesValidXmlReport() throws Exception { - ${xmlunit.matchesRegex#org\\.opentest4j\\.AssertionFailedError: failure message#} + ${xmlunit.matchesRegex(org\\.opentest4j\\.AssertionFailedError: failure message)} @@ -115,23 +119,88 @@ void writesValidXmlReport() throws Exception { """; XmlAssert.assertThat(xmlFile).and(expected) // - .withDifferenceEvaluator(new PlaceholderDifferenceEvaluator(Pattern.quote("${"), Pattern.quote("}"), - Pattern.quote("#"), Pattern.quote("#"), ",")) // + .withDifferenceEvaluator(new PlaceholderDifferenceEvaluator()) // .ignoreWhitespace() // .areIdentical(); } + @ParameterizedTest + @ValueSource(strings = { "https://github.com/junit-team/junit5.git", "git@github.com:junit-team/junit5.git" }) + void includesGitInfo(String originUrl, @TempDir Path tempDirectory) throws Exception { + + assumeTrue(tryExecGit(tempDirectory, "--version").exitCode() == 0, "git not installed"); + execGit(tempDirectory, "init", "--initial-branch=my_branch"); + execGit(tempDirectory, "remote", "add", "origin", originUrl); + + Files.writeString(tempDirectory.resolve("README.md"), "Hello, world!"); + execGit(tempDirectory, "add", "."); + + execGit(tempDirectory, "config", "user.name", "Alice"); + execGit(tempDirectory, "config", "user.email", "alice@example.org"); + execGit(tempDirectory, "commit", "-m", "Initial commit"); + + var engine = new DemoHierarchicalTestEngine("dummy"); + + executeTests(tempDirectory, engine, tempDirectory.resolve("junit-reports")); + + var xmlFile = findPath(tempDirectory, "glob:**/open-test-report.xml"); + assertThat(validate(xmlFile)).isEmpty(); + + var namespaceContext = Map.of("core", Namespace.REPORTING_CORE.getUri(), "e", + Namespace.REPORTING_EVENTS.getUri(), "git", Namespace.REPORTING_GIT.getUri()); + + XmlAssert.assertThat(xmlFile) // + .withNamespaceContext(namespaceContext) // + .valueByXPath("/e:events/core:infrastructure/git:repository/@originUrl") // + .isEqualTo(originUrl); + + XmlAssert.assertThat(xmlFile) // + .withNamespaceContext(namespaceContext) // + .valueByXPath("/e:events/core:infrastructure/git:branch") // + .isEqualTo("my_branch"); + + var commitHash = execGit(tempDirectory, "rev-parse", "--verify", "HEAD").stdOut().trim(); + XmlAssert.assertThat(xmlFile) // + .withNamespaceContext(namespaceContext) // + .valueByXPath("/e:events/core:infrastructure/git:commit") // + .isEqualTo(commitHash); + + XmlAssert.assertThat(xmlFile) // + .withNamespaceContext(namespaceContext) // + .valueByXPath("/e:events/core:infrastructure/git:status/@clean") // + .isEqualTo(false); + + XmlAssert.assertThat(xmlFile) // + .withNamespaceContext(namespaceContext) // + .valueByXPath("/e:events/core:infrastructure/git:status") // + .startsWith("?? junit-reports"); + } + + private static ProcessResult execGit(Path workingDir, String... arguments) throws InterruptedException { + var result = tryExecGit(workingDir, arguments); + assertEquals(0, result.exitCode(), "git " + String.join(" ", arguments) + " failed"); + return result; + } + + private static ProcessResult tryExecGit(Path workingDir, String... arguments) throws InterruptedException { + System.out.println("$ git " + String.join(" ", arguments)); + return new ProcessStarter() // + .executable(Path.of("git")) // + .workingDir(workingDir) // + .addArguments(arguments) // + .startAndWait(); + } + private ValidationResult validate(Path xmlFile) throws URISyntaxException { var catalogUri = requireNonNull(getClass().getResource("catalog.xml")).toURI(); return new DefaultValidator(catalogUri).validate(xmlFile); } - private void executeTests(TestEngine engine) { + private void executeTests(Path tempDirectory, TestEngine engine, Path outputDir) { var build = request() // .selectors(selectUniqueId(UniqueId.forEngine(engine.getId()))) // .configurationParameter(ENABLED_PROPERTY_NAME, String.valueOf(true)) // - .configurationParameter(OUTPUT_DIR_PROPERTY_NAME, - tempDirectory.resolve("junit-" + OUTPUT_DIR_UNIQUE_NUMBER_PLACEHOLDER).toString()) // + .configurationParameter(OUTPUT_DIR_PROPERTY_NAME, outputDir.toString()) // .build(); createLauncher(engine).execute(build, new OpenTestReportGeneratingListener(tempDirectory)); } diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/ProcessStarters.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/ProcessStarters.java index 52a73ea8e6dc..2fa7e4c94e70 100644 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/ProcessStarters.java +++ b/platform-tooling-support-tests/src/main/java/platform/tooling/support/ProcessStarters.java @@ -45,7 +45,7 @@ public static ProcessStarter javaCommand(Path javaHome, String commandName) { public static ProcessStarter gradlew() { return new ProcessStarter() // - .executable(Path.of("..").resolve(windowsOrOtherExecutable("gradlew.bat", "gradlew"))) // + .executable(Path.of("..").resolve(windowsOrOtherExecutable("gradlew.bat", "gradlew")).toAbsolutePath()) // .putEnvironment("JAVA_HOME", getGradleJavaHome().orElseThrow(TestAbortedException::new)) // .addArguments("-PjupiterVersion=" + Helper.version("junit-jupiter")) // .addArguments("-PvintageVersion=" + Helper.version("junit-vintage")) // @@ -55,7 +55,7 @@ public static ProcessStarter gradlew() { public static ProcessStarter maven() { return new ProcessStarter() // .executable(Path.of(System.getProperty("mavenDistribution")).resolve("bin").resolve( - windowsOrOtherExecutable("mvn.cmd", "mvn"))) // + windowsOrOtherExecutable("mvn.cmd", "mvn")).toAbsolutePath()) // .addArguments("-Djunit.jupiter.version=" + Helper.version("junit-jupiter")) // .addArguments("-Djunit.bom.version=" + Helper.version("junit-jupiter")) // .addArguments("-Djunit.vintage.version=" + Helper.version("junit-vintage")) // From ec0b681f22b035d566ed01dd347be4aa72a22a20 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 28 Nov 2024 12:36:21 +0100 Subject: [PATCH 361/611] Avoid hard-coding Java version for processStarter source set --- platform-tests/platform-tests.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform-tests/platform-tests.gradle.kts b/platform-tests/platform-tests.gradle.kts index cd4c8711fb40..c5b9fc768fa9 100644 --- a/platform-tests/platform-tests.gradle.kts +++ b/platform-tests/platform-tests.gradle.kts @@ -111,7 +111,7 @@ tasks { } } named(processStarter.compileJavaTaskName).configure { - options.release = 21 + options.release = javaLibrary.testJavaVersion.majorVersion.toInt() } named("checkstyle${processStarter.name.capitalized()}").configure { config = resources.text.fromFile(checkstyle.configDirectory.file("checkstyleMain.xml")) From 5f1159d4d00b527026e20cdf9008650339a217e6 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 28 Nov 2024 12:46:26 +0100 Subject: [PATCH 362/611] Refactor UniqueIdTrackingListenerIntegrationTests to use a temp dir This way, the build script doesn't have to be tracked as an input which avoids running the test task if it is changed. --- .../launcher/listeners/OutputDir.java | 8 +- .../listeners/UniqueIdTrackingListener.java | 8 +- platform-tests/platform-tests.gradle.kts | 2 - ...queIdTrackingListenerIntegrationTests.java | 111 +++++++----------- 4 files changed, 56 insertions(+), 73 deletions(-) diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/OutputDir.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/OutputDir.java index 27856d5154b8..389a83083a7c 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/OutputDir.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/OutputDir.java @@ -36,8 +36,12 @@ public class OutputDir { Pattern.quote(OUTPUT_DIR_UNIQUE_NUMBER_PLACEHOLDER)); public static OutputDir create(Optional customDir) { + return create(customDir, () -> Paths.get(".")); + } + + static OutputDir create(Optional customDir, Supplier currentWorkingDir) { try { - return createSafely(customDir, () -> Paths.get(".").toAbsolutePath()); + return createSafely(customDir, currentWorkingDir); } catch (IOException e) { throw new UncheckedIOException("Failed to create output dir", e); @@ -53,7 +57,7 @@ static OutputDir createSafely(Optional customDir, Supplier current private static OutputDir createSafely(Optional customDir, Supplier currentWorkingDir, SecureRandom random) throws IOException { - Path cwd = currentWorkingDir.get(); + Path cwd = currentWorkingDir.get().toAbsolutePath(); Path outputDir; if (customDir.isPresent() && StringUtils.isNotBlank(customDir.get())) { diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListener.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListener.java index a7a02b662731..79e49e28c5ee 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListener.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListener.java @@ -17,8 +17,10 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; +import java.util.function.Supplier; import org.apiguardian.api.API; import org.junit.platform.commons.logging.Logger; @@ -125,6 +127,8 @@ public class UniqueIdTrackingListener implements TestExecutionListener { */ public static final String DEFAULT_OUTPUT_FILE_PREFIX = "junit-platform-unique-ids"; + static final String WORKING_DIR_PROPERTY_NAME = "junit.platform.listeners.uid.tracking.working.dir"; + private final Logger logger = LoggerFactory.getLogger(UniqueIdTrackingListener.class); private final List uniqueIds = new ArrayList<>(); @@ -201,7 +205,9 @@ public void testPlanExecutionFinished(TestPlan testPlan) { private Path createOutputFile(ConfigurationParameters configurationParameters) { String prefix = configurationParameters.get(OUTPUT_FILE_PREFIX_PROPERTY_NAME) // .orElse(DEFAULT_OUTPUT_FILE_PREFIX); - return OutputDir.create(configurationParameters.get(OUTPUT_DIR_PROPERTY_NAME)) // + Supplier workingDirSupplier = () -> configurationParameters.get(WORKING_DIR_PROPERTY_NAME).map( + Paths::get).orElseGet(() -> Paths.get(".")); + return OutputDir.create(configurationParameters.get(OUTPUT_DIR_PROPERTY_NAME), workingDirSupplier) // .createFile(prefix, "txt"); } diff --git a/platform-tests/platform-tests.gradle.kts b/platform-tests/platform-tests.gradle.kts index c5b9fc768fa9..4c1c6960898f 100644 --- a/platform-tests/platform-tests.gradle.kts +++ b/platform-tests/platform-tests.gradle.kts @@ -1,6 +1,5 @@ import junitbuild.extensions.capitalized -import org.gradle.api.tasks.PathSensitivity.NONE import org.gradle.api.tasks.PathSensitivity.RELATIVE import org.gradle.internal.os.OperatingSystem @@ -103,7 +102,6 @@ tasks { test { // Additional inputs for remote execution with Test Distribution inputs.dir("src/test/resources").withPathSensitivity(RELATIVE) - inputs.file(buildFile).withPathSensitivity(NONE) // for UniqueIdTrackingListenerIntegrationTests } test_4_12 { useJUnitPlatform { diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListenerIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListenerIntegrationTests.java index ada4c823a6ad..feb645cefaa8 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListenerIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListenerIntegrationTests.java @@ -23,6 +23,7 @@ import static org.junit.platform.launcher.listeners.UniqueIdTrackingListener.LISTENER_ENABLED_PROPERTY_NAME; import static org.junit.platform.launcher.listeners.UniqueIdTrackingListener.OUTPUT_DIR_PROPERTY_NAME; import static org.junit.platform.launcher.listeners.UniqueIdTrackingListener.OUTPUT_FILE_PREFIX_PROPERTY_NAME; +import static org.junit.platform.launcher.listeners.UniqueIdTrackingListener.WORKING_DIR_PROPERTY_NAME; import static org.junit.platform.testkit.engine.Event.byTestDescriptor; import static org.junit.platform.testkit.engine.EventConditions.abortedWithReason; import static org.junit.platform.testkit.engine.EventConditions.event; @@ -35,7 +36,6 @@ import java.io.UncheckedIOException; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -44,15 +44,16 @@ import java.util.stream.Stream; import org.assertj.core.api.Condition; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.DynamicTest; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestFactory; +import org.junit.jupiter.api.io.TempDir; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.TestExecutionResult; import org.junit.platform.engine.discovery.ClassSelector; -import org.junit.platform.launcher.LauncherDiscoveryRequest; import org.junit.platform.launcher.TestExecutionListener; import org.junit.platform.launcher.TestIdentifier; import org.junit.platform.launcher.TestPlan; @@ -88,6 +89,15 @@ class UniqueIdTrackingListenerIntegrationTests { private static final String[] expectedConcurrentUniqueIds = { testA, testB, testC, testD, testE, testF }; + @TempDir + Path workingDir; + + @BeforeEach + void createFakeGradleFiles() throws Exception { + Files.createFile(workingDir.resolve("build.gradle")); + Files.createDirectory(workingDir.resolve("build")); + } + @Test void confirmExpectedUniqueIdsViaEngineTestKit() { // @formatter:off @@ -116,28 +126,18 @@ private Condition uniqueId(String uniqueId) { @Test void listenerIsRegisteredButDisabledByDefault() throws Exception { - long numListenersRegistered = ServiceLoader.load(TestExecutionListener.class).stream()// + var numListenersRegistered = ServiceLoader.load(TestExecutionListener.class).stream()// .filter(provider -> UniqueIdTrackingListener.class.equals(provider.type()))// .count(); assertThat(numListenersRegistered).isEqualTo(1); - String outputDir = "build"; - String prefix = DEFAULT_OUTPUT_FILE_PREFIX; + var actualUniqueIds = executeTests(Map.of()); - deleteFiles(outputDir, prefix); + // Sanity check using the results of our local TestExecutionListener + assertThat(actualUniqueIds).containsExactlyInAnyOrder(expectedUniqueIds); - try { - List actualUniqueIds = executeTests(Map.of()); - - // Sanity check using the results of our local TestExecutionListener - assertThat(actualUniqueIds).containsExactlyInAnyOrder(expectedUniqueIds); - - // Check that files were not generated by the UniqueIdTrackingListener - assertThat(findFiles(outputDir, prefix)).isEmpty(); - } - finally { - deleteFiles(outputDir, prefix); - } + // Check that files were not generated by the UniqueIdTrackingListener + assertThat(findFiles(workingDir, DEFAULT_OUTPUT_FILE_PREFIX)).isEmpty(); } @Test @@ -147,20 +147,20 @@ void verifyUniqueIdsAreTrackedWithDefaults() throws Exception { @Test void verifyUniqueIdsAreTrackedWithCustomOutputFile() throws Exception { - String customPrefix = "test_ids"; + var customPrefix = "test_ids"; verifyUniqueIdsAreTracked("build", customPrefix, Map.of(OUTPUT_FILE_PREFIX_PROPERTY_NAME, customPrefix)); } @Test void verifyUniqueIdsAreTrackedWithCustomOutputDir() throws Exception { - String customDir = "build/UniqueIdTrackingListenerIntegrationTests"; + var customDir = "build/UniqueIdTrackingListenerIntegrationTests"; verifyUniqueIdsAreTracked(customDir, DEFAULT_OUTPUT_FILE_PREFIX, Map.of(OUTPUT_DIR_PROPERTY_NAME, customDir)); } @Test void verifyUniqueIdsAreTrackedWithCustomOutputFileAndCustomOutputDir() throws Exception { - String customPrefix = "test_ids"; - String customDir = "build/UniqueIdTrackingListenerIntegrationTests"; + var customPrefix = "test_ids"; + var customDir = "build/UniqueIdTrackingListenerIntegrationTests"; verifyUniqueIdsAreTracked(customDir, customPrefix, Map.of(OUTPUT_DIR_PROPERTY_NAME, customDir, OUTPUT_FILE_PREFIX_PROPERTY_NAME, customPrefix)); @@ -172,59 +172,45 @@ private void verifyUniqueIdsAreTracked(String outputDir, String prefix, Map(configurationParameters); configurationParameters.put(LISTENER_ENABLED_PROPERTY_NAME, "true"); - deleteFiles(outputDir, prefix); - - try { - List actualUniqueIds = executeTests(configurationParameters); + var actualUniqueIds = executeTests(configurationParameters); - // Sanity check using the results of our local TestExecutionListener - assertThat(actualUniqueIds).containsExactlyInAnyOrder(expectedUniqueIds); + // Sanity check using the results of our local TestExecutionListener + assertThat(actualUniqueIds).containsExactlyInAnyOrder(expectedUniqueIds); - // Check contents of the file (or files) generated by the UniqueIdTrackingListener - assertThat(readAllFiles(outputDir, prefix)).containsExactlyInAnyOrder(expectedUniqueIds); - } - finally { - deleteFiles(outputDir, prefix); - } + // Check contents of the file (or files) generated by the UniqueIdTrackingListener + assertThat(readAllFiles(workingDir.resolve(outputDir), prefix)).containsExactlyInAnyOrder(expectedUniqueIds); } @Test void verifyUniqueIdsAreTrackedWithConcurrentlyExecutingTestPlans() throws Exception { - String customDir = "build/UniqueIdTrackingListenerIntegrationTests"; - String prefix = DEFAULT_OUTPUT_FILE_PREFIX; + var customDir = workingDir.resolve("build/UniqueIdTrackingListenerIntegrationTests"); + var prefix = DEFAULT_OUTPUT_FILE_PREFIX; Map configurationParameters = new HashMap<>(); configurationParameters.put(LISTENER_ENABLED_PROPERTY_NAME, "true"); - configurationParameters.put(OUTPUT_DIR_PROPERTY_NAME, customDir); - - deleteFiles(customDir, prefix); + configurationParameters.put(OUTPUT_DIR_PROPERTY_NAME, customDir.toAbsolutePath().toString()); - try { - Stream.of(TestCase2.class, TestCase3.class, TestCase4.class).parallel()// - .forEach(clazz -> executeTests(configurationParameters, selectClass(clazz))); + Stream.of(TestCase2.class, TestCase3.class, TestCase4.class).parallel()// + .forEach(clazz -> executeTests(configurationParameters, selectClass(clazz))); - // 3 output files should have been generated. - assertThat(findFiles(customDir, prefix)).hasSize(3); + // 3 output files should have been generated. + assertThat(findFiles(customDir, prefix)).hasSize(3); - // Check contents of the file (or files) generated by the UniqueIdTrackingListener - assertThat(readAllFiles(customDir, prefix)).containsExactlyInAnyOrder(expectedConcurrentUniqueIds); - } - finally { - deleteFiles(customDir, prefix); - } + // Check contents of the file (or files) generated by the UniqueIdTrackingListener + assertThat(readAllFiles(customDir, prefix)).containsExactlyInAnyOrder(expectedConcurrentUniqueIds); } - private static List executeTests(Map configurationParameters) { + private List executeTests(Map configurationParameters) { return executeTests(configurationParameters, selectClasses()); } - private static List executeTests(Map configurationParameters, - ClassSelector... classSelectors) { + private List executeTests(Map configurationParameters, ClassSelector... classSelectors) { List uniqueIds = new ArrayList<>(); - LauncherDiscoveryRequest request = request()// + var request = request()// .selectors(classSelectors)// .filters(includeEngines("junit-jupiter"))// .configurationParameters(configurationParameters)// + .configurationParameter(WORKING_DIR_PROPERTY_NAME, workingDir.toAbsolutePath().toString())// .build(); LauncherFactory.create().execute(request, new TestExecutionListener() { @@ -260,8 +246,7 @@ private static ClassSelector[] selectClasses() { selectClass(DisabledTestCase.class) }; } - private static Stream findFiles(String dir, String prefix) throws IOException { - Path outputDir = Paths.get(dir); + private static Stream findFiles(Path outputDir, String prefix) throws IOException { if (!Files.exists(outputDir)) { return Stream.empty(); } @@ -270,18 +255,7 @@ private static Stream findFiles(String dir, String prefix) throws IOExcept && path.getFileName().toString().startsWith(prefix))); } - private void deleteFiles(String outputDir, String prefix) throws IOException { - findFiles(outputDir, prefix).forEach(file -> { - try { - Files.deleteIfExists(file); - } - catch (IOException ex) { - throw new UncheckedIOException(ex); - } - }); - } - - private Stream readAllFiles(String outputDir, String prefix) throws IOException { + private Stream readAllFiles(Path outputDir, String prefix) throws IOException { return findFiles(outputDir, prefix).map(outputFile -> { try { return Files.readAllLines(outputFile); @@ -306,6 +280,7 @@ void passingTest() { void skippedTest() { } + @SuppressWarnings("DataFlowIssue") @Test void abortedTest() { assumeTrue(false); From a8c1d974929f8e8dc60988c213e124dcf9034360 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 29 Nov 2024 16:22:32 +0100 Subject: [PATCH 363/611] Hide HTML report generator output by default --- gradle/plugins/build-parameters/build.gradle.kts | 4 ++++ .../main/kotlin/junitbuild.testing-conventions.gradle.kts | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/gradle/plugins/build-parameters/build.gradle.kts b/gradle/plugins/build-parameters/build.gradle.kts index 65d56b270e10..5d647a81a7de 100644 --- a/gradle/plugins/build-parameters/build.gradle.kts +++ b/gradle/plugins/build-parameters/build.gradle.kts @@ -76,6 +76,10 @@ buildParameters { integer("retries") { description = "Configures the number of times failing test are retried" } + bool("hideOpenTestReportHtmlGeneratorOutput") { + description = "Whether or not to hide the output of the OpenTestReportHtmlGenerator" + defaultValue = true + } } group("publishing") { bool("signArtifacts") { diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts index 169d5756a10c..f4834d0549aa 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts @@ -5,6 +5,7 @@ import org.gradle.api.tasks.PathSensitivity.RELATIVE import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL import org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED import org.gradle.internal.os.OperatingSystem +import java.io.OutputStream plugins { `java-library` @@ -34,6 +35,13 @@ val generateOpenTestHtmlReport by tasks.registering(JavaExec::class) { }) outputLocation = layout.buildDirectory.file("reports/open-test-report.html") } + if (buildParameters.testing.hideOpenTestReportHtmlGeneratorOutput) { + standardOutput = object : OutputStream() { + override fun write(b: Int) { + // discard output + } + } + } outputs.cacheIf { true } } From f2b95b5da9c04e126e1785f315490c7e765ea1cb Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sun, 1 Dec 2024 15:41:02 +0100 Subject: [PATCH 364/611] Avoid warning for duplicate junit-platform.properties file When running tests in documentation from Eclipse, the `junit-platform.properties` file from junit-vintage-engine made it to the test runtime classpath. Setting `containsTestFixtures` to `false` prevents that. It causes `without_test_code` to be set to `true` in generated `.classpath` files. --- junit-vintage-engine/junit-vintage-engine.gradle.kts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/junit-vintage-engine/junit-vintage-engine.gradle.kts b/junit-vintage-engine/junit-vintage-engine.gradle.kts index 6aff8b8ad600..9390bdcd3b4e 100644 --- a/junit-vintage-engine/junit-vintage-engine.gradle.kts +++ b/junit-vintage-engine/junit-vintage-engine.gradle.kts @@ -89,3 +89,10 @@ tasks { dependsOn(testWithoutJUnit4) } } + +eclipse { + classpath { + // Avoid exposing test resources to dependent projects + containsTestFixtures = false + } +} From a24ceb08e7e90437d454fb46619c0b27dfe0df2a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 1 Dec 2024 14:41:41 +0000 Subject: [PATCH 365/611] Update dependency com.puppycrawl.tools:checkstyle to v10.20.2 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 49b3b30278fc..b8201e64c29c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ asciidoctorj-pdf = "2.3.19" asciidoctor-plugins = "4.0.3" # Check if workaround in documentation.gradle.kts can be removed when upgrading assertj = "3.26.3" bnd = "7.1.0" -checkstyle = "10.20.1" +checkstyle = "10.20.2" eclipse = "4.32.0" jackson = "2.18.2" jacoco = "0.8.12" From d7d326e86a2c14db1b480f1d28b82ee30345578d Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 2 Dec 2024 08:47:06 +0100 Subject: [PATCH 366/611] Adapt to API change in open-test-reporting Related PR: ota4j-team/open-test-reporting#207 --- .../junit/platform/reporting/open/xml/JUnitContributor.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/JUnitContributor.java b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/JUnitContributor.java index 252900d5c645..4a18e53ee2f3 100644 --- a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/JUnitContributor.java +++ b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/JUnitContributor.java @@ -24,7 +24,6 @@ import org.opentest4j.reporting.tooling.spi.htmlreport.Contributor; import org.opentest4j.reporting.tooling.spi.htmlreport.KeyValuePairs; import org.opentest4j.reporting.tooling.spi.htmlreport.Section; -import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -42,8 +41,8 @@ public JUnitContributor() { } @Override - public List

    contributeSectionsForTestNode(Element testNodeElement) { - return findChild(testNodeElement, Namespace.REPORTING_CORE, "metadata") // + public List
    contributeSectionsForTestNode(Context context) { + return findChild(context.element(), Namespace.REPORTING_CORE, "metadata") // .map(metadata -> { Map table = new LinkedHashMap<>(); findChild(metadata, JUnitFactory.NAMESPACE, "type") // From 88feb5850644d9807debaac1c26463226827ea8f Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 2 Dec 2024 08:47:27 +0100 Subject: [PATCH 367/611] Force checking for new snapshots on CI --- .github/actions/run-gradle/action.yml | 1 + gradle/scripts/checkBuildReproducibility.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/actions/run-gradle/action.yml b/.github/actions/run-gradle/action.yml index d2c704f5ef4c..e845130f49ec 100644 --- a/.github/actions/run-gradle/action.yml +++ b/.github/actions/run-gradle/action.yml @@ -29,5 +29,6 @@ runs: -Pjunit.develocity.predictiveTestSelection.enabled=true \ -Pjunit.develocity.predictiveTestSelection.selectRemainingTests=${{ github.event_name != 'pull_request' }} \ "-Dscan.value.GitHub job=${{ github.job }}" \ + --refresh-dependencies \ javaToolchains \ ${{ inputs.arguments }} diff --git a/gradle/scripts/checkBuildReproducibility.sh b/gradle/scripts/checkBuildReproducibility.sh index c434fc778a44..b9ede2c77cf4 100755 --- a/gradle/scripts/checkBuildReproducibility.sh +++ b/gradle/scripts/checkBuildReproducibility.sh @@ -12,6 +12,7 @@ function calculate_checksums() { --no-build-cache \ -Porg.gradle.java.installations.auto-download=false \ -Dscan.tag.Reproducibility \ + --refresh-dependencies \ clean \ assemble From 3e6c876a4be3ce9498ad1dea4c89100640f663c9 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 2 Dec 2024 19:42:07 +0100 Subject: [PATCH 368/611] Add TODO --- settings.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/settings.gradle.kts b/settings.gradle.kts index 9f5eba43d998..6af29a55f440 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -15,6 +15,7 @@ plugins { dependencyResolutionManagement { repositories { mavenCentral() + // TODO Remove --refresh-dependencies from CI builds when no longer consuming snapshots maven(url = "https://oss.sonatype.org/content/repositories/snapshots") { mavenContent { snapshotsOnly() From 35a3fd68f4226f6fe7d4ea42255a999402a07484 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 3 Dec 2024 09:45:25 +0100 Subject: [PATCH 369/611] Fix Maven integration tests on JDK 24 --- .../java/platform/tooling/support/tests/MavenEnvVars.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenEnvVars.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenEnvVars.java index bcec609010a0..eebfc4ffd58f 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenEnvVars.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenEnvVars.java @@ -16,9 +16,11 @@ final class MavenEnvVars { - // https://issues.apache.org/jira/browse/MNG-8248 static final Map FOR_JDK24_AND_LATER = JRE.currentVersion().compareTo(JRE.JAVA_24) >= 0 // - ? Map.of("MAVEN_OPTS", "--enable-native-access=ALL-UNNAMED") // + ? Map.of("MAVEN_OPTS", String.join(" ", // + "--enable-native-access=ALL-UNNAMED", // https://issues.apache.org/jira/browse/MNG-8248 + "--sun-misc-unsafe-memory-access=allow" // https://issues.apache.org/jira/browse/MNG-8399 + )) // : Map.of(); private MavenEnvVars() { From b49daea14d31e25ff5e5c0ac4f3d68b4020cdd1e Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 3 Dec 2024 10:06:02 +0100 Subject: [PATCH 370/611] Set JAVA_HOME for all Maven builds triggered from integration tests --- .../main/java/platform/tooling/support/ProcessStarters.java | 5 +++++ .../platform/tooling/support/tests/JavaVersionsTests.java | 3 +-- .../platform/tooling/support/tests/MavenStarterTests.java | 3 +-- .../support/tests/MavenSurefireCompatibilityTests.java | 3 +-- .../tooling/support/tests/VintageMavenIntegrationTests.java | 3 +-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/ProcessStarters.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/ProcessStarters.java index 2fa7e4c94e70..d96f387faf65 100644 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/ProcessStarters.java +++ b/platform-tooling-support-tests/src/main/java/platform/tooling/support/ProcessStarters.java @@ -53,9 +53,14 @@ public static ProcessStarter gradlew() { } public static ProcessStarter maven() { + return maven(currentJdkHome()); + } + + public static ProcessStarter maven(Path javaHome) { return new ProcessStarter() // .executable(Path.of(System.getProperty("mavenDistribution")).resolve("bin").resolve( windowsOrOtherExecutable("mvn.cmd", "mvn")).toAbsolutePath()) // + .putEnvironment("JAVA_HOME", javaHome) // .addArguments("-Djunit.jupiter.version=" + Helper.version("junit-jupiter")) // .addArguments("-Djunit.bom.version=" + Helper.version("junit-jupiter")) // .addArguments("-Djunit.vintage.version=" + Helper.version("junit-vintage")) // diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java index bd487d2289aa..311a4711084a 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java @@ -55,9 +55,8 @@ void java_default() throws Exception { } List execute(Path javaHome, Map environmentVars) throws Exception { - var result = ProcessStarters.maven() // + var result = ProcessStarters.maven(javaHome) // .workingDir(copyToWorkspace(Projects.JAVA_VERSIONS, workspace)) // - .putEnvironment("JAVA_HOME", javaHome) // .putEnvironment(environmentVars) // .addArguments(localMavenRepo.toCliArgument(), "-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("--update-snapshots", "--batch-mode", "verify") // diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java index 88022bd095fd..75e13c36e898 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java @@ -39,12 +39,11 @@ class MavenStarterTests { @Test void verifyMavenStarterProject(@TempDir Path workspace) throws Exception { - var result = ProcessStarters.maven() // + var result = ProcessStarters.maven(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // .workingDir(copyToWorkspace(Projects.MAVEN_STARTER, workspace)) // .addArguments(localMavenRepo.toCliArgument(), "-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("-Dsnapshot.repo.url=" + mavenRepoProxy.getBaseUri()) // .addArguments("--update-snapshots", "--batch-mode", "verify") // - .putEnvironment("JAVA_HOME", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // .startAndWait(); assertEquals(0, result.exitCode()); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java index 59baf7e3d9e8..d5a379c6c7b4 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java @@ -43,13 +43,12 @@ class MavenSurefireCompatibilityTests { void testMavenSurefireCompatibilityProject(String surefireVersion, String extraArg, @TempDir Path workspace) throws Exception { var extraArgs = extraArg == null ? new String[0] : new String[] { extraArg }; - var result = ProcessStarters.maven() // + var result = ProcessStarters.maven(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // .workingDir(copyToWorkspace(Projects.MAVEN_SUREFIRE_COMPATIBILITY, workspace)) // .addArguments(localMavenRepo.toCliArgument(), "-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("-Dsurefire.version=" + surefireVersion) // .addArguments("--update-snapshots", "--batch-mode", "test") // .addArguments(extraArgs) // - .putEnvironment("JAVA_HOME", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // .startAndWait(); assertEquals(0, result.exitCode()); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java index 79a7968131aa..09e16b826cdb 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java @@ -61,9 +61,8 @@ void supportedVersions(String version) throws Exception { } private ProcessResult run(String version) throws Exception { - return ProcessStarters.maven() // + return ProcessStarters.maven(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // .workingDir(copyToWorkspace(Projects.VINTAGE, workspace)) // - .putEnvironment("JAVA_HOME", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // .addArguments("clean", "test", "--update-snapshots", "--batch-mode") // .addArguments(localMavenRepo.toCliArgument(), "-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("-Djunit4Version=" + version) // From 0ecfc2fabc7187c0f720dc08ff582778ac32f544 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2024 14:36:15 +0000 Subject: [PATCH 371/611] Update plugin foojayResolver to v0.9.0 (#4166) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b8201e64c29c..fc71c0f718b3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -89,7 +89,7 @@ bnd = { id = "biz.aQute.bnd", version.ref = "bnd" } buildParameters = { id = "org.gradlex.build-parameters", version = "1.4.4" } commonCustomUserData = { id = "com.gradle.common-custom-user-data-gradle-plugin", version = "2.0.2" } develocity = { id = "com.gradle.develocity", version = "3.18.2" } -foojayResolver = { id = "org.gradle.toolchains.foojay-resolver", version = "0.8.0" } +foojayResolver = { id = "org.gradle.toolchains.foojay-resolver", version = "0.9.0" } gitPublish = { id = "org.ajoberstar.git-publish", version = "4.2.2" } jmh = { id = "me.champeau.jmh", version = "0.7.2" } nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" } From 7e96c90728ba6a63052f91c163cbf12681952de0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2024 14:36:59 +0000 Subject: [PATCH 372/611] Update github/codeql-action digest to aa57810 --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/ossf-scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e943e26bc2f6..e6ce3de32652 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -34,7 +34,7 @@ jobs: - name: Check out repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Initialize CodeQL - uses: github/codeql-action/init@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3 + uses: github/codeql-action/init@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3 with: languages: ${{ matrix.language }} tools: linked @@ -47,4 +47,4 @@ jobs: -Dscan.tag.CodeQL \ allMainClasses - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3 + uses: github/codeql-action/analyze@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3 diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index ae94503b3b68..1662ea9aee3f 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard (optional). # Commenting out will disable upload of results to your repo's Code Scanning dashboard - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3 + uses: github/codeql-action/upload-sarif@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3 with: sarif_file: results.sarif From d6eda8b5435d20120627306448f033423bfab0f5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2024 17:45:41 +0000 Subject: [PATCH 373/611] Update plugin org.gradle.toolchains.foojay-resolver-convention to v0.9.0 (#4167) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .../projects/graalvm-starter/settings.gradle.kts | 2 +- .../projects/gradle-kotlin-extensions/settings.gradle.kts | 2 +- .../projects/gradle-missing-engine/settings.gradle.kts | 2 +- .../projects/gradle-starter/settings.gradle.kts | 2 +- .../projects/reflection-tests/settings.gradle.kts | 2 +- .../projects/vintage/settings.gradle.kts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts b/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts index 6b9636ea6529..37cb974b7926 100644 --- a/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts +++ b/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts @@ -9,7 +9,7 @@ pluginManagement { } plugins { - id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" + id("org.gradle.toolchains.foojay-resolver-convention") version "0.9.0" } rootProject.name = "graalvm-starter" diff --git a/platform-tooling-support-tests/projects/gradle-kotlin-extensions/settings.gradle.kts b/platform-tooling-support-tests/projects/gradle-kotlin-extensions/settings.gradle.kts index 7836e6f5ba89..d7d6bc0549a6 100644 --- a/platform-tooling-support-tests/projects/gradle-kotlin-extensions/settings.gradle.kts +++ b/platform-tooling-support-tests/projects/gradle-kotlin-extensions/settings.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" + id("org.gradle.toolchains.foojay-resolver-convention") version "0.9.0" } rootProject.name = "gradle-kotlin-extensions" diff --git a/platform-tooling-support-tests/projects/gradle-missing-engine/settings.gradle.kts b/platform-tooling-support-tests/projects/gradle-missing-engine/settings.gradle.kts index 366bca2588d1..9eb91b3f491b 100644 --- a/platform-tooling-support-tests/projects/gradle-missing-engine/settings.gradle.kts +++ b/platform-tooling-support-tests/projects/gradle-missing-engine/settings.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" + id("org.gradle.toolchains.foojay-resolver-convention") version "0.9.0" } rootProject.name = "gradle-missing-engine" diff --git a/platform-tooling-support-tests/projects/gradle-starter/settings.gradle.kts b/platform-tooling-support-tests/projects/gradle-starter/settings.gradle.kts index e818a8e04116..3a1befd4bfac 100644 --- a/platform-tooling-support-tests/projects/gradle-starter/settings.gradle.kts +++ b/platform-tooling-support-tests/projects/gradle-starter/settings.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" + id("org.gradle.toolchains.foojay-resolver-convention") version "0.9.0" } rootProject.name = "gradle-starter" diff --git a/platform-tooling-support-tests/projects/reflection-tests/settings.gradle.kts b/platform-tooling-support-tests/projects/reflection-tests/settings.gradle.kts index 38c95bf52810..7ec746923227 100644 --- a/platform-tooling-support-tests/projects/reflection-tests/settings.gradle.kts +++ b/platform-tooling-support-tests/projects/reflection-tests/settings.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" + id("org.gradle.toolchains.foojay-resolver-convention") version "0.9.0" } rootProject.name = "reflection-tests" diff --git a/platform-tooling-support-tests/projects/vintage/settings.gradle.kts b/platform-tooling-support-tests/projects/vintage/settings.gradle.kts index 3674c8832dca..a890cc361b07 100644 --- a/platform-tooling-support-tests/projects/vintage/settings.gradle.kts +++ b/platform-tooling-support-tests/projects/vintage/settings.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" + id("org.gradle.toolchains.foojay-resolver-convention") version "0.9.0" } rootProject.name = "vintage" From 74800c5f87947882095b9edb1c8c12e769bca97c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 3 Dec 2024 17:46:21 +0000 Subject: [PATCH 374/611] Update plugin org.graalvm.buildtools.native to v0.10.4 --- .../projects/graalvm-starter/settings.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts b/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts index 37cb974b7926..677f37dff1c9 100644 --- a/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts +++ b/platform-tooling-support-tests/projects/graalvm-starter/settings.gradle.kts @@ -1,6 +1,6 @@ pluginManagement { plugins { - id("org.graalvm.buildtools.native") version "0.10.3" + id("org.graalvm.buildtools.native") version "0.10.4" } repositories { mavenCentral() From f6223ec0303eb001e2fc8c7d9097e08ab8c6231f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 21:00:01 +0000 Subject: [PATCH 375/611] Update actions/attest-build-provenance action to v2 (#4172) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0db6c7784251..7e91ea10ee2c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -91,7 +91,7 @@ jobs: publish -x check \ prepareGitHubAttestation - name: Generate build provenance attestations - uses: actions/attest-build-provenance@ef244123eb79f2f7a7e75d99086184180e6d0018 # v1.4.4 + uses: actions/attest-build-provenance@619dbb2e03e0189af0c55118e7d3c5e129e99726 # v2.0.0 with: subject-path: documentation/build/attestation/*.jar From 2f2dc33e79a07d21cada8544efc87fb9ba54dab3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 02:12:31 +0000 Subject: [PATCH 376/611] Update dependency com.pinterest.ktlint:ktlint-cli to v1.5.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fc71c0f718b3..c3bfb3f87128 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -12,7 +12,7 @@ jacoco = "0.8.12" jmh = "1.37" junit4 = "4.13.2" junit4Min = "4.12" -ktlint = "1.4.1" +ktlint = "1.5.0" log4j = "2.24.2" mockito = "5.14.2" opentest4j = "1.3.0" From 3580f0436a20d7a51198706c3db464d578c0ebf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alaksiej=20=C5=A0=C4=8Darbaty?= <65507498+awelless@users.noreply.github.com> Date: Thu, 5 Dec 2024 08:36:10 +0100 Subject: [PATCH 377/611] Add contracts to Kotlin-specific assertions (#3259) * Introduce Kotlin-specific `assertNull` and `assertNotNull` methods * Introduce contracts for `assertNull`, `assertNotNull`, `assertThrows` and `assertDoesNotThrow` methods * Add examples to KotlinAssertionsDemo Resolves #1866. --- .../release-notes-5.12.0-M1.adoc | 1 + .../kotlin/example/KotlinAssertionsDemo.kt | 26 ++ .../org/junit/jupiter/api/Assertions.kt | 267 ++++++++++++++++-- .../api/KotlinAssertTimeoutAssertionsTests.kt | 49 ++++ .../jupiter/api/KotlinAssertionsTests.kt | 83 ++++++ 5 files changed, 410 insertions(+), 16 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 175b2c5c8de2..41eeda5831b1 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -48,6 +48,7 @@ JUnit repository on GitHub. - A section containing JUnit-specific metadata about each test/container to the HTML report is now written by open-test-reporting when added to the classpath/module path - Information about published files is now included as attachments. +* Introduced contracts for Kotlin-specific assertion methods. [[release-notes-5.12.0-M1-junit-jupiter]] diff --git a/documentation/src/test/kotlin/example/KotlinAssertionsDemo.kt b/documentation/src/test/kotlin/example/KotlinAssertionsDemo.kt index efd0566ac0d8..7aa762856e69 100644 --- a/documentation/src/test/kotlin/example/KotlinAssertionsDemo.kt +++ b/documentation/src/test/kotlin/example/KotlinAssertionsDemo.kt @@ -19,6 +19,8 @@ import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertAll import org.junit.jupiter.api.assertDoesNotThrow +import org.junit.jupiter.api.assertInstanceOf +import org.junit.jupiter.api.assertNotNull import org.junit.jupiter.api.assertThrows import org.junit.jupiter.api.assertTimeout import org.junit.jupiter.api.assertTimeoutPreemptively @@ -107,5 +109,29 @@ class KotlinAssertionsDemo { Thread.sleep(100) } } + + @Test + fun `assertNotNull with a smart cast`() { + val nullablePerson: Person? = person + + assertNotNull(nullablePerson) + + // The compiler smart casts nullablePerson to a non-nullable object. + // The safe call operator (?.) isn't required. + assertEquals(person.firstName, nullablePerson.firstName) + assertEquals(person.lastName, nullablePerson.lastName) + } + + @Test + fun `assertInstanceOf with a smart cast`() { + val maybePerson: Any = person + + assertInstanceOf(maybePerson) + + // The compiler smart casts maybePerson to a Person object, + // allowing to access the Person properties. + assertEquals(person.firstName, maybePerson.firstName) + assertEquals(person.lastName, maybePerson.lastName) + } } // end::user_guide[] diff --git a/junit-jupiter-api/src/main/kotlin/org/junit/jupiter/api/Assertions.kt b/junit-jupiter-api/src/main/kotlin/org/junit/jupiter/api/Assertions.kt index 709aaba4fb1d..16ca2490a1c9 100644 --- a/junit-jupiter-api/src/main/kotlin/org/junit/jupiter/api/Assertions.kt +++ b/junit-jupiter-api/src/main/kotlin/org/junit/jupiter/api/Assertions.kt @@ -20,6 +20,8 @@ import java.time.Duration import java.util.function.Supplier import java.util.stream.Stream import kotlin.contracts.ExperimentalContracts +import kotlin.contracts.InvocationKind.AT_MOST_ONCE +import kotlin.contracts.InvocationKind.EXACTLY_ONCE import kotlin.contracts.contract /** @@ -30,6 +32,20 @@ fun fail( throwable: Throwable? = null ): Nothing = Assertions.fail(message, throwable) +/** + * @see Assertions.fail + */ +@OptIn(ExperimentalContracts::class) +@API(since = "5.12", status = EXPERIMENTAL) +@JvmName("fail_nonNullableLambda") +fun fail(message: () -> String): Nothing { + contract { + callsInPlace(message, EXACTLY_ONCE) + } + + return Assertions.fail(message) +} + /** * @see Assertions.fail */ @@ -93,6 +109,154 @@ fun assertAll( vararg executables: () -> Unit ) = assertAll(heading, executables.toList().stream()) +/** + * Example usage: + * ```kotlin + * val nullableString: String? = ... + * + * assertNull(nullableString) + * + * // The compiler won't allow even safe calls, since nullableString is always null. + * // nullableString?.isNotEmpty() + * ``` + * @see Assertions.assertNull + */ +@OptIn(ExperimentalContracts::class) +@API(since = "5.12", status = EXPERIMENTAL) +fun assertNull(actual: Any?) { + contract { + returns() implies (actual == null) + } + + Assertions.assertNull(actual) +} + +/** + * Example usage: + * ```kotlin + * val nullableString: String? = ... + * + * assertNull(nullableString, "Should be nullable") + * + * // The compiler won't allow even safe calls, since nullableString is always null. + * // nullableString?.isNotEmpty() + * ``` + * @see Assertions.assertNull + */ +@OptIn(ExperimentalContracts::class) +@API(since = "5.12", status = EXPERIMENTAL) +fun assertNull( + actual: Any?, + message: String +) { + contract { + returns() implies (actual == null) + } + + Assertions.assertNull(actual, message) +} + +/** + * Example usage: + * ```kotlin + * val nullableString: String? = ... + * + * assertNull(nullableString) { "Should be nullable" } + * + * // The compiler won't allow even safe calls, since nullableString is always null. + * // nullableString?.isNotEmpty() + * ``` + * @see Assertions.assertNull + */ +@OptIn(ExperimentalContracts::class) +@API(since = "5.12", status = EXPERIMENTAL) +fun assertNull( + actual: Any?, + messageSupplier: () -> String +) { + contract { + returns() implies (actual == null) + + callsInPlace(messageSupplier, AT_MOST_ONCE) + } + + Assertions.assertNull(actual, messageSupplier) +} + +/** + * Example usage: + * ```kotlin + * val nullableString: String? = ... + * + * assertNotNull(nullableString) + * + * // The compiler smart casts nullableString to a non-nullable object. + * assertTrue(nullableString.isNotEmpty()) + * ``` + * @see Assertions.assertNotNull + */ +@OptIn(ExperimentalContracts::class) +@API(since = "5.12", status = EXPERIMENTAL) +fun assertNotNull(actual: Any?) { + contract { + returns() implies (actual != null) + } + + Assertions.assertNotNull(actual) +} + +/** + * Example usage: + * ```kotlin + * val nullableString: String? = ... + * + * assertNotNull(nullableString, "Should be non-nullable") + * + * // The compiler smart casts nullableString to a non-nullable object. + * assertTrue(nullableString.isNotEmpty()) + * ``` + * @see Assertions.assertNotNull + */ +@OptIn(ExperimentalContracts::class) +@API(since = "5.12", status = EXPERIMENTAL) +fun assertNotNull( + actual: Any?, + message: String +) { + contract { + returns() implies (actual != null) + } + + Assertions.assertNotNull(actual, message) +} + +/** + * Example usage: + * ```kotlin + * val nullableString: String? = ... + * + * assertNotNull(nullableString) { "Should be non-nullable" } + * + * // The compiler smart casts nullableString to a non-nullable object. + * assertTrue(nullableString.isNotEmpty()) + * ``` + * @see Assertions.assertNotNull + */ +@OptIn(ExperimentalContracts::class) +@API(since = "5.12", status = EXPERIMENTAL) +fun assertNotNull( + actual: Any?, + messageSupplier: () -> String +) { + contract { + returns() implies (actual != null) + + callsInPlace(messageSupplier, AT_MOST_ONCE) + } + + Assertions.assertNotNull(actual, messageSupplier) +} + /** * Example usage: * ```kotlin @@ -143,10 +307,15 @@ inline fun assertThrows( * ``` * @see Assertions.assertThrows */ +@OptIn(ExperimentalContracts::class) inline fun assertThrows( noinline message: () -> String, executable: () -> Unit ): T { + contract { + callsInPlace(message, AT_MOST_ONCE) + } + val throwable: Throwable? = try { executable() @@ -175,8 +344,15 @@ inline fun assertThrows( * @see Assertions.assertDoesNotThrow * @param R the result type of the [executable] */ +@OptIn(ExperimentalContracts::class) @API(status = STABLE, since = "5.11") -inline fun assertDoesNotThrow(executable: () -> R): R = Assertions.assertDoesNotThrow(evaluateAndWrap(executable)) +inline fun assertDoesNotThrow(executable: () -> R): R { + contract { + callsInPlace(executable, EXACTLY_ONCE) + } + + return Assertions.assertDoesNotThrow(evaluateAndWrap(executable)) +} /** * Example usage: @@ -188,11 +364,18 @@ inline fun assertDoesNotThrow(executable: () -> R): R = Assertions.assertDoe * @see Assertions.assertDoesNotThrow * @param R the result type of the [executable] */ +@OptIn(ExperimentalContracts::class) @API(status = STABLE, since = "5.11") inline fun assertDoesNotThrow( message: String, executable: () -> R -): R = assertDoesNotThrow({ message }, executable) +): R { + contract { + callsInPlace(executable, EXACTLY_ONCE) + } + + return assertDoesNotThrow({ message }, executable) +} /** * Example usage: @@ -204,15 +387,22 @@ inline fun assertDoesNotThrow( * @see Assertions.assertDoesNotThrow * @param R the result type of the [executable] */ +@OptIn(ExperimentalContracts::class) @API(status = STABLE, since = "5.11") inline fun assertDoesNotThrow( noinline message: () -> String, executable: () -> R -): R = - Assertions.assertDoesNotThrow( +): R { + contract { + callsInPlace(executable, EXACTLY_ONCE) + callsInPlace(message, AT_MOST_ONCE) + } + + return Assertions.assertDoesNotThrow( evaluateAndWrap(executable), Supplier(message) ) +} @PublishedApi internal inline fun evaluateAndWrap(executable: () -> R): ThrowingSupplier = @@ -231,13 +421,20 @@ internal inline fun evaluateAndWrap(executable: () -> R): ThrowingSupplier assertTimeout( timeout: Duration, executable: () -> R -): R = Assertions.assertTimeout(timeout, executable) +): R { + contract { + callsInPlace(executable, EXACTLY_ONCE) + } + + return Assertions.assertTimeout(timeout, executable) +} /** * Example usage: @@ -247,14 +444,21 @@ fun assertTimeout( * } * ``` * @see Assertions.assertTimeout - * @paramR the result of the [executable]. + * @param R the result of the [executable]. */ +@OptIn(ExperimentalContracts::class) @API(status = STABLE, since = "5.11") fun assertTimeout( timeout: Duration, message: String, executable: () -> R -): R = Assertions.assertTimeout(timeout, executable, message) +): R { + contract { + callsInPlace(executable, EXACTLY_ONCE) + } + + return Assertions.assertTimeout(timeout, executable, message) +} /** * Example usage: @@ -264,14 +468,22 @@ fun assertTimeout( * } * ``` * @see Assertions.assertTimeout - * @paramR the result of the [executable]. + * @param R the result of the [executable]. */ +@OptIn(ExperimentalContracts::class) @API(status = STABLE, since = "5.11") fun assertTimeout( timeout: Duration, message: () -> String, executable: () -> R -): R = Assertions.assertTimeout(timeout, executable, message) +): R { + contract { + callsInPlace(executable, EXACTLY_ONCE) + callsInPlace(message, AT_MOST_ONCE) + } + + return Assertions.assertTimeout(timeout, executable, message) +} /** * Example usage: @@ -281,7 +493,7 @@ fun assertTimeout( * } * ``` * @see Assertions.assertTimeoutPreemptively - * @paramR the result of the [executable]. + * @param R the result of the [executable]. */ @API(status = STABLE, since = "5.11") fun assertTimeoutPreemptively( @@ -297,7 +509,7 @@ fun assertTimeoutPreemptively( * } * ``` * @see Assertions.assertTimeoutPreemptively - * @paramR the result of the [executable]. + * @param R the result of the [executable]. */ @API(status = STABLE, since = "5.11") fun assertTimeoutPreemptively( @@ -314,19 +526,31 @@ fun assertTimeoutPreemptively( * } * ``` * @see Assertions.assertTimeoutPreemptively - * @paramR the result of the [executable]. + * @param R the result of the [executable]. */ +@OptIn(ExperimentalContracts::class) @API(status = STABLE, since = "5.11") fun assertTimeoutPreemptively( timeout: Duration, message: () -> String, executable: () -> R -): R = Assertions.assertTimeoutPreemptively(timeout, executable, message) +): R { + contract { + callsInPlace(message, AT_MOST_ONCE) + } + + return Assertions.assertTimeoutPreemptively(timeout, executable, message) +} /** * Example usage: * ```kotlin - * assertInstanceOf(list, "List should support fast random access") + * val maybeString: Any = ... + * + * assertInstanceOf(maybeString) + * + * // The compiler smart casts maybeString to a String object. + * assertTrue(maybeString.isNotEmpty()) * ``` * @see Assertions.assertInstanceOf * @since 5.11 @@ -343,7 +567,16 @@ inline fun assertInstanceOf( return Assertions.assertInstanceOf(T::class.java, actualValue, message) } -/* +/** + * Example usage: + * ```kotlin + * val maybeString: Any = ... + * + * assertInstanceOf(maybeString) { "Should be a string" } + * + * // The compiler smart casts maybeString to a String object. + * assertTrue(maybeString.isNotEmpty()) + * ``` * @see Assertions.assertInstanceOf * @since 5.11 */ @@ -355,6 +588,8 @@ inline fun assertInstanceOf( ): T { contract { returns() implies (actualValue is T) + + callsInPlace(message, AT_MOST_ONCE) } return Assertions.assertInstanceOf(T::class.java, actualValue, message) } diff --git a/jupiter-tests/src/test/kotlin/org/junit/jupiter/api/KotlinAssertTimeoutAssertionsTests.kt b/jupiter-tests/src/test/kotlin/org/junit/jupiter/api/KotlinAssertTimeoutAssertionsTests.kt index b85229eb0ded..ea057f658bd5 100644 --- a/jupiter-tests/src/test/kotlin/org/junit/jupiter/api/KotlinAssertTimeoutAssertionsTests.kt +++ b/jupiter-tests/src/test/kotlin/org/junit/jupiter/api/KotlinAssertTimeoutAssertionsTests.kt @@ -155,6 +155,41 @@ internal class KotlinAssertTimeoutAssertionsTests { assertMessageStartsWith(error, "Tempus Fugit ==> execution exceeded timeout of 10 ms by") } + @Test + fun `assertTimeout with value initialization in lambda`() { + val value: Int + + assertTimeout(ofMillis(500)) { value = 10 } + + assertEquals(10, value) + } + + @Test + fun `assertTimeout with message and value initialization in lambda`() { + val value: Int + + assertTimeout(ofMillis(500), "message") { value = 10 } + + assertEquals(10, value) + } + + @Test + fun `assertTimeout with message supplier and value initialization in lambda`() { + val value: Int + val valueInMessageSupplier: Int + + assertTimeout( + timeout = ofMillis(500), + message = { + valueInMessageSupplier = 20 // Val can be assigned in the message supplier lambda. + "message" + }, + executable = { value = 10 } + ) + + assertEquals(10, value) + } + // -- executable - preemptively --- @Test @@ -287,6 +322,20 @@ internal class KotlinAssertTimeoutAssertionsTests { assertMessageEquals(error, "Tempus Fugit ==> execution timed out after 10 ms") } + @Test + fun `assertTimeoutPreemptively with message supplier and value initialization in lambda`() { + val valueInMessageSupplier: Int + + assertTimeoutPreemptively( + timeout = ofMillis(500), + message = { + valueInMessageSupplier = 20 // Val can be assigned in the message supplier lambda. + "message" + }, + executable = {} + ) + } + /** * Take a nap for 100 milliseconds. */ diff --git a/jupiter-tests/src/test/kotlin/org/junit/jupiter/api/KotlinAssertionsTests.kt b/jupiter-tests/src/test/kotlin/org/junit/jupiter/api/KotlinAssertionsTests.kt index 79593e7b7a5a..9e6958c10ebe 100644 --- a/jupiter-tests/src/test/kotlin/org/junit/jupiter/api/KotlinAssertionsTests.kt +++ b/jupiter-tests/src/test/kotlin/org/junit/jupiter/api/KotlinAssertionsTests.kt @@ -247,6 +247,89 @@ class KotlinAssertionsTests { assertMessageStartsWith(result, "Should be a String") } + @Test + fun `assertInstanceOf with compiler smart cast`() { + val maybeString: Any = "string" + + assertInstanceOf(maybeString) + assertFalse(maybeString.isEmpty()) // A smart cast to a String object. + } + + @Test + fun `assertInstanceOf with compiler nullable smart cast`() { + val maybeString: Any? = "string" + + assertInstanceOf(maybeString) + assertFalse(maybeString.isEmpty()) // A smart cast to a non-nullable String object. + } + + @Test + fun `assertInstanceOf with a null value`() { + val error = + assertThrows { + assertInstanceOf(null) + } + + assertMessageStartsWith(error, "Unexpected null value") + } + + @Test + fun `assertInstanceOf with message and compiler smart cast`() { + val maybeString: Any = "string" + + assertInstanceOf(maybeString, "maybeString is not an instance of String") + assertFalse(maybeString.isEmpty()) // A smart cast to a String object. + } + + @Test + fun `assertInstanceOf with message supplier and compiler smart cast`() { + val maybeString: Any = "string" + + val valueInMessageSupplier: Int + + assertInstanceOf(maybeString) { + valueInMessageSupplier = 20 // Val can be assigned in the message supplier lambda. + + "maybeString is not an instance of String" + } + + assertFalse(maybeString.isEmpty()) // A smart cast to a String object. + } + + @Test + fun `assertNull with compiler smart cast`() { + val nullableString: String? = null + + assertNull(nullableString) + // Even safe call is not allowed because compiler knows that nullableString is always null. + // nullableString?.isEmpty() + } + + @Test + fun `assertNull with message and compiler smart cast`() { + val nullableString: String? = null + + assertNull(nullableString, "nullableString is not null") + // Even safe call is not allowed because compiler knows that nullableString is always null. + // nullableString?.isEmpty() + } + + @Test + fun `assertNull with message supplier and compiler smart cast`() { + val nullableString: String? = null + + val valueInMessageSupplier: Int + + assertNull(nullableString) { + valueInMessageSupplier = 20 // Val can be assigned in the message supplier lambda. + + "nullableString is not null" + } + + // Even safe call is not allowed because compiler knows that nullableString is always null. + // nullableString?.isEmpty() + } + companion object { fun assertExpectedExceptionTypes( multipleFailuresError: MultipleFailuresError, From 7413e30df4af4698b892e2274600d298bb1a545b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 23:39:29 +0000 Subject: [PATCH 378/611] Update codecov/codecov-action digest to 7f8b4b4 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7e91ea10ee2c..9560e35a4fa3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,7 +39,7 @@ jobs: jacocoRootReport \ --no-configuration-cache # Disable configuration cache due to https://github.com/diffplug/spotless/issues/2318 - name: Upload to Codecov.io - uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5 + uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # v5 with: token: ${{ secrets.CODECOV_TOKEN }} From e8ca0c89f834e59fc65f963592da718236eeb27a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 6 Dec 2024 09:41:38 +0000 Subject: [PATCH 379/611] Update dependency org.eclipse.platform:org.eclipse.platform to v4.34.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c3bfb3f87128..da1b55fd7e50 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ asciidoctor-plugins = "4.0.3" # Check if workaround in documentation.gradle.kts assertj = "3.26.3" bnd = "7.1.0" checkstyle = "10.20.2" -eclipse = "4.32.0" +eclipse = "4.34.0" jackson = "2.18.2" jacoco = "0.8.12" jmh = "1.37" From 086ac2f8317d545ba4d758e88b55c66083e1e0ea Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 6 Dec 2024 20:29:21 +0100 Subject: [PATCH 380/611] Create initial 5.11.4 release notes from template --- .../docs/asciidoc/release-notes/index.adoc | 2 + .../release-notes/release-notes-5.11.4.adoc | 67 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc diff --git a/documentation/src/docs/asciidoc/release-notes/index.adoc b/documentation/src/docs/asciidoc/release-notes/index.adoc index 93e2ed4bedd5..77d7e99bb937 100644 --- a/documentation/src/docs/asciidoc/release-notes/index.adoc +++ b/documentation/src/docs/asciidoc/release-notes/index.adoc @@ -19,6 +19,8 @@ include::{includedir}/link-attributes.adoc[] include::{basedir}/release-notes-5.12.0-M1.adoc[] +include::{basedir}/release-notes-5.11.4.adoc[] + include::{basedir}/release-notes-5.11.3.adoc[] include::{basedir}/release-notes-5.11.2.adoc[] diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc new file mode 100644 index 000000000000..ee08a53eed41 --- /dev/null +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc @@ -0,0 +1,67 @@ +[[release-notes-5.11.4]] +== 5.11.4 + +*Date of Release:* ❓ + +*Scope:* ❓ + +For a complete list of all _closed_ issues and pull requests for this release, consult the +link:{junit5-repo}+/milestone/86?closed=1+[5.11.4] milestone page in the +JUnit repository on GitHub. + + +[[release-notes-5.11.4-junit-platform]] +=== JUnit Platform + +[[release-notes-5.11.4-junit-platform-bug-fixes]] +==== Bug Fixes + +* ❓ + +[[release-notes-5.11.4-junit-platform-deprecations-and-breaking-changes]] +==== Deprecations and Breaking Changes + +* ❓ + +[[release-notes-5.11.4-junit-platform-new-features-and-improvements]] +==== New Features and Improvements + +* ❓ + + +[[release-notes-5.11.4-junit-jupiter]] +=== JUnit Jupiter + +[[release-notes-5.11.4-junit-jupiter-bug-fixes]] +==== Bug Fixes + +* ❓ + +[[release-notes-5.11.4-junit-jupiter-deprecations-and-breaking-changes]] +==== Deprecations and Breaking Changes + +* ❓ + +[[release-notes-5.11.4-junit-jupiter-new-features-and-improvements]] +==== New Features and Improvements + +* ❓ + + +[[release-notes-5.11.4-junit-vintage]] +=== JUnit Vintage + +[[release-notes-5.11.4-junit-vintage-bug-fixes]] +==== Bug Fixes + +* ❓ + +[[release-notes-5.11.4-junit-vintage-deprecations-and-breaking-changes]] +==== Deprecations and Breaking Changes + +* ❓ + +[[release-notes-5.11.4-junit-vintage-new-features-and-improvements]] +==== New Features and Improvements + +* ❓ From 803762c2b8b4a97c889cb746c06223e873438892 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sat, 7 Dec 2024 21:18:45 +0100 Subject: [PATCH 381/611] Fix IntelliJ package order config to be consistent with Spotless --- .idea/codeStyles/Project.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index e6094d409c45..9f10a217b5b9 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -9,10 +9,10 @@ - - + + From e460a03c7cf1698d452ac186e1e4ad496d047d28 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 8 Dec 2024 17:23:44 +0000 Subject: [PATCH 382/611] Update actions/attest-build-provenance action to v2.0.1 (#4179) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9560e35a4fa3..67d26bd50542 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -91,7 +91,7 @@ jobs: publish -x check \ prepareGitHubAttestation - name: Generate build provenance attestations - uses: actions/attest-build-provenance@619dbb2e03e0189af0c55118e7d3c5e129e99726 # v2.0.0 + uses: actions/attest-build-provenance@c4fbc648846ca6f503a13a2281a5e7b98aa57202 # v2.0.1 with: subject-path: documentation/build/attestation/*.jar From 91fd95e43ed2712eb6d48efab10b9f1df821d458 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sat, 7 Dec 2024 21:20:07 +0100 Subject: [PATCH 383/611] Add test task using Woodstox for XML serialization --- gradle/libs.versions.toml | 1 + platform-tests/platform-tests.gradle.kts | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index da1b55fd7e50..5b5c6b20f57b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -68,6 +68,7 @@ univocity-parsers = { module = "com.sonofab1rd:univocity-parsers", version = "2. xmlunit-assertj = { module = "org.xmlunit:xmlunit-assertj3", version.ref = "xmlunit" } xmlunit-placeholders = { module = "org.xmlunit:xmlunit-placeholders", version.ref = "xmlunit" } testingAnnotations = { module = "com.gradle:develocity-testing-annotations", version = "2.0.1" } +woodstox = { module = "com.fasterxml.woodstox:woodstox-core", version = "7.0.0" } # Only declared here so Dependabot knows when to update the referenced versions asciidoctorj-pdf = { module = "org.asciidoctor:asciidoctorj-pdf", version.ref = "asciidoctorj-pdf" } diff --git a/platform-tests/platform-tests.gradle.kts b/platform-tests/platform-tests.gradle.kts index 4c1c6960898f..2da1a0dbb08a 100644 --- a/platform-tests/platform-tests.gradle.kts +++ b/platform-tests/platform-tests.gradle.kts @@ -22,6 +22,12 @@ java { } } +val woodstox = configurations.dependencyScope("woodstox") +val woodstoxRuntimeClasspath = configurations.resolvable("woodstoxRuntimeClasspath") { + extendsFrom(configurations.testRuntimeClasspath.get()) + extendsFrom(woodstox.get()) +} + dependencies { // --- Things we are testing -------------------------------------------------- testImplementation(projects.junitPlatformCommons) @@ -61,6 +67,7 @@ dependencies { testRuntimeOnly(libs.groovy4) { because("`ReflectionUtilsTests.findNestedClassesWithInvalidNestedClassFile` needs it") } + woodstox(libs.woodstox) // --- https://openjdk.java.net/projects/code-tools/jmh/ ---------------------- jmh(projects.junitJupiterApi) @@ -108,6 +115,16 @@ tasks { includeTags("junit4") } } + val testWoodstox by registering(Test::class) { + val test by testing.suites.existing(JvmTestSuite::class) + testClassesDirs = files(test.map { it.sources.output.classesDirs }) + classpath = files(sourceSets.main.map { it.output }) + files(test.map { it.sources.output }) + woodstoxRuntimeClasspath.get() + group = JavaBasePlugin.VERIFICATION_GROUP + setIncludes(listOf("**/org/junit/platform/reporting/**")) + } + check { + dependsOn(testWoodstox) + } named(processStarter.compileJavaTaskName).configure { options.release = javaLibrary.testJavaVersion.majorVersion.toInt() } From 361eb6f15f674230d7b43cc2e734af022b3de04e Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sat, 7 Dec 2024 21:22:33 +0100 Subject: [PATCH 384/611] Delete duplicate test relying on implementation details --- .../legacy/xml/XmlReportWriterTests.java | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java index 7f8a324c50de..8c2211ed7474 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java @@ -228,27 +228,6 @@ void escapesInvalidCharactersInSystemPropertiesAndExceptionMessages() throws Exc .contains("AssertionError: expected: but was: "); } - @Test - void doesNotReopenCDataWithinCDataContent() throws Exception { - var uniqueId = engineDescriptor.getUniqueId().append("test", "test"); - engineDescriptor.addChild(new TestDescriptorStub(uniqueId, "test")); - var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams, dummyOutputDirectoryProvider()); - - var reportData = new XmlReportData(testPlan, Clock.systemDefaultZone()); - var assertionError = new AssertionError(""); - reportData.markFinished(testPlan.getTestIdentifier(uniqueId), failed(assertionError)); - Writer assertingWriter = new StringWriter() { - - @SuppressWarnings("NullableProblems") - @Override - public void write(char[] buffer, int off, int len) { - assertThat(new String(buffer, off, len)).doesNotContain("]]> Date: Sat, 7 Dec 2024 21:27:25 +0100 Subject: [PATCH 385/611] Use Unicode replacement character for illegal characters Rather than double-escaped character references. --- .../reporting/legacy/xml/XmlReportWriter.java | 14 +++++++----- .../legacy/xml/XmlReportWriterTests.java | 22 ++++++++++--------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/XmlReportWriter.java b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/XmlReportWriter.java index e81d3abbd10c..6fa11f044fdb 100644 --- a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/XmlReportWriter.java +++ b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/XmlReportWriter.java @@ -68,6 +68,8 @@ */ class XmlReportWriter { + static final char ILLEGAL_CHARACTER_REPLACEMENT = '\uFFFD'; + // Using zero-width assertions in the split pattern simplifies the splitting process: All split parts // (including the first and last one) can be used directly, without having to re-add separator characters. private static final Pattern CDATA_SPLIT_PATTERN = Pattern.compile("(?<=]])(?=>)"); @@ -328,16 +330,16 @@ private void writeOutputElement(String elementName, String content, XMLStreamWri } private void writeAttributeSafely(XMLStreamWriter writer, String name, String value) throws XMLStreamException { - writer.writeAttribute(name, escapeIllegalChars(value)); + writer.writeAttribute(name, replaceIllegalCharacters(value)); } private void writeCDataSafely(XMLStreamWriter writer, String data) throws XMLStreamException { - for (String safeDataPart : CDATA_SPLIT_PATTERN.split(escapeIllegalChars(data))) { + for (String safeDataPart : CDATA_SPLIT_PATTERN.split(replaceIllegalCharacters(data))) { writer.writeCData(safeDataPart); } } - static String escapeIllegalChars(String text) { + static String replaceIllegalCharacters(String text) { if (text.codePoints().allMatch(XmlReportWriter::isAllowedXmlCharacter)) { return text; } @@ -346,14 +348,14 @@ static String escapeIllegalChars(String text) { if (isAllowedXmlCharacter(codePoint)) { result.appendCodePoint(codePoint); } - else { // use a Character Reference (cf. https://www.w3.org/TR/xml/#NT-CharRef) - result.append("&#").append(codePoint).append(';'); + else { + result.append(ILLEGAL_CHARACTER_REPLACEMENT); } }); return result.toString(); } - private static boolean isAllowedXmlCharacter(int codePoint) { + static boolean isAllowedXmlCharacter(int codePoint) { // source: https://www.w3.org/TR/xml/#charsets return codePoint == 0x9 // || codePoint == 0xA // diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java index 8c2211ed7474..5e1ed3504226 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java @@ -21,6 +21,7 @@ import static org.junit.platform.launcher.LauncherConstants.STDOUT_REPORT_ENTRY_KEY; import static org.junit.platform.launcher.core.OutputDirectoryProviders.dummyOutputDirectoryProvider; import static org.junit.platform.reporting.legacy.xml.XmlReportAssertions.assertValidAccordingToJenkinsSchema; +import static org.junit.platform.reporting.legacy.xml.XmlReportWriter.ILLEGAL_CHARACTER_REPLACEMENT; import static org.mockito.Mockito.mock; import java.io.StringReader; @@ -220,29 +221,30 @@ void escapesInvalidCharactersInSystemPropertiesAndExceptionMessages() throws Exc assertValidAccordingToJenkinsSchema(testsuite.document()); assertThat(testsuite.find("property").matchAttr("name", "foo\\.bar").attr("value")) // - .isEqualTo(""); + .isEqualTo(String.valueOf(ILLEGAL_CHARACTER_REPLACEMENT)); var failure = testsuite.find("failure"); assertThat(failure.attr("message")) // - .isEqualTo("expected: but was: "); + .isEqualTo("expected: but was: "); assertThat(failure.text()) // - .contains("AssertionError: expected: but was: "); + .contains("AssertionError: expected: but was: "); } - @ParameterizedTest(name = "{index}") + @ParameterizedTest(name = "[{index}]") @MethodSource("stringPairs") - void escapesIllegalChars(String input, String output) { - assertEquals(output, XmlReportWriter.escapeIllegalChars(input)); + void replacesIllegalCharacters(String input, String output) { + assertEquals(output, XmlReportWriter.replaceIllegalCharacters(input)); } static Stream stringPairs() { return Stream.of( // - arguments("\0", "�"), // - arguments("\1", ""), // + arguments("\0", String.valueOf(ILLEGAL_CHARACTER_REPLACEMENT)), // + arguments("\1", String.valueOf(ILLEGAL_CHARACTER_REPLACEMENT)), // arguments("\t", "\t"), // arguments("\r", "\r"), // arguments("\n", "\n"), // - arguments("\u001f", ""), // - arguments("\u0020", "\u0020"), // + arguments("\u001f", String.valueOf(ILLEGAL_CHARACTER_REPLACEMENT)), // + arguments("✅", "✅"), // + arguments(" ", " "), // arguments("foo!", "foo!"), // arguments("\uD801\uDC00", "\uD801\uDC00") // ); From 20092d1372452970d7d6af848d28f34804bf91f0 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sat, 7 Dec 2024 21:30:06 +0100 Subject: [PATCH 386/611] Add test for whitespace escaping --- .../legacy/xml/XmlReportWriterTests.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java index 5e1ed3504226..3f43326329cd 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java @@ -10,6 +10,7 @@ package org.junit.platform.reporting.legacy.xml; +import static java.util.stream.Collectors.joining; import static org.assertj.core.api.Assertions.assertThat; import static org.joox.JOOX.$; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -30,6 +31,7 @@ import java.time.Clock; import java.util.Map; import java.util.Set; +import java.util.stream.IntStream; import java.util.stream.Stream; import org.joox.Match; @@ -235,6 +237,31 @@ void replacesIllegalCharacters(String input, String output) { assertEquals(output, XmlReportWriter.replaceIllegalCharacters(input)); } + @Test + void writesValidXmlForExceptionMessagesContainingLineBreaks() throws Exception { + var uniqueId = engineDescriptor.getUniqueId().append("test", "test"); + engineDescriptor.addChild(new TestDescriptorStub(uniqueId, "test")); + var testPlan = TestPlan.from(Set.of(engineDescriptor), configParams, dummyOutputDirectoryProvider()); + + var allWhitespaceCharacters = IntStream.range(0, 0x10000) // + .filter(Character::isWhitespace) // + .filter(XmlReportWriter::isAllowedXmlCharacter) // + .mapToObj(Character::toString) // + .collect(joining()); + + var message = "a" + allWhitespaceCharacters + " b<&>"; + var reportData = new XmlReportData(testPlan, Clock.systemDefaultZone()); + var assertionError = new AssertionError(message); + reportData.markFinished(testPlan.getTestIdentifier(uniqueId), failed(assertionError)); + + var testsuite = writeXmlReport(testPlan, reportData); + + assertValidAccordingToJenkinsSchema(testsuite.document()); + + var attributeValue = testsuite.find("failure").attr("message"); + assertThat(attributeValue).isEqualTo(message); + } + static Stream stringPairs() { return Stream.of( // arguments("\0", String.valueOf(ILLEGAL_CHARACTER_REPLACEMENT)), // From 432d556bc7a972f5a94e856f30465b7ad7d2f915 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sun, 8 Dec 2024 13:08:11 +0100 Subject: [PATCH 387/611] Implement workaround for escaping whitespace chars in attribute values While XML attribute values may contain whitespace such as line breaks, the XML spec [1] dictates that XML processors must replace them with spaces which causes downstream tools to misrepresent the original value. [1] w3.org/TR/xml#AVNormalize Resolves #4174. --- .../release-notes/release-notes-5.11.4.adoc | 5 +- .../reporting/legacy/xml/XmlReportWriter.java | 526 +++++++++++------- 2 files changed, 341 insertions(+), 190 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc index ee08a53eed41..1e2d0eab31cc 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc @@ -16,7 +16,10 @@ JUnit repository on GitHub. [[release-notes-5.11.4-junit-platform-bug-fixes]] ==== Bug Fixes -* ❓ +* Escape whitespace characters (such as line breaks) in XML attribute values (such as + exception messages) in the legacy XML report generated by the Console Launcher. This + change ensures the resulting XML files can be processed by downstream tools while + preserving whitespace characters. [[release-notes-5.11.4-junit-platform-deprecations-and-breaking-changes]] ==== Deprecations and Breaking Changes diff --git a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/XmlReportWriter.java b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/XmlReportWriter.java index 6fa11f044fdb..b9d7ea13aff3 100644 --- a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/XmlReportWriter.java +++ b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/XmlReportWriter.java @@ -13,6 +13,7 @@ import static java.text.MessageFormat.format; import static java.time.format.DateTimeFormatter.ISO_LOCAL_DATE_TIME; import static java.util.Collections.emptyList; +import static java.util.Collections.unmodifiableMap; import static java.util.Comparator.naturalOrder; import static java.util.function.Function.identity; import static java.util.stream.Collectors.counting; @@ -30,6 +31,7 @@ import static org.junit.platform.reporting.legacy.xml.XmlReportWriter.AggregatedTestResult.Type.SKIPPED; import static org.junit.platform.reporting.legacy.xml.XmlReportWriter.AggregatedTestResult.Type.SUCCESS; +import java.io.IOException; import java.io.Writer; import java.net.InetAddress; import java.net.UnknownHostException; @@ -38,6 +40,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.EnumSet; +import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Locale; @@ -70,6 +73,15 @@ class XmlReportWriter { static final char ILLEGAL_CHARACTER_REPLACEMENT = '\uFFFD'; + private static final Map REPLACEMENTS_IN_ATTRIBUTE_VALUES; + static { + Map tmp = new HashMap<>(3); + tmp.put('\n', " "); + tmp.put('\r', " "); + tmp.put('\t', " "); + REPLACEMENTS_IN_ATTRIBUTE_VALUES = unmodifiableMap(tmp); + } + // Using zero-width assertions in the split pattern simplifies the splitting process: All split parts // (including the first and last one) can be used directly, without having to re-add separator characters. private static final Pattern CDATA_SPLIT_PATTERN = Pattern.compile("(?<=]])(?=>)"); @@ -103,239 +115,265 @@ private boolean shouldInclude(TestPlan testPlan, TestIdentifier testIdentifier) private void writeXmlReport(TestIdentifier testIdentifier, Map tests, Writer out) throws XMLStreamException { - XMLOutputFactory factory = XMLOutputFactory.newInstance(); - XMLStreamWriter xmlWriter = factory.createXMLStreamWriter(out); - xmlWriter.writeStartDocument("UTF-8", "1.0"); - newLine(xmlWriter); - writeTestsuite(testIdentifier, tests, xmlWriter); - xmlWriter.writeEndDocument(); - xmlWriter.flush(); - xmlWriter.close(); + new XmlReport(out).write(testIdentifier, tests); } - private void writeTestsuite(TestIdentifier testIdentifier, Map tests, - XMLStreamWriter writer) throws XMLStreamException { + class XmlReport implements AutoCloseable { - // NumberFormat is not thread-safe. Thus, we instantiate it here and pass it to - // writeTestcase instead of using a constant - NumberFormat numberFormat = NumberFormat.getInstance(Locale.US); + private final XMLStreamWriter xml; + private final ReplacingWriter out; - writer.writeStartElement("testsuite"); + XmlReport(Writer out) throws XMLStreamException { + this.out = new ReplacingWriter(out); + XMLOutputFactory factory = XMLOutputFactory.newInstance(); + this.xml = factory.createXMLStreamWriter(this.out); + } - writeSuiteAttributes(testIdentifier, tests.values(), numberFormat, writer); + void write(TestIdentifier testIdentifier, Map tests) + throws XMLStreamException { + xml.writeStartDocument("UTF-8", "1.0"); + newLine(); + writeTestsuite(testIdentifier, tests); + xml.writeEndDocument(); + } - newLine(writer); - writeSystemProperties(writer); + private void writeTestsuite(TestIdentifier testIdentifier, Map tests) + throws XMLStreamException { - for (Entry entry : tests.entrySet()) { - writeTestcase(entry.getKey(), entry.getValue(), numberFormat, writer); - } + // NumberFormat is not thread-safe. Thus, we instantiate it here and pass it to + // writeTestcase instead of using a constant + NumberFormat numberFormat = NumberFormat.getInstance(Locale.US); - writeOutputElement("system-out", formatNonStandardAttributesAsString(testIdentifier), writer); + xml.writeStartElement("testsuite"); - writer.writeEndElement(); - newLine(writer); - } + writeSuiteAttributes(testIdentifier, tests.values(), numberFormat); - private void writeSuiteAttributes(TestIdentifier testIdentifier, Collection testResults, - NumberFormat numberFormat, XMLStreamWriter writer) throws XMLStreamException { + newLine(); + writeSystemProperties(); - writeAttributeSafely(writer, "name", testIdentifier.getDisplayName()); - writeTestCounts(testResults, writer); - writeAttributeSafely(writer, "time", getTime(testIdentifier, numberFormat)); - writeAttributeSafely(writer, "hostname", getHostname().orElse("")); - writeAttributeSafely(writer, "timestamp", ISO_LOCAL_DATE_TIME.format(getCurrentDateTime())); - } + for (Entry entry : tests.entrySet()) { + writeTestcase(entry.getKey(), entry.getValue(), numberFormat); + } - private void writeTestCounts(Collection testResults, XMLStreamWriter writer) - throws XMLStreamException { - Map counts = testResults.stream().map(it -> it.type).collect(groupingBy(identity(), counting())); - long total = counts.values().stream().mapToLong(Long::longValue).sum(); - writeAttributeSafely(writer, "tests", String.valueOf(total)); - writeAttributeSafely(writer, "skipped", counts.getOrDefault(SKIPPED, 0L).toString()); - writeAttributeSafely(writer, "failures", counts.getOrDefault(FAILURE, 0L).toString()); - writeAttributeSafely(writer, "errors", counts.getOrDefault(ERROR, 0L).toString()); - } + writeOutputElement("system-out", formatNonStandardAttributesAsString(testIdentifier)); - private void writeSystemProperties(XMLStreamWriter writer) throws XMLStreamException { - writer.writeStartElement("properties"); - newLine(writer); - Properties systemProperties = System.getProperties(); - for (String propertyName : new TreeSet<>(systemProperties.stringPropertyNames())) { - writer.writeEmptyElement("property"); - writeAttributeSafely(writer, "name", propertyName); - writeAttributeSafely(writer, "value", systemProperties.getProperty(propertyName)); - newLine(writer); - } - writer.writeEndElement(); - newLine(writer); - } + xml.writeEndElement(); + newLine(); + } - private void writeTestcase(TestIdentifier testIdentifier, AggregatedTestResult testResult, - NumberFormat numberFormat, XMLStreamWriter writer) throws XMLStreamException { + private void writeSuiteAttributes(TestIdentifier testIdentifier, Collection testResults, + NumberFormat numberFormat) throws XMLStreamException { - writer.writeStartElement("testcase"); + writeAttributeSafely("name", testIdentifier.getDisplayName()); + writeTestCounts(testResults); + writeAttributeSafely("time", getTime(testIdentifier, numberFormat)); + writeAttributeSafely("hostname", getHostname().orElse("")); + writeAttributeSafely("timestamp", ISO_LOCAL_DATE_TIME.format(getCurrentDateTime())); + } - writeAttributeSafely(writer, "name", getName(testIdentifier)); - writeAttributeSafely(writer, "classname", getClassName(testIdentifier)); - writeAttributeSafely(writer, "time", getTime(testIdentifier, numberFormat)); - newLine(writer); + private void writeTestCounts(Collection testResults) throws XMLStreamException { + Map counts = testResults.stream().map(it -> it.type).collect( + groupingBy(identity(), counting())); + long total = counts.values().stream().mapToLong(Long::longValue).sum(); + writeAttributeSafely("tests", String.valueOf(total)); + writeAttributeSafely("skipped", counts.getOrDefault(SKIPPED, 0L).toString()); + writeAttributeSafely("failures", counts.getOrDefault(FAILURE, 0L).toString()); + writeAttributeSafely("errors", counts.getOrDefault(ERROR, 0L).toString()); + } - writeSkippedOrErrorOrFailureElement(testIdentifier, testResult, writer); + private void writeSystemProperties() throws XMLStreamException { + xml.writeStartElement("properties"); + newLine(); + Properties systemProperties = System.getProperties(); + for (String propertyName : new TreeSet<>(systemProperties.stringPropertyNames())) { + xml.writeEmptyElement("property"); + writeAttributeSafely("name", propertyName); + writeAttributeSafely("value", systemProperties.getProperty(propertyName)); + newLine(); + } + xml.writeEndElement(); + newLine(); + } - List systemOutElements = new ArrayList<>(); - List systemErrElements = new ArrayList<>(); - systemOutElements.add(formatNonStandardAttributesAsString(testIdentifier)); - collectReportEntries(testIdentifier, systemOutElements, systemErrElements); - writeOutputElements("system-out", systemOutElements, writer); - writeOutputElements("system-err", systemErrElements, writer); + private void writeTestcase(TestIdentifier testIdentifier, AggregatedTestResult testResult, + NumberFormat numberFormat) throws XMLStreamException { - writer.writeEndElement(); - newLine(writer); - } + xml.writeStartElement("testcase"); - private String getName(TestIdentifier testIdentifier) { - return testIdentifier.getLegacyReportingName(); - } + writeAttributeSafely("name", getName(testIdentifier)); + writeAttributeSafely("classname", getClassName(testIdentifier)); + writeAttributeSafely("time", getTime(testIdentifier, numberFormat)); + newLine(); - private String getClassName(TestIdentifier testIdentifier) { - return LegacyReportingUtils.getClassName(this.reportData.getTestPlan(), testIdentifier); - } + writeSkippedOrErrorOrFailureElement(testIdentifier, testResult); + + List systemOutElements = new ArrayList<>(); + List systemErrElements = new ArrayList<>(); + systemOutElements.add(formatNonStandardAttributesAsString(testIdentifier)); + collectReportEntries(testIdentifier, systemOutElements, systemErrElements); + writeOutputElements("system-out", systemOutElements); + writeOutputElements("system-err", systemErrElements); + + xml.writeEndElement(); + newLine(); + } - private void writeSkippedOrErrorOrFailureElement(TestIdentifier testIdentifier, AggregatedTestResult testResult, - XMLStreamWriter writer) throws XMLStreamException { + private String getName(TestIdentifier testIdentifier) { + return testIdentifier.getLegacyReportingName(); + } - if (testResult.type == SKIPPED) { - writeSkippedElement(this.reportData.getSkipReason(testIdentifier), writer); + private String getClassName(TestIdentifier testIdentifier) { + return LegacyReportingUtils.getClassName(reportData.getTestPlan(), testIdentifier); } - else { - Map>> throwablesByType = testResult.getThrowablesByType(); - for (Type type : EnumSet.of(FAILURE, ERROR)) { - for (Optional throwable : throwablesByType.getOrDefault(type, emptyList())) { - writeErrorOrFailureElement(type, throwable.orElse(null), writer); + + private void writeSkippedOrErrorOrFailureElement(TestIdentifier testIdentifier, AggregatedTestResult testResult) + throws XMLStreamException { + + if (testResult.type == SKIPPED) { + writeSkippedElement(reportData.getSkipReason(testIdentifier), xml); + } + else { + Map>> throwablesByType = testResult.getThrowablesByType(); + for (Type type : EnumSet.of(FAILURE, ERROR)) { + for (Optional throwable : throwablesByType.getOrDefault(type, emptyList())) { + writeErrorOrFailureElement(type, throwable.orElse(null), xml); + } } } } - } - private void writeSkippedElement(String reason, XMLStreamWriter writer) throws XMLStreamException { - if (isNotBlank(reason)) { - writer.writeStartElement("skipped"); - writeCDataSafely(writer, reason); - writer.writeEndElement(); - } - else { - writer.writeEmptyElement("skipped"); + private void writeSkippedElement(String reason, XMLStreamWriter writer) throws XMLStreamException { + if (isNotBlank(reason)) { + writer.writeStartElement("skipped"); + writeCDataSafely(reason); + writer.writeEndElement(); + } + else { + writer.writeEmptyElement("skipped"); + } + newLine(); } - newLine(writer); - } - private void writeErrorOrFailureElement(Type type, Throwable throwable, XMLStreamWriter writer) - throws XMLStreamException { + private void writeErrorOrFailureElement(Type type, Throwable throwable, XMLStreamWriter writer) + throws XMLStreamException { - String elementName = type == FAILURE ? "failure" : "error"; - if (throwable != null) { - writer.writeStartElement(elementName); - writeFailureAttributesAndContent(throwable, writer); - writer.writeEndElement(); - } - else { - writer.writeEmptyElement(elementName); + String elementName = type == FAILURE ? "failure" : "error"; + if (throwable != null) { + writer.writeStartElement(elementName); + writeFailureAttributesAndContent(throwable); + writer.writeEndElement(); + } + else { + writer.writeEmptyElement(elementName); + } + newLine(); } - newLine(writer); - } - private void writeFailureAttributesAndContent(Throwable throwable, XMLStreamWriter writer) - throws XMLStreamException { + private void writeFailureAttributesAndContent(Throwable throwable) throws XMLStreamException { - if (throwable.getMessage() != null) { - writeAttributeSafely(writer, "message", throwable.getMessage()); + if (throwable.getMessage() != null) { + writeAttributeSafely("message", throwable.getMessage()); + } + writeAttributeSafely("type", throwable.getClass().getName()); + writeCDataSafely(readStackTrace(throwable)); } - writeAttributeSafely(writer, "type", throwable.getClass().getName()); - writeCDataSafely(writer, readStackTrace(throwable)); - } - private void collectReportEntries(TestIdentifier testIdentifier, List systemOutElements, - List systemErrElements) { - List entries = this.reportData.getReportEntries(testIdentifier); - if (!entries.isEmpty()) { - List systemOutElementsForCapturedOutput = new ArrayList<>(); - StringBuilder formattedReportEntries = new StringBuilder(); - for (int i = 0; i < entries.size(); i++) { - ReportEntry reportEntry = entries.get(i); - Map keyValuePairs = new LinkedHashMap<>(reportEntry.getKeyValuePairs()); - removeIfPresentAndAddAsSeparateElement(keyValuePairs, STDOUT_REPORT_ENTRY_KEY, - systemOutElementsForCapturedOutput); - removeIfPresentAndAddAsSeparateElement(keyValuePairs, STDERR_REPORT_ENTRY_KEY, systemErrElements); - if (!keyValuePairs.isEmpty()) { - buildReportEntryDescription(reportEntry.getTimestamp(), keyValuePairs, i + 1, - formattedReportEntries); + private void collectReportEntries(TestIdentifier testIdentifier, List systemOutElements, + List systemErrElements) { + List entries = reportData.getReportEntries(testIdentifier); + if (!entries.isEmpty()) { + List systemOutElementsForCapturedOutput = new ArrayList<>(); + StringBuilder formattedReportEntries = new StringBuilder(); + for (int i = 0; i < entries.size(); i++) { + ReportEntry reportEntry = entries.get(i); + Map keyValuePairs = new LinkedHashMap<>(reportEntry.getKeyValuePairs()); + removeIfPresentAndAddAsSeparateElement(keyValuePairs, STDOUT_REPORT_ENTRY_KEY, + systemOutElementsForCapturedOutput); + removeIfPresentAndAddAsSeparateElement(keyValuePairs, STDERR_REPORT_ENTRY_KEY, systemErrElements); + if (!keyValuePairs.isEmpty()) { + buildReportEntryDescription(reportEntry.getTimestamp(), keyValuePairs, i + 1, + formattedReportEntries); + } } + systemOutElements.add(formattedReportEntries.toString().trim()); + systemOutElements.addAll(systemOutElementsForCapturedOutput); } - systemOutElements.add(formattedReportEntries.toString().trim()); - systemOutElements.addAll(systemOutElementsForCapturedOutput); } - } - private void removeIfPresentAndAddAsSeparateElement(Map keyValuePairs, String key, - List elements) { - String value = keyValuePairs.remove(key); - if (value != null) { - elements.add(value); + private void removeIfPresentAndAddAsSeparateElement(Map keyValuePairs, String key, + List elements) { + String value = keyValuePairs.remove(key); + if (value != null) { + elements.add(value); + } } - } - private void buildReportEntryDescription(LocalDateTime timestamp, Map keyValuePairs, - int entryNumber, StringBuilder result) { - result.append( - format("Report Entry #{0} (timestamp: {1})\n", entryNumber, ISO_LOCAL_DATE_TIME.format(timestamp))); - keyValuePairs.forEach((key, value) -> result.append(format("\t- {0}: {1}\n", key, value))); - } + private void buildReportEntryDescription(LocalDateTime timestamp, Map keyValuePairs, + int entryNumber, StringBuilder result) { + result.append( + format("Report Entry #{0} (timestamp: {1})\n", entryNumber, ISO_LOCAL_DATE_TIME.format(timestamp))); + keyValuePairs.forEach((key, value) -> result.append(format("\t- {0}: {1}\n", key, value))); + } - private String getTime(TestIdentifier testIdentifier, NumberFormat numberFormat) { - return numberFormat.format(this.reportData.getDurationInSeconds(testIdentifier)); - } + private String getTime(TestIdentifier testIdentifier, NumberFormat numberFormat) { + return numberFormat.format(reportData.getDurationInSeconds(testIdentifier)); + } - private Optional getHostname() { - try { - return Optional.ofNullable(InetAddress.getLocalHost().getHostName()); + private Optional getHostname() { + try { + return Optional.ofNullable(InetAddress.getLocalHost().getHostName()); + } + catch (UnknownHostException e) { + return Optional.empty(); + } } - catch (UnknownHostException e) { - return Optional.empty(); + + private LocalDateTime getCurrentDateTime() { + return LocalDateTime.now(reportData.getClock()).withNano(0); } - } - private LocalDateTime getCurrentDateTime() { - return LocalDateTime.now(this.reportData.getClock()).withNano(0); - } + private String formatNonStandardAttributesAsString(TestIdentifier testIdentifier) { + return "unique-id: " + testIdentifier.getUniqueId() // + + "\ndisplay-name: " + testIdentifier.getDisplayName(); + } - private String formatNonStandardAttributesAsString(TestIdentifier testIdentifier) { - return "unique-id: " + testIdentifier.getUniqueId() // - + "\ndisplay-name: " + testIdentifier.getDisplayName(); - } + private void writeOutputElements(String elementName, List elements) throws XMLStreamException { + for (String content : elements) { + writeOutputElement(elementName, content); + } + } - private void writeOutputElements(String elementName, List elements, XMLStreamWriter writer) - throws XMLStreamException { - for (String content : elements) { - writeOutputElement(elementName, content, writer); + private void writeOutputElement(String elementName, String content) throws XMLStreamException { + xml.writeStartElement(elementName); + writeCDataSafely("\n" + content + "\n"); + xml.writeEndElement(); + newLine(); } - } - private void writeOutputElement(String elementName, String content, XMLStreamWriter writer) - throws XMLStreamException { - writer.writeStartElement(elementName); - writeCDataSafely(writer, "\n" + content + "\n"); - writer.writeEndElement(); - newLine(writer); - } + private void writeAttributeSafely(String name, String value) throws XMLStreamException { + // Workaround for XMLStreamWriter implementations that don't escape + // '\n', '\r', and '\t' characters in attribute values + xml.flush(); + out.setWhitespaceReplacingEnabled(true); + xml.writeAttribute(name, replaceIllegalCharacters(value)); + xml.flush(); + out.setWhitespaceReplacingEnabled(false); + } - private void writeAttributeSafely(XMLStreamWriter writer, String name, String value) throws XMLStreamException { - writer.writeAttribute(name, replaceIllegalCharacters(value)); - } + private void writeCDataSafely(String data) throws XMLStreamException { + for (String safeDataPart : CDATA_SPLIT_PATTERN.split(replaceIllegalCharacters(data))) { + xml.writeCData(safeDataPart); + } + } - private void writeCDataSafely(XMLStreamWriter writer, String data) throws XMLStreamException { - for (String safeDataPart : CDATA_SPLIT_PATTERN.split(replaceIllegalCharacters(data))) { - writer.writeCData(safeDataPart); + private void newLine() throws XMLStreamException { + xml.writeCharacters("\n"); + } + + @Override + public void close() throws XMLStreamException { + xml.flush(); + xml.close(); } } @@ -365,15 +403,6 @@ static boolean isAllowedXmlCharacter(int codePoint) { || (codePoint >= 0x10000 && codePoint <= 0x10FFFF); } - private void newLine(XMLStreamWriter xmlWriter) throws XMLStreamException { - xmlWriter.writeCharacters("\n"); - } - - private static boolean isFailure(TestExecutionResult result) { - Optional throwable = result.getThrowable(); - return throwable.isPresent() && throwable.get() instanceof AssertionError; - } - static class AggregatedTestResult { private static final AggregatedTestResult SKIPPED_RESULT = new AggregatedTestResult(SKIPPED, emptyList()); @@ -413,6 +442,125 @@ private static Type from(TestExecutionResult executionResult) { } return SUCCESS; } + + private static boolean isFailure(TestExecutionResult result) { + Optional throwable = result.getThrowable(); + return throwable.isPresent() && throwable.get() instanceof AssertionError; + } + } + } + + private static class ReplacingWriter extends Writer { + + private final Writer delegate; + private boolean whitespaceReplacingEnabled; + + ReplacingWriter(Writer delegate) { + this.delegate = delegate; + } + + void setWhitespaceReplacingEnabled(boolean whitespaceReplacingEnabled) { + this.whitespaceReplacingEnabled = whitespaceReplacingEnabled; + } + + @Override + public void write(char[] cbuf, int off, int len) throws IOException { + if (!whitespaceReplacingEnabled) { + delegate.write(cbuf, off, len); + return; + } + StringBuilder stringBuilder = new StringBuilder(len * 2); + for (int i = off; i < off + len; i++) { + char c = cbuf[i]; + String replacement = REPLACEMENTS_IN_ATTRIBUTE_VALUES.get(c); + if (replacement != null) { + stringBuilder.append(replacement); + } + else { + stringBuilder.append(c); + } + } + delegate.write(stringBuilder.toString()); + } + + @Override + public void write(int c) throws IOException { + if (whitespaceReplacingEnabled) { + super.write(c); + } + else { + delegate.write(c); + } + } + + @Override + public void write(char[] cbuf) throws IOException { + if (whitespaceReplacingEnabled) { + super.write(cbuf); + } + else { + delegate.write(cbuf); + } + } + + @Override + public void write(String str) throws IOException { + if (whitespaceReplacingEnabled) { + super.write(str); + } + else { + delegate.write(str); + } + } + + @Override + public void write(String str, int off, int len) throws IOException { + if (whitespaceReplacingEnabled) { + super.write(str, off, len); + } + else { + delegate.write(str, off, len); + } + } + + @Override + public Writer append(CharSequence csq) throws IOException { + if (whitespaceReplacingEnabled) { + return super.append(csq); + } + else { + return delegate.append(csq); + } + } + + @Override + public Writer append(CharSequence csq, int start, int end) throws IOException { + if (whitespaceReplacingEnabled) { + return super.append(csq, start, end); + } + else { + return delegate.append(csq, start, end); + } + } + + @Override + public Writer append(char c) throws IOException { + if (whitespaceReplacingEnabled) { + return super.append(c); + } + else { + return delegate.append(c); + } + } + + @Override + public void flush() throws IOException { + delegate.flush(); + } + + @Override + public void close() throws IOException { + delegate.close(); } } From a1b2f6fd8d866b5a2792bd17eed414c14b9d6763 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sun, 8 Dec 2024 20:36:05 +0100 Subject: [PATCH 388/611] Revert to Spotless 7.0.0.BETA2 to attempt to fix build on CI --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5b5c6b20f57b..cee07f10bb8e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -96,5 +96,5 @@ jmh = { id = "me.champeau.jmh", version = "0.7.2" } nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" } plantuml = { id = "io.freefair.plantuml", version = "8.11" } shadow = { id = "com.gradleup.shadow", version = "8.3.5" } -spotless = { id = "com.diffplug.spotless", version = "7.0.0.BETA4" } +spotless = { id = "com.diffplug.spotless", version = "7.0.0.BETA2" } versions = { id = "com.github.ben-manes.versions", version = "0.51.0" } From 2206087185eaf26e0eb3a6c9b26e5532705bf344 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 8 Dec 2024 19:37:04 +0000 Subject: [PATCH 389/611] Update dependency com.fasterxml.woodstox:woodstox-core to v7.1.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index cee07f10bb8e..fce5b5ed00d9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -68,7 +68,7 @@ univocity-parsers = { module = "com.sonofab1rd:univocity-parsers", version = "2. xmlunit-assertj = { module = "org.xmlunit:xmlunit-assertj3", version.ref = "xmlunit" } xmlunit-placeholders = { module = "org.xmlunit:xmlunit-placeholders", version.ref = "xmlunit" } testingAnnotations = { module = "com.gradle:develocity-testing-annotations", version = "2.0.1" } -woodstox = { module = "com.fasterxml.woodstox:woodstox-core", version = "7.0.0" } +woodstox = { module = "com.fasterxml.woodstox:woodstox-core", version = "7.1.0" } # Only declared here so Dependabot knows when to update the referenced versions asciidoctorj-pdf = { module = "org.asciidoctor:asciidoctorj-pdf", version.ref = "asciidoctorj-pdf" } From 293c1782cc5727c8f1dc201d4a722566cca56f35 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sun, 8 Dec 2024 21:21:24 +0100 Subject: [PATCH 390/611] Revert to Spotless 7.0.0.BETA1 to attempt to fix build on CI --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fce5b5ed00d9..66e03a43d77d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -96,5 +96,5 @@ jmh = { id = "me.champeau.jmh", version = "0.7.2" } nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" } plantuml = { id = "io.freefair.plantuml", version = "8.11" } shadow = { id = "com.gradleup.shadow", version = "8.3.5" } -spotless = { id = "com.diffplug.spotless", version = "7.0.0.BETA2" } +spotless = { id = "com.diffplug.spotless", version = "7.0.0.BETA1" } versions = { id = "com.github.ben-manes.versions", version = "0.51.0" } From e3715cfdf9d59d82de7a94b90964d7578ebd6d8e Mon Sep 17 00:00:00 2001 From: Christian Stein Date: Mon, 9 Dec 2024 11:14:32 +0100 Subject: [PATCH 391/611] Add `JAVA_25` to `JRE` enum Add `JRE.JAVA_25` constant and introduce JDK 25-ea CI build Closes #4177 --- .github/workflows/cross-version.yml | 2 ++ .../src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc | 2 +- .../docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc | 2 +- gradle/base/code-generator-model/src/main/resources/jre.yaml | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cross-version.yml b/.github/workflows/cross-version.yml index d303d359437c..364a04fae552 100644 --- a/.github/workflows/cross-version.yml +++ b/.github/workflows/cross-version.yml @@ -31,6 +31,8 @@ jobs: - version: 24 type: ea release: leyden + - version: 25 + type: ea name: "OpenJDK ${{ matrix.jdk.version }} (${{ matrix.jdk.release || matrix.jdk.type }})" runs-on: ubuntu-latest steps: diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc index 1e2d0eab31cc..ce1fd83e14c4 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc @@ -48,7 +48,7 @@ JUnit repository on GitHub. [[release-notes-5.11.4-junit-jupiter-new-features-and-improvements]] ==== New Features and Improvements -* ❓ +* `JAVA_25` has been added to the `JRE` enum for use with JRE-based execution conditions. [[release-notes-5.11.4-junit-vintage]] diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 41eeda5831b1..6794f04a77c5 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -118,7 +118,7 @@ JUnit repository on GitHub. thread dump to `System.out` prior to interrupting a test thread due to a timeout. * `TestReporter` now allows publishing files for a test method or test class which can be used to include them in test reports, such as the Open Test Reporting format. - +* `JAVA_25` has been added to the `JRE` enum for use with JRE-based execution conditions. [[release-notes-5.12.0-M1-junit-vintage]] === JUnit Vintage diff --git a/gradle/base/code-generator-model/src/main/resources/jre.yaml b/gradle/base/code-generator-model/src/main/resources/jre.yaml index ed1bdd3d59fc..1747ffa12dd6 100644 --- a/gradle/base/code-generator-model/src/main/resources/jre.yaml +++ b/gradle/base/code-generator-model/src/main/resources/jre.yaml @@ -28,3 +28,5 @@ since: '5.11' - version: 24 since: '5.11' +- version: 25 + since: '5.11.4' From 7784a45eaa43cb8018b1cd7034ebd30a0ad442cd Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 22:43:13 +0000 Subject: [PATCH 392/611] Update actions/attest-build-provenance action to v2.1.0 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 67d26bd50542..fc31f3803d7a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -91,7 +91,7 @@ jobs: publish -x check \ prepareGitHubAttestation - name: Generate build provenance attestations - uses: actions/attest-build-provenance@c4fbc648846ca6f503a13a2281a5e7b98aa57202 # v2.0.1 + uses: actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0 with: subject-path: documentation/build/attestation/*.jar From 6c26fbbf4e8e1c9ccdd86dd95c640b5d7177da1a Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 10 Dec 2024 13:23:59 +0100 Subject: [PATCH 393/611] Update Spotless to 7.0.0.BETA2 to attempt to fix the build on CI --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 66e03a43d77d..fce5b5ed00d9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -96,5 +96,5 @@ jmh = { id = "me.champeau.jmh", version = "0.7.2" } nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" } plantuml = { id = "io.freefair.plantuml", version = "8.11" } shadow = { id = "com.gradleup.shadow", version = "8.3.5" } -spotless = { id = "com.diffplug.spotless", version = "7.0.0.BETA1" } +spotless = { id = "com.diffplug.spotless", version = "7.0.0.BETA2" } versions = { id = "com.github.ben-manes.versions", version = "0.51.0" } From 59a5f773f5878d02a5e5afc1f1c1e4902280979b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 19:27:57 +0000 Subject: [PATCH 394/611] Update github/codeql-action digest to babb554 (#4194) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/ossf-scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e6ce3de32652..dcd7458dab05 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -34,7 +34,7 @@ jobs: - name: Check out repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Initialize CodeQL - uses: github/codeql-action/init@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3 + uses: github/codeql-action/init@babb554ede22fd5605947329c4d04d8e7a0b8155 # v3 with: languages: ${{ matrix.language }} tools: linked @@ -47,4 +47,4 @@ jobs: -Dscan.tag.CodeQL \ allMainClasses - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3 + uses: github/codeql-action/analyze@babb554ede22fd5605947329c4d04d8e7a0b8155 # v3 diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index 1662ea9aee3f..b8ce6c88eb3c 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard (optional). # Commenting out will disable upload of results to your repo's Code Scanning dashboard - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3 + uses: github/codeql-action/upload-sarif@babb554ede22fd5605947329c4d04d8e7a0b8155 # v3 with: sarif_file: results.sarif From bc3ea9236578a53005b772f7f18aee7d2bf01cb9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 19:28:26 +0000 Subject: [PATCH 395/611] Update plugin gitPublish to v5 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fce5b5ed00d9..855b5863f212 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -91,7 +91,7 @@ buildParameters = { id = "org.gradlex.build-parameters", version = "1.4.4" } commonCustomUserData = { id = "com.gradle.common-custom-user-data-gradle-plugin", version = "2.0.2" } develocity = { id = "com.gradle.develocity", version = "3.18.2" } foojayResolver = { id = "org.gradle.toolchains.foojay-resolver", version = "0.9.0" } -gitPublish = { id = "org.ajoberstar.git-publish", version = "4.2.2" } +gitPublish = { id = "org.ajoberstar.git-publish", version = "5.1.0" } jmh = { id = "me.champeau.jmh", version = "0.7.2" } nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" } plantuml = { id = "io.freefair.plantuml", version = "8.11" } From 378cdd5adde25ed339f284c22427b0ed13ea39dc Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 11 Dec 2024 09:29:06 +0100 Subject: [PATCH 396/611] Inject username and password via new DSL --- .github/workflows/main.yml | 3 ++- documentation/documentation.gradle.kts | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fc31f3803d7a..31edc16a1a1a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -127,4 +127,5 @@ jobs: gitPublishPush \ -Dscan.tag.Documentation env: - GRGIT_USER: ${{ secrets.GH_TOKEN }} + GIT_USERNAME: git + GIT_PASSWORD: ${{ secrets.GH_TOKEN }} diff --git a/documentation/documentation.gradle.kts b/documentation/documentation.gradle.kts index c19537403b9c..9520c20636b0 100644 --- a/documentation/documentation.gradle.kts +++ b/documentation/documentation.gradle.kts @@ -109,6 +109,9 @@ gitPublish { sign = false fetchDepth = 1 + username = providers.environmentVariable("GIT_USERNAME") + password = providers.environmentVariable("GIT_PASSWORD") + contents { from(docsDir) into("docs") From 4f294732024fdd4fc70ae14b5236c7f9fa237202 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 11 Dec 2024 09:29:52 +0100 Subject: [PATCH 397/611] Set reference repo URI --- documentation/documentation.gradle.kts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/documentation/documentation.gradle.kts b/documentation/documentation.gradle.kts index 9520c20636b0..761231335196 100644 --- a/documentation/documentation.gradle.kts +++ b/documentation/documentation.gradle.kts @@ -105,6 +105,8 @@ val apiGuardianDocVersion = if (libs.versions.apiguardian.get().contains("SNAPSH gitPublish { repoUri = "https://github.com/junit-team/junit5.git" + referenceRepoUri = rootDir.toURI().toString() + branch = "gh-pages" sign = false fetchDepth = 1 From dab4e51058fd9083bffe5e6352b7264236fc2a2f Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 11 Dec 2024 09:30:33 +0100 Subject: [PATCH 398/611] Configure Git username and email --- .github/workflows/main.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 31edc16a1a1a..411807b2c24f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -118,6 +118,11 @@ jobs: arguments: | prepareDocsForUploadToGhPages \ -Dscan.tag.Documentation + - name: Configure Git + shell: bash + run: | + git config --global user.name "JUnit Team" + git config --global user.email "team@junit.org" - name: Upload Documentation if: github.event_name == 'push' && github.repository == 'junit-team/junit5' && github.ref == 'refs/heads/main' uses: ./.github/actions/run-gradle From 6a4cb0643b7d49dccbebaba8a7935331e4023022 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 11 Dec 2024 16:46:47 +0100 Subject: [PATCH 399/611] Ensure the XMLStreamWriter is closed after use Co-authored-by: Christian Stein --- .../platform/reporting/legacy/xml/XmlReportWriter.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/XmlReportWriter.java b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/XmlReportWriter.java index b9d7ea13aff3..4ea8c2f8f6ac 100644 --- a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/XmlReportWriter.java +++ b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/XmlReportWriter.java @@ -115,10 +115,12 @@ private boolean shouldInclude(TestPlan testPlan, TestIdentifier testIdentifier) private void writeXmlReport(TestIdentifier testIdentifier, Map tests, Writer out) throws XMLStreamException { - new XmlReport(out).write(testIdentifier, tests); + try (XmlReport report = new XmlReport(out)) { + report.write(testIdentifier, tests); + } } - class XmlReport implements AutoCloseable { + private class XmlReport implements AutoCloseable { private final XMLStreamWriter xml; private final ReplacingWriter out; From 5a42e1203c18a9ea33cd0ede252dd891d2fe560d Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 11 Dec 2024 16:51:02 +0100 Subject: [PATCH 400/611] Revert to Spotless 6.25.0 to attempt to fix build on CI --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 855b5863f212..4990a14b4b31 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -96,5 +96,5 @@ jmh = { id = "me.champeau.jmh", version = "0.7.2" } nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" } plantuml = { id = "io.freefair.plantuml", version = "8.11" } shadow = { id = "com.gradleup.shadow", version = "8.3.5" } -spotless = { id = "com.diffplug.spotless", version = "7.0.0.BETA2" } +spotless = { id = "com.diffplug.spotless", version = "6.25.0" } versions = { id = "com.github.ben-manes.versions", version = "0.51.0" } From d7e765caa23f76cc68c29a674ec6457d6eaa2680 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 11 Dec 2024 16:58:21 +0100 Subject: [PATCH 401/611] Move #4153 to 5.11.4 release notes --- .../src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc | 2 ++ .../docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc index ce1fd83e14c4..1c333742dabd 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc @@ -20,6 +20,8 @@ JUnit repository on GitHub. exception messages) in the legacy XML report generated by the Console Launcher. This change ensures the resulting XML files can be processed by downstream tools while preserving whitespace characters. +* Enable auto-flushing of output in the `ConsoleLauncher` to fix issues with buffering, + in particular when using the `--details=testfeed` option. [[release-notes-5.11.4-junit-platform-deprecations-and-breaking-changes]] ==== Deprecations and Breaking Changes diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 6794f04a77c5..b0f1d88d8ae6 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -16,8 +16,7 @@ JUnit repository on GitHub. [[release-notes-5.12.0-M1-junit-platform-bug-fixes]] ==== Bug Fixes -* Enable auto-flushing of output in the `ConsoleLauncher` to fix issues with buffering, - in particular when using the `--details=testfeed` option. +* ❓ [[release-notes-5.12.0-M1-junit-platform-deprecations-and-breaking-changes]] ==== Deprecations and Breaking Changes From 7f4361d58452eab68dd452cf4ced6c7598f02d28 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 12 Dec 2024 08:45:31 +0100 Subject: [PATCH 402/611] Finalize 5.11.4 release notes --- .../release-notes/release-notes-5.11.4.adoc | 39 ++----------------- 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc index 1c333742dabd..b5100622d81e 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc @@ -1,9 +1,9 @@ [[release-notes-5.11.4]] == 5.11.4 -*Date of Release:* ❓ +*Date of Release:* December 13, 2024 -*Scope:* ❓ +*Scope:* Bug fixes and enhancements since 5.11.3 For a complete list of all _closed_ issues and pull requests for this release, consult the link:{junit5-repo}+/milestone/86?closed=1+[5.11.4] milestone page in the @@ -23,30 +23,10 @@ JUnit repository on GitHub. * Enable auto-flushing of output in the `ConsoleLauncher` to fix issues with buffering, in particular when using the `--details=testfeed` option. -[[release-notes-5.11.4-junit-platform-deprecations-and-breaking-changes]] -==== Deprecations and Breaking Changes - -* ❓ - -[[release-notes-5.11.4-junit-platform-new-features-and-improvements]] -==== New Features and Improvements - -* ❓ - [[release-notes-5.11.4-junit-jupiter]] === JUnit Jupiter -[[release-notes-5.11.4-junit-jupiter-bug-fixes]] -==== Bug Fixes - -* ❓ - -[[release-notes-5.11.4-junit-jupiter-deprecations-and-breaking-changes]] -==== Deprecations and Breaking Changes - -* ❓ - [[release-notes-5.11.4-junit-jupiter-new-features-and-improvements]] ==== New Features and Improvements @@ -56,17 +36,4 @@ JUnit repository on GitHub. [[release-notes-5.11.4-junit-vintage]] === JUnit Vintage -[[release-notes-5.11.4-junit-vintage-bug-fixes]] -==== Bug Fixes - -* ❓ - -[[release-notes-5.11.4-junit-vintage-deprecations-and-breaking-changes]] -==== Deprecations and Breaking Changes - -* ❓ - -[[release-notes-5.11.4-junit-vintage-new-features-and-improvements]] -==== New Features and Improvements - -* ❓ +No changes. From bf0c912b83182c67aa3038eb8e070a0b4c238dce Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 18:00:10 +0000 Subject: [PATCH 403/611] Update plugin develocity to v3.19 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4990a14b4b31..19d93d9d3618 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -89,7 +89,7 @@ asciidoctorPdf = { id = "org.asciidoctor.jvm.pdf", version.ref = "asciidoctor-pl bnd = { id = "biz.aQute.bnd", version.ref = "bnd" } buildParameters = { id = "org.gradlex.build-parameters", version = "1.4.4" } commonCustomUserData = { id = "com.gradle.common-custom-user-data-gradle-plugin", version = "2.0.2" } -develocity = { id = "com.gradle.develocity", version = "3.18.2" } +develocity = { id = "com.gradle.develocity", version = "3.19" } foojayResolver = { id = "org.gradle.toolchains.foojay-resolver", version = "0.9.0" } gitPublish = { id = "org.ajoberstar.git-publish", version = "5.1.0" } jmh = { id = "me.champeau.jmh", version = "0.7.2" } From 29f88c11647c374d7420d0771afd33275e424938 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 13 Dec 2024 07:30:13 +0000 Subject: [PATCH 404/611] Update dependency com.puppycrawl.tools:checkstyle to v10.21.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 19d93d9d3618..f66cb31ed329 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ asciidoctorj-pdf = "2.3.19" asciidoctor-plugins = "4.0.3" # Check if workaround in documentation.gradle.kts can be removed when upgrading assertj = "3.26.3" bnd = "7.1.0" -checkstyle = "10.20.2" +checkstyle = "10.21.0" eclipse = "4.34.0" jackson = "2.18.2" jacoco = "0.8.12" From 1b4dce527c541e0e6a2dca26ccce588436ad74dd Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 13 Dec 2024 09:16:26 +0000 Subject: [PATCH 405/611] Update github/codeql-action digest to df409f7 --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/ossf-scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index dcd7458dab05..95a8e40797b4 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -34,7 +34,7 @@ jobs: - name: Check out repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Initialize CodeQL - uses: github/codeql-action/init@babb554ede22fd5605947329c4d04d8e7a0b8155 # v3 + uses: github/codeql-action/init@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3 with: languages: ${{ matrix.language }} tools: linked @@ -47,4 +47,4 @@ jobs: -Dscan.tag.CodeQL \ allMainClasses - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@babb554ede22fd5605947329c4d04d8e7a0b8155 # v3 + uses: github/codeql-action/analyze@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3 diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index b8ce6c88eb3c..129666f0d4bd 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard (optional). # Commenting out will disable upload of results to your repo's Code Scanning dashboard - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@babb554ede22fd5605947329c4d04d8e7a0b8155 # v3 + uses: github/codeql-action/upload-sarif@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3 with: sarif_file: results.sarif From ebf60bb8672367b07de9e3750269431dd5878c82 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 13 Dec 2024 11:01:04 +0100 Subject: [PATCH 406/611] Add comments explaining lack of contracts for `Executable` parameter Follow-up on #3259 --- .../kotlin/org/junit/jupiter/api/Assertions.kt | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/junit-jupiter-api/src/main/kotlin/org/junit/jupiter/api/Assertions.kt b/junit-jupiter-api/src/main/kotlin/org/junit/jupiter/api/Assertions.kt index 16ca2490a1c9..c6ac07dd44a0 100644 --- a/junit-jupiter-api/src/main/kotlin/org/junit/jupiter/api/Assertions.kt +++ b/junit-jupiter-api/src/main/kotlin/org/junit/jupiter/api/Assertions.kt @@ -268,6 +268,8 @@ fun assertNotNull( * @see Assertions.assertThrows */ inline fun assertThrows(executable: () -> Unit): T { + // no contract for `executable` because it is expected to throw an exception instead + // of being executed completely (see https://youtrack.jetbrains.com/issue/KT-27748) val throwable: Throwable? = try { executable() @@ -314,6 +316,8 @@ inline fun assertThrows( ): T { contract { callsInPlace(message, AT_MOST_ONCE) + // no contract for `executable` because it is expected to throw an exception instead + // of being executed completely (see https://youtrack.jetbrains.com/issue/KT-27748) } val throwable: Throwable? = @@ -499,7 +503,10 @@ fun assertTimeout( fun assertTimeoutPreemptively( timeout: Duration, executable: () -> R -): R = Assertions.assertTimeoutPreemptively(timeout, executable) +): R = + // no contract for `executable` because it might be interrupted and throw an exception + // (see https://youtrack.jetbrains.com/issue/KT-27748) + Assertions.assertTimeoutPreemptively(timeout, executable) /** * Example usage: @@ -516,7 +523,10 @@ fun assertTimeoutPreemptively( timeout: Duration, message: String, executable: () -> R -): R = Assertions.assertTimeoutPreemptively(timeout, executable, message) +): R = + // no contract for `executable` because it might be interrupted and throw an exception + // (see https://youtrack.jetbrains.com/issue/KT-27748) + Assertions.assertTimeoutPreemptively(timeout, executable, message) /** * Example usage: @@ -537,6 +547,8 @@ fun assertTimeoutPreemptively( ): R { contract { callsInPlace(message, AT_MOST_ONCE) + // no contract for `executable` because it might be interrupted and throw an exception + // (see https://youtrack.jetbrains.com/issue/KT-27748) } return Assertions.assertTimeoutPreemptively(timeout, executable, message) From 22f4f21603753b8154063f55a26ea989717a6c35 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 13 Dec 2024 12:35:30 +0100 Subject: [PATCH 407/611] Remove duplicate entry from 5.11.4 --- .../docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index b0f1d88d8ae6..18904ee1545e 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -117,7 +117,7 @@ JUnit repository on GitHub. thread dump to `System.out` prior to interrupting a test thread due to a timeout. * `TestReporter` now allows publishing files for a test method or test class which can be used to include them in test reports, such as the Open Test Reporting format. -* `JAVA_25` has been added to the `JRE` enum for use with JRE-based execution conditions. + [[release-notes-5.12.0-M1-junit-vintage]] === JUnit Vintage From dcb4f49a88a0d2414211ab0d4be78d366b186697 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 13 Dec 2024 14:44:18 +0000 Subject: [PATCH 408/611] Update log4j2 monorepo to v2.24.3 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f66cb31ed329..53037426b835 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -13,7 +13,7 @@ jmh = "1.37" junit4 = "4.13.2" junit4Min = "4.12" ktlint = "1.5.0" -log4j = "2.24.2" +log4j = "2.24.3" mockito = "5.14.2" opentest4j = "1.3.0" openTestReporting = "0.2.0-SNAPSHOT" From 779ee6854aae12baaa74b25539eaa84e8ed73fb2 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 16 Dec 2024 08:56:07 +0100 Subject: [PATCH 409/611] Report captured output using OTR's new dedicated XML element (#4199) If output capturing is enabled, captured output written to `System.out` and `System.err` is now included using OTR's new dedicated `output` element rather than as regular report entries. --- documentation/documentation.gradle.kts | 2 ++ .../release-notes-5.12.0-M1.adoc | 7 +++- .../junit-platform-reporting.adoc | 3 ++ .../junitbuild.testing-conventions.gradle.kts | 2 ++ .../xml/OpenTestReportGeneratingListener.java | 27 +++++++++++++-- ...OpenTestReportGeneratingListenerTests.java | 33 +++++++++++++++++++ .../platform-tooling-support-tests.gradle.kts | 6 ++++ 7 files changed, 77 insertions(+), 3 deletions(-) diff --git a/documentation/documentation.gradle.kts b/documentation/documentation.gradle.kts index 761231335196..e5f5fb28fdb8 100644 --- a/documentation/documentation.gradle.kts +++ b/documentation/documentation.gradle.kts @@ -158,6 +158,8 @@ tasks { args.addAll("execute") args.addAll("--scan-classpath") args.addAll("--config=junit.platform.reporting.open.xml.enabled=true") + args.addAll("--config=junit.platform.output.capture.stdout=true") + args.addAll("--config=junit.platform.output.capture.stderr=true") outputs.dir(consoleLauncherTestReportsDir) argumentProviders.add(CommandLineArgumentProvider { listOf( diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 18904ee1545e..8281d15a7315 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -41,12 +41,17 @@ JUnit repository on GitHub. allow test engines to publish/attach files to containers and tests by calling `EngineExecutionListener.fileEntryPublished(...)`. Registered `TestExecutionListeners` can then access these files by overriding the `fileEntryPublished(...)` method. -* The following improvements have been made to the open-test-reporting XML output: +* The following improvements have been made to the + <<../user-guide/index.adoc#junit-platform-reporting-open-test-reporting, Open Test Reporting>> + XML output: - Information about the Git repository, the current branch, the commit hash, and the current worktree status are now included in the XML report, if applicable. - A section containing JUnit-specific metadata about each test/container to the HTML report is now written by open-test-reporting when added to the classpath/module path - Information about published files is now included as attachments. + - If <<../user-guide/index.adoc#running-tests-capturing-output, output capturing>> is + enabled, the captured output written to `System.out` and `System.err` is now included + in the XML report. * Introduced contracts for Kotlin-specific assertion methods. diff --git a/documentation/src/docs/asciidoc/user-guide/advanced-topics/junit-platform-reporting.adoc b/documentation/src/docs/asciidoc/user-guide/advanced-topics/junit-platform-reporting.adoc index 310788bd1812..2e5b4d7369f1 100644 --- a/documentation/src/docs/asciidoc/user-guide/advanced-topics/junit-platform-reporting.adoc +++ b/documentation/src/docs/asciidoc/user-guide/advanced-topics/junit-platform-reporting.adoc @@ -44,6 +44,9 @@ The listener is auto-registered and can be configured via the following If enabled, the listener creates an XML report file named `open-test-report.xml` in the configured <>. +If <> is enabled, the captured output +written to `System.out` and `System.err` will be included in the report as well. + TIP: The {OpenTestReportingCliTool} can be used to convert from the event-based format to the hierarchical format which is more human-readable. diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts index f4834d0549aa..5ec321f5f5d4 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.testing-conventions.gradle.kts @@ -129,6 +129,8 @@ tasks.withType().configureEach { "-Djunit.platform.reporting.output.dir=${reports.junitXml.outputLocation.get().asFile.absolutePath}/junit-{uniqueNumber}", ) } + systemProperty("junit.platform.output.capture.stdout", "true") + systemProperty("junit.platform.output.capture.stderr", "true") jvmArgumentProviders += objects.newInstance(JavaAgentArgumentProvider::class).apply { classpath.from(javaAgentClasspath) diff --git a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java index ba18a68c128b..82be764786fd 100644 --- a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java +++ b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java @@ -12,6 +12,8 @@ import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.junit.platform.commons.util.StringUtils.isNotBlank; +import static org.junit.platform.launcher.LauncherConstants.STDERR_REPORT_ENTRY_KEY; +import static org.junit.platform.launcher.LauncherConstants.STDOUT_REPORT_ENTRY_KEY; import static org.junit.platform.reporting.open.xml.JUnitFactory.legacyReportingName; import static org.junit.platform.reporting.open.xml.JUnitFactory.type; import static org.junit.platform.reporting.open.xml.JUnitFactory.uniqueId; @@ -25,6 +27,7 @@ import static org.opentest4j.reporting.events.core.CoreFactory.infrastructure; import static org.opentest4j.reporting.events.core.CoreFactory.metadata; import static org.opentest4j.reporting.events.core.CoreFactory.operatingSystem; +import static org.opentest4j.reporting.events.core.CoreFactory.output; import static org.opentest4j.reporting.events.core.CoreFactory.reason; import static org.opentest4j.reporting.events.core.CoreFactory.result; import static org.opentest4j.reporting.events.core.CoreFactory.sources; @@ -60,6 +63,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.time.Instant; +import java.time.LocalDateTime; import java.util.Map; import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; @@ -90,6 +94,7 @@ import org.junit.platform.launcher.TestPlan; import org.opentest4j.reporting.events.api.DocumentWriter; import org.opentest4j.reporting.events.api.NamespaceRegistry; +import org.opentest4j.reporting.events.core.Attachments; import org.opentest4j.reporting.events.core.Infrastructure; import org.opentest4j.reporting.events.core.Result; import org.opentest4j.reporting.events.core.Sources; @@ -345,8 +350,26 @@ public void reportingEntryPublished(TestIdentifier testIdentifier, ReportEntry e String id = inProgressIds.get(testIdentifier.getUniqueIdObject()); eventsFileWriter.append(reported(id, Instant.now()), // reported -> reported.append(attachments(), // - attachments -> attachments.append(data(entry.getTimestamp()), // - data -> entry.getKeyValuePairs().forEach(data::addEntry)))); + attachments -> { + Map keyValuePairs = entry.getKeyValuePairs(); + if (keyValuePairs.containsKey(STDOUT_REPORT_ENTRY_KEY) + || keyValuePairs.containsKey(STDERR_REPORT_ENTRY_KEY)) { + attachOutput(attachments, entry.getTimestamp(), keyValuePairs.get(STDOUT_REPORT_ENTRY_KEY), + "stdout"); + attachOutput(attachments, entry.getTimestamp(), keyValuePairs.get(STDERR_REPORT_ENTRY_KEY), + "stderr"); + } + else { + attachments.append(data(entry.getTimestamp()), // + data -> keyValuePairs.forEach(data::addEntry)); + } + })); + } + + private static void attachOutput(Attachments attachments, LocalDateTime timestamp, String content, String source) { + if (content != null) { + attachments.append(output(timestamp), output -> output.withSource(source).withContent(content)); + } } @Override diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java index 4d1f9ebda5c5..b0efc6a5318e 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java @@ -16,6 +16,8 @@ import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assumptions.assumeTrue; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId; +import static org.junit.platform.launcher.LauncherConstants.CAPTURE_STDERR_PROPERTY_NAME; +import static org.junit.platform.launcher.LauncherConstants.CAPTURE_STDOUT_PROPERTY_NAME; import static org.junit.platform.launcher.LauncherConstants.OUTPUT_DIR_PROPERTY_NAME; import static org.junit.platform.launcher.LauncherConstants.OUTPUT_DIR_UNIQUE_NUMBER_PLACEHOLDER; import static org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.request; @@ -23,11 +25,14 @@ import static org.junit.platform.reporting.open.xml.OpenTestReportGeneratingListener.ENABLED_PROPERTY_NAME; import static org.junit.platform.reporting.testutil.FileUtils.findPath; +import java.io.PrintStream; import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; import java.util.Map; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; @@ -51,12 +56,32 @@ */ public class OpenTestReportGeneratingListenerTests { + private PrintStream originalOut; + private PrintStream originalErr; + + @BeforeEach + void wrapSystemPrintStreams() { + // Work around nesting check in org.junit.platform.launcher.core.StreamInterceptor + originalOut = System.out; + System.setOut(new PrintStream(System.out)); + originalErr = System.err; + System.setErr(new PrintStream(System.err)); + } + + @AfterEach + void restoreSystemPrintStreams() { + System.setOut(originalOut); + System.setErr(originalErr); + } + @Test void writesValidXmlReport(@TempDir Path tempDirectory) throws Exception { var engine = new DemoHierarchicalTestEngine("dummy"); engine.addTest("failingTest", "display<-->Name 😎", (context, descriptor) -> { var listener = context.request.getEngineExecutionListener(); listener.reportingEntryPublished(descriptor, ReportEntry.from("key", "value")); + System.out.println("Hello, stdout!"); + System.err.println("Hello, stderr!"); fail("failure message"); }); @@ -105,6 +130,12 @@ void writesValidXmlReport(@TempDir Path tempDirectory) throws Exception { + + + + + + @@ -200,6 +231,8 @@ private void executeTests(Path tempDirectory, TestEngine engine, Path outputDir) var build = request() // .selectors(selectUniqueId(UniqueId.forEngine(engine.getId()))) // .configurationParameter(ENABLED_PROPERTY_NAME, String.valueOf(true)) // + .configurationParameter(CAPTURE_STDOUT_PROPERTY_NAME, String.valueOf(true)) // + .configurationParameter(CAPTURE_STDERR_PROPERTY_NAME, String.valueOf(true)) // .configurationParameter(OUTPUT_DIR_PROPERTY_NAME, outputDir.toString()) // .build(); createLauncher(engine).execute(build, new OpenTestReportGeneratingListener(tempDirectory)); diff --git a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts index 88f991589508..9e5b70ba9ef2 100644 --- a/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts +++ b/platform-tooling-support-tests/platform-tooling-support-tests.gradle.kts @@ -165,6 +165,12 @@ tasks.test { dir("${rootDir}/documentation/src/test").withPathSensitivity(RELATIVE) } + // Disable capturing output since parallel execution is enabled and output of + // external processes happens on non-test threads which can't reliably be + // attributed to the test that started the process. + systemProperty("junit.platform.output.capture.stdout", "false") + systemProperty("junit.platform.output.capture.stderr", "false") + develocity { testDistribution { requirements.add("jdk=8") From 3997952a07380502e90ac28832ef87de8e7f7777 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 16 Dec 2024 10:15:04 +0100 Subject: [PATCH 410/611] Attribute non-test thread output to most recent test thread (#4200) When using frameworks or running external processes, test output is often written on other threads than the test. When tests are executed sequentially that output can be attributed unambiguously to the current test. If tests are run in parallel, picking the right test to attribute output to becomes much harder, though. --- .../release-notes-5.12.0-M1.adoc | 2 ++ .../launcher/core/StreamInterceptor.java | 36 +++++++++++++++---- .../launcher/core/StreamInterceptorTests.java | 34 +++++++++++++----- 3 files changed, 58 insertions(+), 14 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 8281d15a7315..90112bdc7455 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -52,6 +52,8 @@ JUnit repository on GitHub. - If <<../user-guide/index.adoc#running-tests-capturing-output, output capturing>> is enabled, the captured output written to `System.out` and `System.err` is now included in the XML report. +* Output written to `System.out` and `System.err` from non-test threads is now attributed + to the most recent test or container that was started or has written output. * Introduced contracts for Kotlin-specific assertion methods. diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/StreamInterceptor.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/StreamInterceptor.java index b34fd72c1a15..1fbfe7ae81d2 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/StreamInterceptor.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/StreamInterceptor.java @@ -15,6 +15,7 @@ import java.util.ArrayDeque; import java.util.Deque; import java.util.Optional; +import java.util.concurrent.ConcurrentLinkedDeque; import java.util.function.Consumer; /** @@ -22,6 +23,8 @@ */ class StreamInterceptor extends PrintStream { + private final Deque mostRecentOutputs = new ConcurrentLinkedDeque<>(); + private final PrintStream originalStream; private final Consumer unregisterAction; private final int maxNumberOfBytesPerThread; @@ -56,11 +59,18 @@ private StreamInterceptor(PrintStream originalStream, Consumer unre } void capture() { - output.get().mark(); + RewindableByteArrayOutputStream out = output.get(); + out.mark(); + pushToTop(out); } String consume() { - return output.get().rewind(); + RewindableByteArrayOutputStream out = output.get(); + String result = out.rewind(); + if (!out.isMarked()) { + mostRecentOutputs.remove(out); + } + return result; } void unregister() { @@ -69,8 +79,9 @@ void unregister() { @Override public void write(int b) { - RewindableByteArrayOutputStream out = output.get(); - if (out.isMarked() && out.size() < maxNumberOfBytesPerThread) { + RewindableByteArrayOutputStream out = getOutput(); + if (out != null && out.size() < maxNumberOfBytesPerThread) { + pushToTop(out); out.write(b); } super.write(b); @@ -83,16 +94,29 @@ public void write(byte[] b) { @Override public void write(byte[] buf, int off, int len) { - RewindableByteArrayOutputStream out = output.get(); - if (out.isMarked()) { + RewindableByteArrayOutputStream out = getOutput(); + if (out != null) { int actualLength = Math.max(0, Math.min(len, maxNumberOfBytesPerThread - out.size())); if (actualLength > 0) { + pushToTop(out); out.write(buf, off, actualLength); } } super.write(buf, off, len); } + private void pushToTop(RewindableByteArrayOutputStream out) { + if (!out.equals(mostRecentOutputs.peek())) { + mostRecentOutputs.remove(out); + mostRecentOutputs.push(out); + } + } + + private RewindableByteArrayOutputStream getOutput() { + RewindableByteArrayOutputStream out = output.get(); + return out.isMarked() ? out : mostRecentOutputs.peek(); + } + static class RewindableByteArrayOutputStream extends ByteArrayOutputStream { private final Deque markedPositions = new ArrayDeque<>(); diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/StreamInterceptorTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/StreamInterceptorTests.java index d524f5b7d283..04b00edb441f 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/StreamInterceptorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/StreamInterceptorTests.java @@ -20,6 +20,7 @@ import java.io.PrintStream; import java.util.stream.IntStream; +import org.junit.jupiter.api.AutoClose; import org.junit.jupiter.api.Test; /** @@ -27,17 +28,19 @@ */ class StreamInterceptorTests { - private ByteArrayOutputStream originalOut = new ByteArrayOutputStream(); - private PrintStream targetStream = new PrintStream(originalOut); + final ByteArrayOutputStream originalOut = new ByteArrayOutputStream(); + PrintStream targetStream = new PrintStream(originalOut); + + @AutoClose + StreamInterceptor streamInterceptor; @Test void interceptsWriteOperationsToStreamPerThread() { - var streamInterceptor = StreamInterceptor.register(targetStream, newStream -> this.targetStream = newStream, + streamInterceptor = StreamInterceptor.register(targetStream, newStream -> this.targetStream = newStream, 3).orElseThrow(RuntimeException::new); // @formatter:off IntStream.range(0, 1000) .parallel() - .peek(i -> targetStream.println(i)) .mapToObj(String::valueOf) .peek(i -> streamInterceptor.capture()) .peek(i -> targetStream.println(i)) @@ -49,7 +52,7 @@ void interceptsWriteOperationsToStreamPerThread() { void unregisterRestoresOriginalStream() { var originalStream = targetStream; - var streamInterceptor = StreamInterceptor.register(targetStream, newStream -> this.targetStream = newStream, + streamInterceptor = StreamInterceptor.register(targetStream, newStream -> this.targetStream = newStream, 3).orElseThrow(RuntimeException::new); assertSame(streamInterceptor, targetStream); @@ -61,8 +64,8 @@ void unregisterRestoresOriginalStream() { void writeForwardsOperationsToOriginalStream() throws IOException { var originalStream = targetStream; - StreamInterceptor.register(targetStream, newStream -> this.targetStream = newStream, 2).orElseThrow( - RuntimeException::new); + streamInterceptor = StreamInterceptor.register(targetStream, newStream -> this.targetStream = newStream, + 2).orElseThrow(RuntimeException::new); assertNotSame(originalStream, targetStream); targetStream.write('a'); @@ -73,7 +76,7 @@ void writeForwardsOperationsToOriginalStream() throws IOException { @Test void handlesNestedCaptures() { - var streamInterceptor = StreamInterceptor.register(targetStream, newStream -> this.targetStream = newStream, + streamInterceptor = StreamInterceptor.register(targetStream, newStream -> this.targetStream = newStream, 100).orElseThrow(RuntimeException::new); String outermost, inner, innermost; @@ -100,4 +103,19 @@ void handlesNestedCaptures() { () -> assertEquals("innermost", innermost) // ); } + + @Test + void capturesOutputFromNonTestThreads() throws Exception { + streamInterceptor = StreamInterceptor.register(targetStream, newStream -> this.targetStream = newStream, + 100).orElseThrow(RuntimeException::new); + + streamInterceptor.capture(); + var thread = new Thread(() -> { + targetStream.println("from non-test thread"); + }); + thread.start(); + thread.join(); + + assertEquals("from non-test thread", streamInterceptor.consume().trim()); + } } From 540639df3ab4f0ac90a42b0fd72492f7f9a16dfe Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 16 Dec 2024 14:07:03 +0100 Subject: [PATCH 411/611] Release 5.11.4 --- README.md | 2 +- .../src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0e0b8a716e1f..118ad40506cb 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This repository is the home of _JUnit 5_. ## Latest Releases -- General Availability (GA): [JUnit 5.11.3](https://github.com/junit-team/junit5/releases/tag/r5.11.3) (October 21, 2024) +- General Availability (GA): [JUnit 5.11.4](https://github.com/junit-team/junit5/releases/tag/r5.11.4) (December 16, 2024) - Preview (Milestone/Release Candidate): N/A ## Documentation diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc index b5100622d81e..e9ed32bc772a 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.11.4.adoc @@ -1,7 +1,7 @@ [[release-notes-5.11.4]] == 5.11.4 -*Date of Release:* December 13, 2024 +*Date of Release:* December 16, 2024 *Scope:* Bug fixes and enhancements since 5.11.3 From efa1527837d91336cf0478f3159fb6ab2862aa76 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 16 Dec 2024 15:48:36 +0100 Subject: [PATCH 412/611] Remove JDK 22 build as it's EOL --- .github/workflows/cross-version.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/cross-version.yml b/.github/workflows/cross-version.yml index 364a04fae552..fdc8adc19d5c 100644 --- a/.github/workflows/cross-version.yml +++ b/.github/workflows/cross-version.yml @@ -22,8 +22,6 @@ jobs: fail-fast: false matrix: jdk: - - version: 22 - type: ga - version: 23 type: ga - version: 24 From 16c6f72c1c728c015e35cb739ea75884f19f990c Mon Sep 17 00:00:00 2001 From: Yongjun Hong Date: Tue, 17 Dec 2024 00:00:54 +0900 Subject: [PATCH 413/611] Add include/exclude-based filtering for auto-detected extensions (#4120) Two new configuration parameters allow configured comma-separated lists of includes and excludes for auto-detected extension registration: * `junit.jupiter.extensions.autodetection.include` * `junit.jupiter.extensions.autodetection.exclude` Resolves #3717. --------- Co-authored-by: Marc Philipp --- .../docs/asciidoc/user-guide/extensions.adoc | 17 ++++ .../asciidoc/user-guide/running-tests.adoc | 1 + .../org/junit/jupiter/engine/Constants.java | 74 +++++++++++++++++ .../config/CachingJupiterConfiguration.java | 6 ++ .../config/DefaultJupiterConfiguration.java | 20 +++++ .../engine/config/JupiterConfiguration.java | 5 ++ .../extension/MutableExtensionRegistry.java | 37 ++++++++- .../junit-platform-commons.gradle.kts | 1 + .../util/ClassNamePatternFilterUtils.java | 8 +- .../commons/util/ServiceLoaderUtils.java | 55 +++++++++++++ .../commons/util/ServiceLoaderUtils.java | 56 +++++++++++++ .../launcher/core/LauncherFactory.java | 16 ++-- .../launcher/core/ServiceLoaderRegistry.java | 43 ++++++++-- .../extension/ConfigLoaderExtension.java | 28 +++++++ .../extension/ExtensionRegistryTests.java | 80 ++++++++++++++++++- .../org.junit.jupiter.api.extension.Extension | 1 + .../launcher/core/LauncherFactoryTests.java | 16 +++- .../projects/standalone/expected-err.txt | 2 +- 18 files changed, 441 insertions(+), 25 deletions(-) create mode 100644 junit-platform-commons/src/main/java/org/junit/platform/commons/util/ServiceLoaderUtils.java create mode 100644 junit-platform-commons/src/main/java9/org/junit/platform/commons/util/ServiceLoaderUtils.java create mode 100644 jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ConfigLoaderExtension.java diff --git a/documentation/src/docs/asciidoc/user-guide/extensions.adoc b/documentation/src/docs/asciidoc/user-guide/extensions.adoc index d50940991b1c..7ccbf96c4df2 100644 --- a/documentation/src/docs/asciidoc/user-guide/extensions.adoc +++ b/documentation/src/docs/asciidoc/user-guide/extensions.adoc @@ -307,6 +307,23 @@ When auto-detection is enabled, extensions discovered via the `{ServiceLoader}` will be added to the extension registry after JUnit Jupiter's global extensions (e.g., support for `TestInfo`, `TestReporter`, etc.). +[[extensions-registration-automatic-filtering]] +===== Filtering Auto-detected Extensions + +The list of auto-detected extensions can be filtered using include and exclude patterns +via the following <>: + +`junit.jupiter.extensions.autodetection.include=`:: + Comma-separated list of _include_ patterns for auto-detected extensions. +`junit.jupiter.extensions.autodetection.exclude=`:: + Comma-separated list of _exclude_ patterns for auto-detected extensions. + +Include patterns are applied _before_ exclude patterns. If both include and exclude +patterns are provided, only extensions that match at least one include pattern and do not +match any exclude pattern will be auto-detected. + +See <> for details on the pattern syntax. + [[extensions-registration-inheritance]] ==== Extension Inheritance diff --git a/documentation/src/docs/asciidoc/user-guide/running-tests.adoc b/documentation/src/docs/asciidoc/user-guide/running-tests.adoc index 734071e821cb..73c1ffc13f47 100644 --- a/documentation/src/docs/asciidoc/user-guide/running-tests.adoc +++ b/documentation/src/docs/asciidoc/user-guide/running-tests.adoc @@ -975,6 +975,7 @@ parameters_ used for the following features. - <> - <> - <> +- <> If the value for the given _configuration parameter_ consists solely of an asterisk (`+++*+++`), the pattern will match against all candidate classes. Otherwise, the value diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java index 500f55818923..204c57c350c2 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java @@ -49,6 +49,80 @@ @API(status = STABLE, since = "5.0") public final class Constants { + /** + * Property name used to include patterns for auto-detecting extensions: {@value} + * + *

    Pattern Matching Syntax

    + * + *

    If the property value consists solely of an asterisk ({@code *}), all + * extensions will be included. Otherwise, the property value will be treated + * as a comma-separated list of patterns where each individual pattern will be + * matched against the fully qualified class name (FQCN) of each extension. + * Any dot ({@code .}) in a pattern will match against a dot ({@code .}) + * or a dollar sign ({@code $}) in a FQCN. Any asterisk ({@code *}) will match + * against one or more characters in a FQCN. All other characters in a pattern + * will be matched one-to-one against a FQCN. + * + *

    Examples

    + * + *
      + *
    • {@code *}: includes all extensions. + *
    • {@code org.junit.*}: includes every extension under the {@code org.junit} + * base package and any of its subpackages. + *
    • {@code *.MyExtension}: includes every extension whose simple class name is + * exactly {@code MyExtension}. + *
    • {@code *System*}: includes every extension whose FQCN contains + * {@code System}. + *
    • {@code *System*, *Dev*}: includes every extension whose FQCN contains + * {@code System} or {@code Dev}. + *
    • {@code org.example.MyExtension, org.example.TheirExtension}: includes + * extensions whose FQCN is exactly {@code org.example.MyExtension} or + * {@code org.example.TheirExtension}. + *
    + * + *

    Note: A class that matches both an inclusion and exclusion pattern will be excluded. + * + * @see JupiterConfiguration#EXTENSIONS_AUTODETECTION_INCLUDE_PROPERTY_NAME + */ + public static final String EXTENSIONS_AUTODETECTION_INCLUDE_PROPERTY_NAME = JupiterConfiguration.EXTENSIONS_AUTODETECTION_INCLUDE_PROPERTY_NAME; + + /** + * Property name used to exclude patterns for auto-detecting extensions: {@value} + * + *

    Pattern Matching Syntax

    + * + *

    If the property value consists solely of an asterisk ({@code *}), all + * extensions will be excluded. Otherwise, the property value will be treated + * as a comma-separated list of patterns where each individual pattern will be + * matched against the fully qualified class name (FQCN) of each extension. + * Any dot ({@code .}) in a pattern will match against a dot ({@code .}) + * or a dollar sign ({@code $}) in a FQCN. Any asterisk ({@code *}) will match + * against one or more characters in a FQCN. All other characters in a pattern + * will be matched one-to-one against a FQCN. + * + *

    Examples

    + * + *
      + *
    • {@code *}: excludes all extensions. + *
    • {@code org.junit.*}: excludes every extension under the {@code org.junit} + * base package and any of its subpackages. + *
    • {@code *.MyExtension}: excludes every extension whose simple class name is + * exactly {@code MyExtension}. + *
    • {@code *System*}: excludes every extension whose FQCN contains + * {@code System}. + *
    • {@code *System*, *Dev*}: excludes every extension whose FQCN contains + * {@code System} or {@code Dev}. + *
    • {@code org.example.MyExtension, org.example.TheirExtension}: excludes + * extensions whose FQCN is exactly {@code org.example.MyExtension} or + * {@code org.example.TheirExtension}. + *
    + * + *

    Note: A class that matches both an inclusion and exclusion pattern will be excluded. + * + * @see JupiterConfiguration#EXTENSIONS_AUTODETECTION_EXCLUDE_PROPERTY_NAME + */ + public static final String EXTENSIONS_AUTODETECTION_EXCLUDE_PROPERTY_NAME = JupiterConfiguration.EXTENSIONS_AUTODETECTION_EXCLUDE_PROPERTY_NAME; + /** * Property name used to provide patterns for deactivating conditions: {@value} * diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/CachingJupiterConfiguration.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/CachingJupiterConfiguration.java index 09a98cd3e4ef..c0c61b2aeae7 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/CachingJupiterConfiguration.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/CachingJupiterConfiguration.java @@ -26,6 +26,7 @@ import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.extension.ExecutionCondition; +import org.junit.jupiter.api.extension.Extension; import org.junit.jupiter.api.extension.TestInstantiationAwareExtension.ExtensionContextScope; import org.junit.jupiter.api.io.CleanupMode; import org.junit.jupiter.api.io.TempDirFactory; @@ -47,6 +48,11 @@ public CachingJupiterConfiguration(JupiterConfiguration delegate) { this.delegate = delegate; } + @Override + public Predicate> getFilterForAutoDetectedExtensions() { + return delegate.getFilterForAutoDetectedExtensions(); + } + @Override public Optional getRawConfigurationParameter(String key) { return delegate.getRawConfigurationParameter(key); diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/DefaultJupiterConfiguration.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/DefaultJupiterConfiguration.java index 11d4e46d0c9c..2ba7caf837d0 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/DefaultJupiterConfiguration.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/DefaultJupiterConfiguration.java @@ -26,6 +26,7 @@ import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.TestInstance.Lifecycle; import org.junit.jupiter.api.extension.ExecutionCondition; +import org.junit.jupiter.api.extension.Extension; import org.junit.jupiter.api.extension.TestInstantiationAwareExtension.ExtensionContextScope; import org.junit.jupiter.api.io.CleanupMode; import org.junit.jupiter.api.io.TempDirFactory; @@ -77,6 +78,25 @@ public DefaultJupiterConfiguration(ConfigurationParameters configurationParamete this.outputDirectoryProvider = outputDirectoryProvider; } + @Override + public Predicate> getFilterForAutoDetectedExtensions() { + String includePattern = getExtensionAutoDetectionIncludePattern(); + String excludePattern = getExtensionAutoDetectionExcludePattern(); + Predicate predicate = ClassNamePatternFilterUtils.includeMatchingClassNames(includePattern) // + .and(ClassNamePatternFilterUtils.excludeMatchingClassNames(excludePattern)); + return clazz -> predicate.test(clazz.getName()); + } + + private String getExtensionAutoDetectionIncludePattern() { + return configurationParameters.get(EXTENSIONS_AUTODETECTION_INCLUDE_PROPERTY_NAME) // + .orElse(ClassNamePatternFilterUtils.ALL_PATTERN); + } + + private String getExtensionAutoDetectionExcludePattern() { + return configurationParameters.get(EXTENSIONS_AUTODETECTION_EXCLUDE_PROPERTY_NAME) // + .orElse(ClassNamePatternFilterUtils.BLANK); + } + @Override public Optional getRawConfigurationParameter(String key) { return configurationParameters.get(key); diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java index ebfe5939e6ca..239c3d40bec3 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java @@ -23,6 +23,7 @@ import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.extension.ExecutionCondition; +import org.junit.jupiter.api.extension.Extension; import org.junit.jupiter.api.extension.PreInterruptCallback; import org.junit.jupiter.api.extension.TestInstantiationAwareExtension.ExtensionContextScope; import org.junit.jupiter.api.io.CleanupMode; @@ -37,6 +38,8 @@ @API(status = INTERNAL, since = "5.4") public interface JupiterConfiguration { + String EXTENSIONS_AUTODETECTION_INCLUDE_PROPERTY_NAME = "junit.jupiter.extensions.autodetection.include"; + String EXTENSIONS_AUTODETECTION_EXCLUDE_PROPERTY_NAME = "junit.jupiter.extensions.autodetection.exclude"; String DEACTIVATE_CONDITIONS_PATTERN_PROPERTY_NAME = "junit.jupiter.conditions.deactivate"; String PARALLEL_EXECUTION_ENABLED_PROPERTY_NAME = "junit.jupiter.execution.parallel.enabled"; String DEFAULT_EXECUTION_MODE_PROPERTY_NAME = Execution.DEFAULT_EXECUTION_MODE_PROPERTY_NAME; @@ -49,6 +52,8 @@ public interface JupiterConfiguration { String DEFAULT_TEST_CLASS_ORDER_PROPERTY_NAME = ClassOrderer.DEFAULT_ORDER_PROPERTY_NAME;; String DEFAULT_TEST_INSTANTIATION_EXTENSION_CONTEXT_SCOPE_PROPERTY_NAME = ExtensionContextScope.DEFAULT_SCOPE_PROPERTY_NAME; + Predicate> getFilterForAutoDetectedExtensions(); + Optional getRawConfigurationParameter(String key); Optional getRawConfigurationParameter(String key, Function transformer); diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/MutableExtensionRegistry.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/MutableExtensionRegistry.java index 676598c7abe0..a9c62ca7fa98 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/MutableExtensionRegistry.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/MutableExtensionRegistry.java @@ -28,6 +28,8 @@ import java.util.ServiceLoader; import java.util.Set; import java.util.function.Function; +import java.util.function.Predicate; +import java.util.stream.Collectors; import java.util.stream.Stream; import org.apiguardian.api.API; @@ -38,6 +40,7 @@ import org.junit.platform.commons.support.ReflectionSupport; import org.junit.platform.commons.util.ClassLoaderUtils; import org.junit.platform.commons.util.Preconditions; +import org.junit.platform.commons.util.ServiceLoaderUtils; /** * Default, mutable implementation of {@link ExtensionRegistry}. @@ -83,7 +86,7 @@ public static MutableExtensionRegistry createRegistryWithDefaultExtensions(Jupit extensionRegistry.registerDefaultExtension(new TempDirectory(configuration)); if (configuration.isExtensionAutoDetectionEnabled()) { - registerAutoDetectedExtensions(extensionRegistry); + registerAutoDetectedExtensions(extensionRegistry, configuration); } if (configuration.isThreadDumpOnTimeoutEnabled()) { @@ -93,9 +96,37 @@ public static MutableExtensionRegistry createRegistryWithDefaultExtensions(Jupit return extensionRegistry; } - private static void registerAutoDetectedExtensions(MutableExtensionRegistry extensionRegistry) { - ServiceLoader.load(Extension.class, ClassLoaderUtils.getDefaultClassLoader())// + private static void registerAutoDetectedExtensions(MutableExtensionRegistry extensionRegistry, + JupiterConfiguration configuration) { + + Predicate> filter = configuration.getFilterForAutoDetectedExtensions(); + List> excludedExtensions = new ArrayList<>(); + + ServiceLoader serviceLoader = ServiceLoader.load(Extension.class, + ClassLoaderUtils.getDefaultClassLoader()); + ServiceLoaderUtils.filter(serviceLoader, clazz -> { + boolean included = filter.test(clazz); + if (!included) { + excludedExtensions.add(clazz); + } + return included; + }) // .forEach(extensionRegistry::registerAutoDetectedExtension); + + logExcludedExtensions(excludedExtensions); + } + + private static void logExcludedExtensions(List> excludedExtensions) { + if (!excludedExtensions.isEmpty()) { + // @formatter:off + List excludeExtensionNames = excludedExtensions + .stream() + .map(Class::getName) + .collect(Collectors.toList()); + // @formatter:on + logger.config(() -> String.format( + "Excluded auto-detected extensions due to configured includes/excludes: %s", excludeExtensionNames)); + } } /** diff --git a/junit-platform-commons/junit-platform-commons.gradle.kts b/junit-platform-commons/junit-platform-commons.gradle.kts index ef52ce77ab56..3465b0078020 100644 --- a/junit-platform-commons/junit-platform-commons.gradle.kts +++ b/junit-platform-commons/junit-platform-commons.gradle.kts @@ -30,6 +30,7 @@ tasks.jar { tasks.codeCoverageClassesJar { exclude("org/junit/platform/commons/util/ModuleUtils.class") exclude("org/junit/platform/commons/util/PackageNameUtils.class") + exclude("org/junit/platform/commons/util/ServiceLoaderUtils.class") } eclipse { diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClassNamePatternFilterUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClassNamePatternFilterUtils.java index f9ec3d257baa..9574477400ee 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClassNamePatternFilterUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClassNamePatternFilterUtils.java @@ -43,6 +43,8 @@ private ClassNamePatternFilterUtils() { public static final String ALL_PATTERN = "*"; + public static final String BLANK = ""; + /** * Create a {@link Predicate} that can be used to exclude (i.e., filter out) * objects of type {@code T} whose fully qualified class names match any of @@ -101,16 +103,16 @@ private static Predicate matchingClasses(String patterns, Function Predicate createPredicateFromPatterns(String patterns, Function classNameProvider, - FilterType mode) { + FilterType type) { if (ALL_PATTERN.equals(patterns)) { - return __ -> mode == FilterType.INCLUDE; + return type == FilterType.INCLUDE ? __ -> true : __ -> false; } List patternList = convertToRegularExpressions(patterns); return object -> { boolean isMatchingAnyPattern = patternList.stream().anyMatch( pattern -> pattern.matcher(classNameProvider.apply(object)).matches()); - return (mode == FilterType.INCLUDE) == isMatchingAnyPattern; + return (type == FilterType.INCLUDE) == isMatchingAnyPattern; }; } diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ServiceLoaderUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ServiceLoaderUtils.java new file mode 100644 index 000000000000..89441d68a3f1 --- /dev/null +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ServiceLoaderUtils.java @@ -0,0 +1,55 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.commons.util; + +import java.util.ServiceLoader; +import java.util.function.Predicate; +import java.util.stream.Stream; +import java.util.stream.StreamSupport; + +import org.apiguardian.api.API; + +/** + * Collection of utilities for working with {@link ServiceLoader}. + * + *

    DISCLAIMER

    + * + *

    These utilities are intended solely for usage within the JUnit framework + * itself. Any usage by external parties is not supported. + * Use at your own risk! + * + * @since 5.11 + */ +@API(status = API.Status.INTERNAL, since = "5.11") +public class ServiceLoaderUtils { + + private ServiceLoaderUtils() { + /* no-op */ + } + + /** + * Filters the supplied service loader using the supplied predicate. + * + * @param the type of the service + * @param serviceLoader the service loader to be filtered + * @param providerPredicate the predicate to filter the loaded services + * @return a stream of loaded services that match the predicate + */ + public static Stream filter(ServiceLoader serviceLoader, + Predicate> providerPredicate) { + return StreamSupport.stream(serviceLoader.spliterator(), false).filter(it -> { + @SuppressWarnings("unchecked") + Class type = (Class) it.getClass(); + return providerPredicate.test(type); + }); + } + +} diff --git a/junit-platform-commons/src/main/java9/org/junit/platform/commons/util/ServiceLoaderUtils.java b/junit-platform-commons/src/main/java9/org/junit/platform/commons/util/ServiceLoaderUtils.java new file mode 100644 index 000000000000..426658a3e2ed --- /dev/null +++ b/junit-platform-commons/src/main/java9/org/junit/platform/commons/util/ServiceLoaderUtils.java @@ -0,0 +1,56 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.commons.util; + +import java.util.ServiceLoader; +import java.util.function.Predicate; +import java.util.stream.Stream; + +import org.apiguardian.api.API; +import org.apiguardian.api.API.Status; + +/** + * Collection of utilities for working with {@link ServiceLoader}. + * + *

    DISCLAIMER

    + * + *

    These utilities are intended solely for usage within the JUnit framework + * itself. Any usage by external parties is not supported. + * Use at your own risk! + * + * @since 5.11 + */ +@API(status = Status.INTERNAL, since = "5.11") +public class ServiceLoaderUtils { + + private ServiceLoaderUtils() { + /* no-op */ + } + + /** + * Filters the supplied service loader using the supplied predicate. + * + * @param the type of the service + * @param serviceLoader the service loader to be filtered + * @param providerPredicate the predicate to filter the loaded services + * @return a stream of loaded services that match the predicate + */ + public static Stream filter(ServiceLoader serviceLoader, + Predicate> providerPredicate) { + // @formatter:off + return serviceLoader + .stream() + .filter(provider -> providerPredicate.test(provider.type())) + .map(ServiceLoader.Provider::get); + // @formatter:on + } + +} diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherFactory.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherFactory.java index a84296db623b..5feaf010ad2a 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherFactory.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherFactory.java @@ -19,8 +19,7 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Set; -import java.util.stream.Stream; -import java.util.stream.StreamSupport; +import java.util.function.Predicate; import org.apiguardian.api.API; import org.junit.platform.commons.PreconditionViolationException; @@ -198,15 +197,12 @@ private static void registerTestExecutionListeners(LauncherConfig config, Launch config.getAdditionalTestExecutionListeners().forEach(launcher::registerTestExecutionListeners); } - private static Stream loadAndFilterTestExecutionListeners( + private static Iterable loadAndFilterTestExecutionListeners( ConfigurationParameters configurationParameters) { - Iterable listeners = ServiceLoaderRegistry.load(TestExecutionListener.class); - String deactivatedListenersPattern = configurationParameters.get( - DEACTIVATE_LISTENERS_PATTERN_PROPERTY_NAME).orElse(null); - // @formatter:off - return StreamSupport.stream(listeners.spliterator(), false) - .filter(ClassNamePatternFilterUtils.excludeMatchingClasses(deactivatedListenersPattern)); - // @formatter:on + Predicate classNameFilter = configurationParameters.get(DEACTIVATE_LISTENERS_PATTERN_PROPERTY_NAME) // + .map(ClassNamePatternFilterUtils::excludeMatchingClassNames) // + .orElse(__ -> true); + return ServiceLoaderRegistry.load(TestExecutionListener.class, classNameFilter); } } diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ServiceLoaderRegistry.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ServiceLoaderRegistry.java index 83866088dcb6..9f33adc15779 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ServiceLoaderRegistry.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ServiceLoaderRegistry.java @@ -11,24 +11,55 @@ package org.junit.platform.launcher.core; import static java.util.stream.Collectors.toList; -import static java.util.stream.StreamSupport.stream; +import java.util.ArrayList; +import java.util.List; import java.util.ServiceLoader; +import java.util.function.Function; +import java.util.function.Predicate; import org.junit.platform.commons.logging.Logger; import org.junit.platform.commons.logging.LoggerFactory; import org.junit.platform.commons.util.ClassLoaderUtils; +import org.junit.platform.commons.util.ServiceLoaderUtils; /** * @since 1.8 */ class ServiceLoaderRegistry { - static Iterable load(Class serviceProviderClass) { - Iterable listeners = ServiceLoader.load(serviceProviderClass, ClassLoaderUtils.getDefaultClassLoader()); - getLogger().config(() -> "Loaded " + serviceProviderClass.getSimpleName() + " instances: " - + stream(listeners.spliterator(), false).map(Object::toString).collect(toList())); - return listeners; + static Iterable load(Class type) { + return load(type, __ -> true, instances -> logLoadedInstances(type, instances, null)); + } + + static Iterable load(@SuppressWarnings("SameParameterValue") Class type, + Predicate classNameFilter) { + List exclusions = new ArrayList<>(); + Predicate collectingClassNameFilter = className -> { + boolean included = classNameFilter.test(className); + if (!included) { + exclusions.add(className); + } + return included; + }; + return load(type, collectingClassNameFilter, instances -> logLoadedInstances(type, instances, exclusions)); + } + + private static String logLoadedInstances(Class type, List instances, List exclusions) { + String typeName = type.getSimpleName(); + if (exclusions == null) { + return String.format("Loaded %s instances: %s", typeName, instances); + } + return String.format("Loaded %s instances: %s (excluded classes: %s)", typeName, instances, exclusions); + } + + private static List load(Class type, Predicate classNameFilter, + Function, String> logMessageSupplier) { + ServiceLoader serviceLoader = ServiceLoader.load(type, ClassLoaderUtils.getDefaultClassLoader()); + Predicate> providerPredicate = clazz -> classNameFilter.test(clazz.getName()); + List instances = ServiceLoaderUtils.filter(serviceLoader, providerPredicate).collect(toList()); + getLogger().config(() -> logMessageSupplier.apply(instances)); + return instances; } private static Logger getLogger() { diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ConfigLoaderExtension.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ConfigLoaderExtension.java new file mode 100644 index 000000000000..9112e8587a7b --- /dev/null +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ConfigLoaderExtension.java @@ -0,0 +1,28 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.engine.extension; + +import org.junit.jupiter.api.extension.BeforeAllCallback; +import org.junit.jupiter.api.extension.ExtensionContext; + +/** + * Demo extension for auto-detection of extensions loaded via Java's + * {@link java.util.ServiceLoader} mechanism. + * + * @since 5.11 + */ +public class ConfigLoaderExtension implements BeforeAllCallback { + + @Override + public void beforeAll(ExtensionContext context) { + } + +} diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistryTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistryTests.java index dd1babf69f0e..06163b90377e 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistryTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistryTests.java @@ -20,6 +20,7 @@ import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.Predicate; import java.util.stream.Stream; import org.junit.jupiter.api.Test; @@ -31,6 +32,7 @@ import org.junit.jupiter.api.extension.ParameterResolver; import org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider; import org.junit.jupiter.engine.config.JupiterConfiguration; +import org.junit.platform.commons.util.ClassNamePatternFilterUtils; /** * Tests for the {@link MutableExtensionRegistry}. @@ -60,17 +62,82 @@ void newRegistryWithoutParentHasDefaultExtensions() { void newRegistryWithoutParentHasDefaultExtensionsPlusAutodetectedExtensionsLoadedViaServiceLoader() { when(configuration.isExtensionAutoDetectionEnabled()).thenReturn(true); + when(configuration.getFilterForAutoDetectedExtensions()).thenReturn(__ -> true); registry = createRegistryWithDefaultExtensions(configuration); List extensions = registry.getExtensions(Extension.class); - assertEquals(NUM_DEFAULT_EXTENSIONS + 1, extensions.size()); + assertEquals(NUM_DEFAULT_EXTENSIONS + 2, extensions.size()); + assertDefaultGlobalExtensionsAreRegistered(4); + + assertExtensionRegistered(registry, ServiceLoaderExtension.class); + assertEquals(4, countExtensions(registry, BeforeAllCallback.class)); + } + + @Test + void registryIncludesAndExcludesSpecificAutoDetectedExtensions() { + when(configuration.isExtensionAutoDetectionEnabled()).thenReturn(true); + when(configuration.getFilterForAutoDetectedExtensions()).thenReturn( + extensionFilter(ServiceLoaderExtension.class.getName(), ConfigLoaderExtension.class.getName())); + registry = createRegistryWithDefaultExtensions(configuration); + + List extensions = registry.getExtensions(Extension.class); + + assertEquals(NUM_DEFAULT_EXTENSIONS, extensions.size()); assertDefaultGlobalExtensionsAreRegistered(3); assertExtensionRegistered(registry, ServiceLoaderExtension.class); assertEquals(3, countExtensions(registry, BeforeAllCallback.class)); } + @Test + void registryIncludesAllAutoDetectedExtensionsAndExcludesNone() { + when(configuration.isExtensionAutoDetectionEnabled()).thenReturn(true); + when(configuration.getFilterForAutoDetectedExtensions()).thenReturn(extensionFilter("*", "")); + registry = createRegistryWithDefaultExtensions(configuration); + + List extensions = registry.getExtensions(Extension.class); + + assertEquals(NUM_DEFAULT_EXTENSIONS + 2, extensions.size()); + assertDefaultGlobalExtensionsAreRegistered(4); + + assertExtensionRegistered(registry, ServiceLoaderExtension.class); + assertExtensionRegistered(registry, ConfigLoaderExtension.class); + assertEquals(4, countExtensions(registry, BeforeAllCallback.class)); + } + + @Test + void registryIncludesSpecificAutoDetectedExtensionsAndExcludesAll() { + when(configuration.isExtensionAutoDetectionEnabled()).thenReturn(true); + when(configuration.getFilterForAutoDetectedExtensions()).thenReturn( + extensionFilter(ServiceLoaderExtension.class.getName(), "*")); + registry = createRegistryWithDefaultExtensions(configuration); + + List extensions = registry.getExtensions(Extension.class); + + assertEquals(NUM_CORE_EXTENSIONS, extensions.size()); + assertDefaultGlobalExtensionsAreRegistered(2); + + assertExtensionNotRegistered(registry, ServiceLoaderExtension.class); + assertEquals(2, countExtensions(registry, BeforeAllCallback.class)); + } + + @Test + void registryIncludesAndExcludesSameAutoDetectedExtension() { + when(configuration.isExtensionAutoDetectionEnabled()).thenReturn(true); + when(configuration.getFilterForAutoDetectedExtensions()).thenReturn( + extensionFilter(ServiceLoaderExtension.class.getName(), ServiceLoaderExtension.class.getName())); + registry = createRegistryWithDefaultExtensions(configuration); + + List extensions = registry.getExtensions(Extension.class); + + assertEquals(NUM_CORE_EXTENSIONS, extensions.size()); + assertDefaultGlobalExtensionsAreRegistered(2); + + assertExtensionNotRegistered(registry, ServiceLoaderExtension.class); + assertEquals(2, countExtensions(registry, BeforeAllCallback.class)); + } + @Test void registerExtensionByImplementingClass() { registry.registerExtension(MyExtension.class); @@ -156,6 +223,11 @@ private void assertExtensionRegistered(ExtensionRegistry registry, Class extensionType.getSimpleName() + " should be present"); } + private void assertExtensionNotRegistered(ExtensionRegistry registry, Class extensionType) { + assertTrue(registry.getExtensions(extensionType).isEmpty(), + () -> extensionType.getSimpleName() + " should not be present"); + } + private void assertDefaultGlobalExtensionsAreRegistered() { assertDefaultGlobalExtensionsAreRegistered(2); } @@ -176,6 +248,12 @@ private void assertDefaultGlobalExtensionsAreRegistered(long bacCount) { assertEquals(1, countExtensions(registry, InvocationInterceptor.class)); } + private static Predicate> extensionFilter(String includes, String excludes) { + var nameFilter = ClassNamePatternFilterUtils.includeMatchingClassNames(includes) // + .and(ClassNamePatternFilterUtils.excludeMatchingClassNames(excludes)); + return clazz -> nameFilter.test(clazz.getName()); + } + // ------------------------------------------------------------------------- interface MyExtensionApi extends Extension { diff --git a/jupiter-tests/src/test/resources/META-INF/services/org.junit.jupiter.api.extension.Extension b/jupiter-tests/src/test/resources/META-INF/services/org.junit.jupiter.api.extension.Extension index 758c3e555809..27a9f87d158c 100644 --- a/jupiter-tests/src/test/resources/META-INF/services/org.junit.jupiter.api.extension.Extension +++ b/jupiter-tests/src/test/resources/META-INF/services/org.junit.jupiter.api.extension.Extension @@ -1 +1,2 @@ org.junit.jupiter.engine.extension.ServiceLoaderExtension +org.junit.jupiter.engine.extension.ConfigLoaderExtension diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherFactoryTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherFactoryTests.java index ed5b7d755c68..ccdd66de0f9a 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherFactoryTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherFactoryTests.java @@ -24,11 +24,14 @@ import java.net.URL; import java.net.URLClassLoader; import java.util.concurrent.atomic.AtomicReference; +import java.util.logging.LogRecord; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.fixtures.TrackLogRecords; import org.junit.jupiter.engine.JupiterTestEngine; import org.junit.platform.commons.PreconditionViolationException; +import org.junit.platform.commons.logging.LogRecordListener; import org.junit.platform.engine.EngineDiscoveryRequest; import org.junit.platform.engine.ExecutionRequest; import org.junit.platform.engine.TestDescriptor; @@ -79,7 +82,8 @@ void testExecutionListenerIsLoadedViaServiceApi() { } @Test - void testExecutionListenersExcludedViaConfigParametersIsNotLoadedViaServiceApi() { + void testExecutionListenersExcludedViaConfigParametersIsNotLoadedViaServiceApi( + @TrackLogRecords LogRecordListener listener) { withTestServices(() -> { var value = "org.junit.*.launcher.listeners.Unused*,org.junit.*.launcher.listeners.AnotherUnused*"; withSystemProperty(DEACTIVATE_LISTENERS_PATTERN_PROPERTY_NAME, value, () -> { @@ -94,6 +98,16 @@ void testExecutionListenersExcludedViaConfigParametersIsNotLoadedViaServiceApi() launcher.execute(request().build()); + var logMessage = listener.stream(ServiceLoaderRegistry.class) // + .map(LogRecord::getMessage) // + .filter(it -> it.startsWith("Loaded TestExecutionListener instances")) // + .findAny(); + assertThat(logMessage).isPresent(); + assertThat(logMessage.get()) // + .contains("NoopTestExecutionListener@") // + .endsWith(" (excluded classes: [" + UnusedTestExecutionListener.class.getName() + ", " + + AnotherUnusedTestExecutionListener.class.getName() + "])"); + assertFalse(UnusedTestExecutionListener.called); assertFalse(AnotherUnusedTestExecutionListener.called); }); diff --git a/platform-tooling-support-tests/projects/standalone/expected-err.txt b/platform-tooling-support-tests/projects/standalone/expected-err.txt index de1899fd021a..53ca33b7f6f0 100644 --- a/platform-tooling-support-tests/projects/standalone/expected-err.txt +++ b/platform-tooling-support-tests/projects/standalone/expected-err.txt @@ -12,7 +12,7 @@ .+ org.junit.platform.launcher.core.ServiceLoaderRegistry load .+ Loaded LauncherDiscoveryListener instances: .. .+ org.junit.platform.launcher.core.ServiceLoaderRegistry load -.+ Loaded TestExecutionListener instances: .+ +.+ Loaded TestExecutionListener instances: .+ \Q(excluded classes: [])\E .+ org.junit.platform.launcher.core.ServiceLoaderTestEngineRegistry loadTestEngines .+ Discovered TestEngines: - junit-platform-suite .+ From 24881de5614807455f1fb81572842bfbca77e6e5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 07:55:47 +0000 Subject: [PATCH 414/611] Update actions/upload-artifact digest to 6f51ac0 (#4204) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/actions/main-build/action.yml | 2 +- .github/workflows/cross-version.yml | 4 ++-- .github/workflows/ossf-scorecard.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/main-build/action.yml b/.github/actions/main-build/action.yml index 3419916b5013..d4e42c6e26bd 100644 --- a/.github/actions/main-build/action.yml +++ b/.github/actions/main-build/action.yml @@ -16,7 +16,7 @@ runs: with: arguments: ${{ inputs.arguments }} encryptionKey: ${{ inputs.encryptionKey }} - - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4 + - uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4 if: ${{ always() }} with: name: Open Test Reports (${{ github.job }}) diff --git a/.github/workflows/cross-version.yml b/.github/workflows/cross-version.yml index fdc8adc19d5c..9e08baffab26 100644 --- a/.github/workflows/cross-version.yml +++ b/.github/workflows/cross-version.yml @@ -67,7 +67,7 @@ jobs: -Dscan.tag.JDK_${{ matrix.jdk.version }} \ build \ --no-configuration-cache #Disable configuration cache due to https://github.com/diffplug/spotless/issues/2318 - - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4 + - uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4 if: ${{ always() }} with: name: Open Test Reports (${{ github.job }} ${{ matrix.jdk.version }} (${{ matrix.jdk.release || matrix.jdk.type }})) @@ -109,7 +109,7 @@ jobs: -Dscan.tag.OpenJ9 \ build \ --no-configuration-cache # Disable configuration cache due to https://github.com/diffplug/spotless/issues/2318 - - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4 + - uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4 if: ${{ always() }} with: name: Open Test Reports (${{ github.job }}) diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index 129666f0d4bd..e9f84d9ab498 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -48,7 +48,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.pre.node20 + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.pre.node20 with: name: SARIF file path: results.sarif From 01d4d67a81c7bfa5bc013c9e03b3e69d59f5cce9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 07:56:19 +0000 Subject: [PATCH 415/611] Update gradle/actions digest to 0bdd871 --- .github/actions/run-gradle/action.yml | 2 +- .github/workflows/gradle-dependency-submission.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/run-gradle/action.yml b/.github/actions/run-gradle/action.yml index e845130f49ec..3d41a5801c81 100644 --- a/.github/actions/run-gradle/action.yml +++ b/.github/actions/run-gradle/action.yml @@ -17,7 +17,7 @@ runs: distribution: temurin java-version: 21 check-latest: true - - uses: gradle/actions/setup-gradle@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4 + - uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4 with: cache-encryption-key: ${{ inputs.encryptionKey }} - shell: bash diff --git a/.github/workflows/gradle-dependency-submission.yml b/.github/workflows/gradle-dependency-submission.yml index 9c31d8bcbfbd..bc0826edcd3e 100644 --- a/.github/workflows/gradle-dependency-submission.yml +++ b/.github/workflows/gradle-dependency-submission.yml @@ -25,4 +25,4 @@ jobs: java-version: 21 check-latest: true - name: Generate and submit dependency graph - uses: gradle/actions/dependency-submission@cc4fc85e6b35bafd578d5ffbc76a5518407e1af0 # v4 + uses: gradle/actions/dependency-submission@0bdd871935719febd78681f197cd39af5b6e16a6 # v4 From 5da1e6c210cd00cb22f52e259ee05876a07198ff Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 08:19:58 +0000 Subject: [PATCH 416/611] Update actions/setup-java digest to 7a6d8a8 --- .github/actions/run-gradle/action.yml | 2 +- .github/actions/setup-test-jdk/action.yml | 2 +- .github/workflows/cross-version.yml | 4 ++-- .github/workflows/gradle-dependency-submission.yml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/actions/run-gradle/action.yml b/.github/actions/run-gradle/action.yml index 3d41a5801c81..5310fd62e29b 100644 --- a/.github/actions/run-gradle/action.yml +++ b/.github/actions/run-gradle/action.yml @@ -11,7 +11,7 @@ inputs: runs: using: "composite" steps: - - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4 + - uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4 id: setup-gradle-jdk with: distribution: temurin diff --git a/.github/actions/setup-test-jdk/action.yml b/.github/actions/setup-test-jdk/action.yml index 53560ac0a016..2aeb7c4f90f4 100644 --- a/.github/actions/setup-test-jdk/action.yml +++ b/.github/actions/setup-test-jdk/action.yml @@ -8,7 +8,7 @@ inputs: runs: using: "composite" steps: - - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4 + - uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4 with: distribution: ${{ inputs.distribution }} java-version: 8 diff --git a/.github/workflows/cross-version.yml b/.github/workflows/cross-version.yml index 9e08baffab26..6f8c7d040197 100644 --- a/.github/workflows/cross-version.yml +++ b/.github/workflows/cross-version.yml @@ -49,7 +49,7 @@ jobs: version: latest - name: "Set up JDK ${{ matrix.jdk.version }} (${{ matrix.jdk.distribution || 'temurin' }})" if: matrix.jdk.type == 'ga' - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4 + uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4 with: distribution: ${{ matrix.jdk.distribution || 'temurin' }} java-version: ${{ matrix.jdk.version }} @@ -89,7 +89,7 @@ jobs: with: distribution: semeru - name: 'Set up JDK ${{ matrix.jdk }}' - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4 + uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4 with: distribution: semeru java-version: ${{ matrix.jdk }} diff --git a/.github/workflows/gradle-dependency-submission.yml b/.github/workflows/gradle-dependency-submission.yml index bc0826edcd3e..106e21fd5989 100644 --- a/.github/workflows/gradle-dependency-submission.yml +++ b/.github/workflows/gradle-dependency-submission.yml @@ -19,7 +19,7 @@ jobs: with: fetch-depth: 1 - name: Setup Java - uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4 + uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4 with: distribution: temurin java-version: 21 From 3aa0f48dd593093a38b1a90403b563a71c14620e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 20:46:11 +0000 Subject: [PATCH 417/611] Update codecov/codecov-action digest to 1e68e06 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 411807b2c24f..20bc9c761640 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,7 +39,7 @@ jobs: jacocoRootReport \ --no-configuration-cache # Disable configuration cache due to https://github.com/diffplug/spotless/issues/2318 - name: Upload to Codecov.io - uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # v5 + uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5 with: token: ${{ secrets.CODECOV_TOKEN }} From 6fb2ea39616f29a4d743e44df2db8c18ffc10137 Mon Sep 17 00:00:00 2001 From: Juliette de Rancourt Date: Thu, 19 Dec 2024 10:13:34 +0100 Subject: [PATCH 418/611] Allow third parties to provide a custom `ClasspathScanner` implementation (#4191) Resolves #3628 --------- Co-authored-by: Marc Philipp --- .../release-notes-5.12.0-M1.adoc | 2 + .../commons/function/package-info.java | 2 +- .../DefaultResource.java} | 21 +++- .../support/conversion/package-info.java | 2 +- .../commons/support/package-info.java | 2 +- .../scanning}/ClassFilter.java | 43 +++++---- .../scanning}/ClasspathFileVisitor.java | 2 +- .../scanning}/ClasspathFilters.java | 2 +- .../support/scanning/ClasspathScanner.java | 96 +++++++++++++++++++ .../scanning}/CloseablePath.java | 2 +- .../scanning/DefaultClasspathScanner.java} | 36 ++++--- .../support/scanning/package-info.java | 5 + .../commons/util/ClasspathScannerLoader.java | 47 +++++++++ .../platform/commons/util/ModuleUtils.java | 1 + .../platform/commons/util/PackageUtils.java | 2 +- .../commons/util/ReflectionUtils.java | 8 +- .../platform/commons/util/ModuleUtils.java | 7 +- .../module-info.java | 2 + .../filter/ClasspathScanningSupport.java | 2 +- .../discovery/ClassSelectorResolver.java | 19 ++-- .../engine/discovery/VintageDiscoverer.java | 2 +- .../scanning}/CloseablePathTests.java | 11 ++- .../DefaultClasspathScannerTests.java} | 58 +++++------ .../junit-platform-commons.expected.txt | 2 + .../integration/ModuleUtilsTests.java | 2 +- 25 files changed, 284 insertions(+), 94 deletions(-) rename junit-platform-commons/src/main/java/org/junit/platform/commons/{util/ClasspathResource.java => support/DefaultResource.java} (63%) rename junit-platform-commons/src/main/java/org/junit/platform/commons/{util => support/scanning}/ClassFilter.java (59%) rename junit-platform-commons/src/main/java/org/junit/platform/commons/{util => support/scanning}/ClasspathFileVisitor.java (97%) rename junit-platform-commons/src/main/java/org/junit/platform/commons/{util => support/scanning}/ClasspathFilters.java (95%) create mode 100644 junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathScanner.java rename junit-platform-commons/src/main/java/org/junit/platform/commons/{util => support/scanning}/CloseablePath.java (98%) rename junit-platform-commons/src/main/java/org/junit/platform/commons/{util/ClasspathScanner.java => support/scanning/DefaultClasspathScanner.java} (89%) create mode 100644 junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/package-info.java create mode 100644 junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathScannerLoader.java rename platform-tests/src/test/java/org/junit/platform/commons/{util => support/scanning}/CloseablePathTests.java (90%) rename platform-tests/src/test/java/org/junit/platform/commons/{util/ClasspathScannerTests.java => support/scanning/DefaultClasspathScannerTests.java} (90%) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 90112bdc7455..4b3b26d38b76 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -55,6 +55,8 @@ JUnit repository on GitHub. * Output written to `System.out` and `System.err` from non-test threads is now attributed to the most recent test or container that was started or has written output. * Introduced contracts for Kotlin-specific assertion methods. +* New public interface `ClasspathScanner` allowing third parties to provide a custom + implementation for scanning the classpath for classes and resources. [[release-notes-5.12.0-M1-junit-jupiter]] diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/function/package-info.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/function/package-info.java index 5990d37bb869..8f031faf22e0 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/function/package-info.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/function/package-info.java @@ -1,5 +1,5 @@ /** - * Maintained functional interfaces and support classes. + * Functional interfaces and support classes. */ package org.junit.platform.commons.function; diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathResource.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/DefaultResource.java similarity index 63% rename from junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathResource.java rename to junit-platform-commons/src/main/java/org/junit/platform/commons/support/DefaultResource.java index af1944cc20e4..31e1a9eb9972 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathResource.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/DefaultResource.java @@ -8,22 +8,33 @@ * https://www.eclipse.org/legal/epl-v20.html */ -package org.junit.platform.commons.util; +package org.junit.platform.commons.support; + +import static org.apiguardian.api.API.Status.INTERNAL; import java.net.URI; import java.util.Objects; -import org.junit.platform.commons.support.Resource; +import org.apiguardian.api.API; +import org.junit.platform.commons.util.Preconditions; +import org.junit.platform.commons.util.ToStringBuilder; /** + *

    DISCLAIMER

    + * + *

    These utilities are intended solely for usage within the JUnit framework + * itself. Any usage by external parties is not supported. + * Use at your own risk! + * * @since 1.11 */ -class ClasspathResource implements Resource { +@API(status = INTERNAL, since = "1.12") +public class DefaultResource implements Resource { private final String name; private final URI uri; - ClasspathResource(String name, URI uri) { + public DefaultResource(String name, URI uri) { this.name = Preconditions.notNull(name, "name must not be null"); this.uri = Preconditions.notNull(uri, "uri must not be null"); } @@ -44,7 +55,7 @@ public boolean equals(Object o) { return true; if (o == null || getClass() != o.getClass()) return false; - ClasspathResource that = (ClasspathResource) o; + DefaultResource that = (DefaultResource) o; return name.equals(that.name) && uri.equals(that.uri); } diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/package-info.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/package-info.java index e51977179941..18807d6a4e90 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/package-info.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/package-info.java @@ -1,5 +1,5 @@ /** - * Maintained conversion APIs provided by the JUnit Platform. + * Conversion APIs provided by the JUnit Platform. */ package org.junit.platform.commons.support.conversion; diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/package-info.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/package-info.java index 6e9c460116f4..fae0c2a81547 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/package-info.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/package-info.java @@ -1,5 +1,5 @@ /** - * Maintained common support APIs provided by the JUnit Platform. + * Common support APIs provided by the JUnit Platform. * *

    The purpose of this package is to provide {@code TestEngine} and * {@code Extension} authors convenient access to a subset of internal utility diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClassFilter.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClassFilter.java similarity index 59% rename from junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClassFilter.java rename to junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClassFilter.java index 8b0728213055..4e222c89f683 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClassFilter.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClassFilter.java @@ -8,30 +8,28 @@ * https://www.eclipse.org/legal/epl-v20.html */ -package org.junit.platform.commons.util; +package org.junit.platform.commons.support.scanning; -import static org.apiguardian.api.API.Status.INTERNAL; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; import java.util.function.Predicate; import org.apiguardian.api.API; +import org.junit.platform.commons.util.Preconditions; /** * Class-related predicate used by reflection utilities. * - *

    DISCLAIMER

    - * - *

    These utilities are intended solely for usage within the JUnit framework - * itself. Any usage by external parties is not supported. - * Use at your own risk! - * * @since 1.1 */ -@API(status = INTERNAL, since = "1.1") -public class ClassFilter implements Predicate> { +@API(status = EXPERIMENTAL, since = "1.12") +public class ClassFilter { /** * Create a {@link ClassFilter} instance that accepts all names but filters classes. + * + * @param classPredicate the class type predicate; never {@code null} + * @return an instance of {@code ClassFilter}; never {@code null} */ public static ClassFilter of(Predicate> classPredicate) { return of(name -> true, classPredicate); @@ -39,6 +37,10 @@ public static ClassFilter of(Predicate> classPredicate) { /** * Create a {@link ClassFilter} instance that filters by names and classes. + * + * @param namePredicate the class name predicate; never {@code null} + * @param classPredicate the class type predicate; never {@code null} + * @return an instance of {@code ClassFilter}; never {@code null} */ public static ClassFilter of(Predicate namePredicate, Predicate> classPredicate) { return new ClassFilter(namePredicate, classPredicate); @@ -53,26 +55,25 @@ private ClassFilter(Predicate namePredicate, Predicate> classPr } /** - * Test name using the stored name predicate. + * Test the given name using the stored name predicate. + * + * @param name the name to test; never {@code null} + * @return {@code true} if the input name matches the predicate, otherwise + * {@code false} */ public boolean match(String name) { return namePredicate.test(name); } /** - * Test class using the stored class predicate. + * Test the given class using the stored class predicate. + * + * @param type the type to test; never {@code null} + * @return {@code true} if the input type matches the predicate, otherwise + * {@code false} */ public boolean match(Class type) { return classPredicate.test(type); } - /** - * @implNote This implementation combines all tests stored in the predicates - * of this instance. Any new predicate must be added to this test method as - * well. - */ - @Override - public boolean test(Class type) { - return match(type.getName()) && match(type); - } } diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathFileVisitor.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathFileVisitor.java similarity index 97% rename from junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathFileVisitor.java rename to junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathFileVisitor.java index 7f2ad8195085..e29a6c11cac2 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathFileVisitor.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathFileVisitor.java @@ -8,7 +8,7 @@ * https://www.eclipse.org/legal/epl-v20.html */ -package org.junit.platform.commons.util; +package org.junit.platform.commons.support.scanning; import static java.nio.file.FileVisitResult.CONTINUE; diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathFilters.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathFilters.java similarity index 95% rename from junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathFilters.java rename to junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathFilters.java index 7ad6cd3b0682..ea461d7d6abe 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathFilters.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathFilters.java @@ -8,7 +8,7 @@ * https://www.eclipse.org/legal/epl-v20.html */ -package org.junit.platform.commons.util; +package org.junit.platform.commons.support.scanning; import java.nio.file.Path; import java.util.function.Predicate; diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathScanner.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathScanner.java new file mode 100644 index 000000000000..ed1daabf2c69 --- /dev/null +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathScanner.java @@ -0,0 +1,96 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.commons.support.scanning; + +import static org.apiguardian.api.API.Status; + +import java.net.URI; +import java.util.List; +import java.util.function.Predicate; + +import org.apiguardian.api.API; +import org.junit.platform.commons.support.Resource; + +/** + * {@code ClasspathScanner} allows to scan the classpath for classes and + * resources. + * + *

    An implementation of this interface can be registered via the + * {@link java.util.ServiceLoader ServiceLoader} mechanism. + * + * @since 1.12 + */ +@API(status = Status.EXPERIMENTAL, since = "1.12") +public interface ClasspathScanner { + + /** + * Find all {@linkplain Class classes} in the supplied classpath {@code root} + * that match the specified {@code classFilter} filter. + * + *

    The classpath scanning algorithm searches recursively in subpackages + * beginning with the root of the classpath. + * + * @param basePackageName the name of the base package in which to start + * scanning; must not be {@code null} and must be valid in terms of Java + * syntax + * @param classFilter the class type filter; never {@code null} + * @return a list of all such classes found; never {@code null} + * but potentially empty + */ + List> scanForClassesInPackage(String basePackageName, ClassFilter classFilter); + + /** + * Find all {@linkplain Class classes} in the supplied classpath {@code root} + * that match the specified {@code classFilter} filter. + * + *

    The classpath scanning algorithm searches recursively in subpackages + * beginning with the root of the classpath. + * + * @param root the URI for the classpath root in which to scan; never + * {@code null} + * @param classFilter the class type filter; never {@code null} + * @return a list of all such classes found; never {@code null} + * but potentially empty + */ + List> scanForClassesInClasspathRoot(URI root, ClassFilter classFilter); + + /** + * Find all {@linkplain Resource resources} in the supplied classpath {@code root} + * that match the specified {@code resourceFilter} predicate. + * + *

    The classpath scanning algorithm searches recursively in subpackages + * beginning with the root of the classpath. + * + * @param basePackageName the name of the base package in which to start + * scanning; must not be {@code null} and must be valid in terms of Java + * syntax + * @param resourceFilter the resource type filter; never {@code null} + * @return a list of all such resources found; never {@code null} + * but potentially empty + */ + List scanForResourcesInPackage(String basePackageName, Predicate resourceFilter); + + /** + * Find all {@linkplain Resource resources} in the supplied classpath {@code root} + * that match the specified {@code resourceFilter} predicate. + * + *

    The classpath scanning algorithm searches recursively in subpackages + * beginning with the root of the classpath. + * + * @param root the URI for the classpath root in which to scan; never + * {@code null} + * @param resourceFilter the resource type filter; never {@code null} + * @return a list of all such resources found; never {@code null} + * but potentially empty + */ + List scanForResourcesInClasspathRoot(URI root, Predicate resourceFilter); + +} diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/CloseablePath.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/CloseablePath.java similarity index 98% rename from junit-platform-commons/src/main/java/org/junit/platform/commons/util/CloseablePath.java rename to junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/CloseablePath.java index c1da5bacd819..d299a3a7a495 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/CloseablePath.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/CloseablePath.java @@ -8,7 +8,7 @@ * https://www.eclipse.org/legal/epl-v20.html */ -package org.junit.platform.commons.util; +package org.junit.platform.commons.support.scanning; import static java.util.Collections.emptyMap; diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathScanner.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/DefaultClasspathScanner.java similarity index 89% rename from junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathScanner.java rename to junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/DefaultClasspathScanner.java index 19bec125b93c..0d0c04eeee0a 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathScanner.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/DefaultClasspathScanner.java @@ -8,13 +8,14 @@ * https://www.eclipse.org/legal/epl-v20.html */ -package org.junit.platform.commons.util; +package org.junit.platform.commons.support.scanning; import static java.lang.String.format; import static java.util.Collections.emptyList; import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toList; -import static org.junit.platform.commons.util.ClasspathFilters.CLASS_FILE_SUFFIX; +import static org.apiguardian.api.API.Status.INTERNAL; +import static org.junit.platform.commons.support.scanning.ClasspathFilters.CLASS_FILE_SUFFIX; import static org.junit.platform.commons.util.StringUtils.isNotBlank; import java.io.IOException; @@ -35,11 +36,16 @@ import java.util.function.Supplier; import java.util.stream.Stream; +import org.apiguardian.api.API; import org.junit.platform.commons.PreconditionViolationException; import org.junit.platform.commons.function.Try; import org.junit.platform.commons.logging.Logger; import org.junit.platform.commons.logging.LoggerFactory; +import org.junit.platform.commons.support.DefaultResource; import org.junit.platform.commons.support.Resource; +import org.junit.platform.commons.util.PackageUtils; +import org.junit.platform.commons.util.Preconditions; +import org.junit.platform.commons.util.UnrecoverableExceptions; /** *

    DISCLAIMER

    @@ -50,9 +56,10 @@ * * @since 1.0 */ -class ClasspathScanner { +@API(status = INTERNAL, since = "1.12") +public class DefaultClasspathScanner implements ClasspathScanner { - private static final Logger logger = LoggerFactory.getLogger(ClasspathScanner.class); + private static final Logger logger = LoggerFactory.getLogger(DefaultClasspathScanner.class); private static final char CLASSPATH_RESOURCE_PATH_SEPARATOR = '/'; private static final String CLASSPATH_RESOURCE_PATH_SEPARATOR_STRING = String.valueOf( @@ -69,14 +76,15 @@ class ClasspathScanner { private final BiFunction>> loadClass; - ClasspathScanner(Supplier classLoaderSupplier, + public DefaultClasspathScanner(Supplier classLoaderSupplier, BiFunction>> loadClass) { this.classLoaderSupplier = classLoaderSupplier; this.loadClass = loadClass; } - List> scanForClassesInPackage(String basePackageName, ClassFilter classFilter) { + @Override + public List> scanForClassesInPackage(String basePackageName, ClassFilter classFilter) { Preconditions.condition( PackageUtils.DEFAULT_PACKAGE_NAME.equals(basePackageName) || isNotBlank(basePackageName), "basePackageName must not be null or blank"); @@ -87,14 +95,16 @@ List> scanForClassesInPackage(String basePackageName, ClassFilter class return findClassesForUris(roots, basePackageName, classFilter); } - List> scanForClassesInClasspathRoot(URI root, ClassFilter classFilter) { + @Override + public List> scanForClassesInClasspathRoot(URI root, ClassFilter classFilter) { Preconditions.notNull(root, "root must not be null"); Preconditions.notNull(classFilter, "classFilter must not be null"); return findClassesForUri(root, PackageUtils.DEFAULT_PACKAGE_NAME, classFilter); } - List scanForResourcesInPackage(String basePackageName, Predicate resourceFilter) { + @Override + public List scanForResourcesInPackage(String basePackageName, Predicate resourceFilter) { Preconditions.condition( PackageUtils.DEFAULT_PACKAGE_NAME.equals(basePackageName) || isNotBlank(basePackageName), "basePackageName must not be null or blank"); @@ -105,7 +115,8 @@ List scanForResourcesInPackage(String basePackageName, Predicate scanForResourcesInClasspathRoot(URI root, Predicate resourceFilter) { + @Override + public List scanForResourcesInClasspathRoot(URI root, Predicate resourceFilter) { Preconditions.notNull(root, "root must not be null"); Preconditions.notNull(resourceFilter, "resourceFilter must not be null"); @@ -188,8 +199,7 @@ private void processClassFileSafely(Path baseDir, String basePackageName, ClassF // @formatter:off loadClass.apply(fullyQualifiedClassName, getClassLoader()) .toOptional() - // Always use ".filter(classFilter)" to include future predicates. - .filter(classFilter) + .filter(classFilter::match) .ifPresent(classConsumer); // @formatter:on } @@ -208,7 +218,7 @@ private void processResourceFileSafely(Path baseDir, String basePackageName, Pre try { String fullyQualifiedResourceName = determineFullyQualifiedResourceName(baseDir, basePackageName, resourceFile); - Resource resource = new ClasspathResource(fullyQualifiedResourceName, resourceFile.toUri()); + Resource resource = new DefaultResource(fullyQualifiedResourceName, resourceFile.toUri()); if (resourceFilter.test(resource)) { resourceConsumer.accept(resource); } @@ -309,7 +319,7 @@ private List getRootUrisForPackageNameOnClassPathAndModulePath(String baseP Set uriSet = new LinkedHashSet<>(getRootUrisForPackage(basePackageName)); if (!basePackageName.isEmpty() && !basePackageName.endsWith(PACKAGE_SEPARATOR_STRING)) { getRootUrisForPackage(basePackageName + PACKAGE_SEPARATOR_STRING).stream() // - .map(ClasspathScanner::removeTrailingClasspathResourcePathSeparator) // + .map(DefaultClasspathScanner::removeTrailingClasspathResourcePathSeparator) // .forEach(uriSet::add); } return new ArrayList<>(uriSet); diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/package-info.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/package-info.java new file mode 100644 index 000000000000..769733a65aef --- /dev/null +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/package-info.java @@ -0,0 +1,5 @@ +/** + * Classpath scanning APIs provided by the JUnit Platform. + */ + +package org.junit.platform.commons.support.scanning; diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathScannerLoader.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathScannerLoader.java new file mode 100644 index 000000000000..6a2240815605 --- /dev/null +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathScannerLoader.java @@ -0,0 +1,47 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.commons.util; + +import static java.util.stream.Collectors.toList; +import static java.util.stream.StreamSupport.stream; + +import java.util.List; +import java.util.ServiceLoader; + +import org.junit.platform.commons.JUnitException; +import org.junit.platform.commons.support.scanning.ClasspathScanner; +import org.junit.platform.commons.support.scanning.DefaultClasspathScanner; + +/** + * @since 1.12 + */ +class ClasspathScannerLoader { + + static ClasspathScanner getInstance() { + ServiceLoader serviceLoader = ServiceLoader.load(ClasspathScanner.class, + ClassLoaderUtils.getDefaultClassLoader()); + + List classpathScanners = stream(serviceLoader.spliterator(), false).collect(toList()); + + if (classpathScanners.size() == 1) { + return classpathScanners.get(0); + } + + if (classpathScanners.size() > 1) { + throw new JUnitException(String.format( + "There should not be more than one ClasspathScanner implementation present on the classpath but there were %d: %s", + classpathScanners.size(), classpathScanners)); + } + + return new DefaultClasspathScanner(ClassLoaderUtils::getDefaultClassLoader, ReflectionUtils::tryToLoadClass); + } + +} diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ModuleUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ModuleUtils.java index d24b977d71eb..54da1d85af11 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ModuleUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ModuleUtils.java @@ -23,6 +23,7 @@ import org.junit.platform.commons.logging.Logger; import org.junit.platform.commons.logging.LoggerFactory; import org.junit.platform.commons.support.Resource; +import org.junit.platform.commons.support.scanning.ClassFilter; /** * Collection of utilities for working with {@code java.lang.Module} diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/PackageUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/PackageUtils.java index 6b23a5324bac..e83f42af02f4 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/PackageUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/PackageUtils.java @@ -40,7 +40,7 @@ private PackageUtils() { /* no-op */ } - static final String DEFAULT_PACKAGE_NAME = ""; + public static final String DEFAULT_PACKAGE_NAME = ""; /** * Get the package attribute for the supplied {@code type} using the diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java index 2dafd46d5344..3f8a23d2857d 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java @@ -62,7 +62,10 @@ import org.junit.platform.commons.function.Try; import org.junit.platform.commons.logging.Logger; import org.junit.platform.commons.logging.LoggerFactory; +import org.junit.platform.commons.support.DefaultResource; import org.junit.platform.commons.support.Resource; +import org.junit.platform.commons.support.scanning.ClassFilter; +import org.junit.platform.commons.support.scanning.ClasspathScanner; /** * Collection of utilities for working with the Java reflection APIs. @@ -148,8 +151,7 @@ public enum HierarchyTraversalMode { private static final Class[] EMPTY_CLASS_ARRAY = new Class[0]; - private static final ClasspathScanner classpathScanner = new ClasspathScanner( - ClassLoaderUtils::getDefaultClassLoader, ReflectionUtils::tryToLoadClass); + private static final ClasspathScanner classpathScanner = ClasspathScannerLoader.getInstance(); /** * Cache for equivalent methods on an interface implemented by the declaring class. @@ -935,7 +937,7 @@ public static Try> tryToGetResources(String classpathResourceName, List resources = Collections.list(classLoader.getResources(canonicalClasspathResourceName)); return resources.stream().map(url -> { try { - return new ClasspathResource(canonicalClasspathResourceName, url.toURI()); + return new DefaultResource(canonicalClasspathResourceName, url.toURI()); } catch (URISyntaxException e) { throw ExceptionUtils.throwAsUncheckedException(e); diff --git a/junit-platform-commons/src/main/java9/org/junit/platform/commons/util/ModuleUtils.java b/junit-platform-commons/src/main/java9/org/junit/platform/commons/util/ModuleUtils.java index f3a6bd1a5f33..fe83af684518 100644 --- a/junit-platform-commons/src/main/java9/org/junit/platform/commons/util/ModuleUtils.java +++ b/junit-platform-commons/src/main/java9/org/junit/platform/commons/util/ModuleUtils.java @@ -37,7 +37,9 @@ import org.junit.platform.commons.JUnitException; import org.junit.platform.commons.logging.Logger; import org.junit.platform.commons.logging.LoggerFactory; +import org.junit.platform.commons.support.DefaultResource; import org.junit.platform.commons.support.Resource; +import org.junit.platform.commons.support.scanning.ClassFilter; /** * Collection of utilities for working with {@code java.lang.Module} @@ -225,8 +227,7 @@ List> scan(ModuleReference reference) { .filter(name -> !name.equals("module-info")) .filter(classFilter::match) .map(this::loadClassUnchecked) - // Always use ".filter(classFilter)" to include future predicates. - .filter(classFilter) + .filter(classFilter::match) .collect(Collectors.toList()); // @formatter:on } @@ -298,7 +299,7 @@ List scan(ModuleReference reference) { private Resource loadResourceUnchecked(String binaryName) { try { URI uri = classLoader.getResource(binaryName).toURI(); - return new ClasspathResource(binaryName, uri); + return new DefaultResource(binaryName, uri); } catch (URISyntaxException e) { throw new JUnitException("Failed to load resource with name '" + binaryName + "'.", e); diff --git a/junit-platform-commons/src/module/org.junit.platform.commons/module-info.java b/junit-platform-commons/src/module/org.junit.platform.commons/module-info.java index 774684198f9f..fb3fdba07a68 100644 --- a/junit-platform-commons/src/module/org.junit.platform.commons/module-info.java +++ b/junit-platform-commons/src/module/org.junit.platform.commons/module-info.java @@ -37,6 +37,7 @@ org.junit.vintage.engine; exports org.junit.platform.commons.support; exports org.junit.platform.commons.support.conversion; + exports org.junit.platform.commons.support.scanning; exports org.junit.platform.commons.util to org.junit.jupiter.api, org.junit.jupiter.engine, @@ -52,4 +53,5 @@ org.junit.platform.suite.engine, org.junit.platform.testkit, org.junit.vintage.engine; + uses org.junit.platform.commons.support.scanning.ClasspathScanner; } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/filter/ClasspathScanningSupport.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/filter/ClasspathScanningSupport.java index e3d2b0392cb2..12361024de15 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/filter/ClasspathScanningSupport.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/filter/ClasspathScanningSupport.java @@ -18,7 +18,7 @@ import java.util.function.Predicate; import org.apiguardian.api.API; -import org.junit.platform.commons.util.ClassFilter; +import org.junit.platform.commons.support.scanning.ClassFilter; import org.junit.platform.engine.DiscoveryFilter; import org.junit.platform.engine.EngineDiscoveryRequest; import org.junit.platform.engine.discovery.ClassNameFilter; diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/ClassSelectorResolver.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/ClassSelectorResolver.java index e1bbc8834e78..8f160a2152f1 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/ClassSelectorResolver.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/ClassSelectorResolver.java @@ -18,7 +18,7 @@ import org.junit.platform.commons.JUnitException; import org.junit.platform.commons.support.ReflectionSupport; -import org.junit.platform.commons.util.ClassFilter; +import org.junit.platform.commons.support.scanning.ClassFilter; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.UniqueId; import org.junit.platform.engine.UniqueId.Segment; @@ -43,7 +43,10 @@ class ClassSelectorResolver implements SelectorResolver { @Override public Resolution resolve(ClassSelector selector, Context context) { - return resolveTestClass(selector.getJavaClass(), context); + if (classFilter.match(selector.getClassName())) { + return resolveTestClassThatPassedNameFilter(selector.getJavaClass(), context); + } + return unresolved(); } @Override @@ -51,15 +54,17 @@ public Resolution resolve(UniqueIdSelector selector, Context context) { Segment lastSegment = selector.getUniqueId().getLastSegment(); if (SEGMENT_TYPE_RUNNER.equals(lastSegment.getType())) { String testClassName = lastSegment.getValue(); - Class testClass = ReflectionSupport.tryToLoadClass(testClassName)// - .getOrThrow(cause -> new JUnitException("Unknown class: " + testClassName, cause)); - return resolveTestClass(testClass, context); + if (classFilter.match(testClassName)) { + Class testClass = ReflectionSupport.tryToLoadClass(testClassName)// + .getOrThrow(cause -> new JUnitException("Unknown class: " + testClassName, cause)); + return resolveTestClassThatPassedNameFilter(testClass, context); + } } return unresolved(); } - private Resolution resolveTestClass(Class testClass, Context context) { - if (!classFilter.test(testClass)) { + private Resolution resolveTestClassThatPassedNameFilter(Class testClass, Context context) { + if (!classFilter.match(testClass)) { return unresolved(); } Runner runner = RUNNER_BUILDER.safeRunnerForClass(testClass); diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/VintageDiscoverer.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/VintageDiscoverer.java index a8868df3abd4..ce67578616e6 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/VintageDiscoverer.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/VintageDiscoverer.java @@ -13,7 +13,7 @@ import static org.apiguardian.api.API.Status.INTERNAL; import org.apiguardian.api.API; -import org.junit.platform.commons.util.ClassFilter; +import org.junit.platform.commons.support.scanning.ClassFilter; import org.junit.platform.engine.EngineDiscoveryRequest; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.UniqueId; diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/CloseablePathTests.java b/platform-tests/src/test/java/org/junit/platform/commons/support/scanning/CloseablePathTests.java similarity index 90% rename from platform-tests/src/test/java/org/junit/platform/commons/util/CloseablePathTests.java rename to platform-tests/src/test/java/org/junit/platform/commons/support/scanning/CloseablePathTests.java index 512eefeb41ec..ecac16c34c01 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/CloseablePathTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/support/scanning/CloseablePathTests.java @@ -8,12 +8,11 @@ * https://www.eclipse.org/legal/epl-v20.html */ -package org.junit.platform.commons.util; +package org.junit.platform.commons.support.scanning; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.platform.commons.test.ConcurrencyTestingUtils.executeConcurrently; -import static org.junit.platform.commons.util.CloseablePath.JAR_URI_SCHEME; +import static org.junit.platform.commons.support.scanning.CloseablePath.JAR_URI_SCHEME; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.only; @@ -32,7 +31,8 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.platform.commons.util.CloseablePath.FileSystemProvider; +import org.junit.platform.commons.support.scanning.CloseablePath.FileSystemProvider; +import org.junit.platform.commons.test.ConcurrencyTestingUtils; import org.junit.platform.engine.support.hierarchical.OpenTest4JAwareThrowableCollector; class CloseablePathTests { @@ -92,7 +92,8 @@ void createsAndClosesJarFileSystemOnceWhenCalledConcurrently() throws Exception when(fileSystemProvider.newFileSystem(any())) // .thenAnswer(invocation -> FileSystems.newFileSystem((URI) invocation.getArgument(0), Map.of())); - paths = executeConcurrently(numThreads, () -> CloseablePath.create(uri, fileSystemProvider)); + paths = ConcurrencyTestingUtils.executeConcurrently(numThreads, + () -> CloseablePath.create(uri, fileSystemProvider)); verify(fileSystemProvider, only()).newFileSystem(jarUri); // Close all but the first path diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/ClasspathScannerTests.java b/platform-tests/src/test/java/org/junit/platform/commons/support/scanning/DefaultClasspathScannerTests.java similarity index 90% rename from platform-tests/src/test/java/org/junit/platform/commons/util/ClasspathScannerTests.java rename to platform-tests/src/test/java/org/junit/platform/commons/support/scanning/DefaultClasspathScannerTests.java index 7cd2f31456b4..1bcd92ce8b11 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/ClasspathScannerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/support/scanning/DefaultClasspathScannerTests.java @@ -8,7 +8,7 @@ * https://www.eclipse.org/legal/epl-v20.html */ -package org.junit.platform.commons.util; +package org.junit.platform.commons.support.scanning; import static java.util.Objects.requireNonNull; import static org.assertj.core.api.Assertions.assertThat; @@ -50,14 +50,16 @@ import org.junit.platform.commons.function.Try; import org.junit.platform.commons.logging.LogRecordListener; import org.junit.platform.commons.support.Resource; +import org.junit.platform.commons.util.ClassLoaderUtils; +import org.junit.platform.commons.util.ReflectionUtils; /** - * Unit tests for {@link ClasspathScanner}. + * Unit tests for {@link DefaultClasspathScanner}. * * @since 1.0 */ @TrackLogRecords -class ClasspathScannerTests { +class DefaultClasspathScannerTests { private static final ClassFilter allClasses = ClassFilter.of(type -> true); private static final Predicate allResources = type -> true; @@ -67,8 +69,8 @@ class ClasspathScannerTests { private final BiFunction>> trackingClassLoader = (name, classLoader) -> ReflectionUtils.tryToLoadClass(name, classLoader).ifSuccess(loadedClasses::add); - private final ClasspathScanner classpathScanner = new ClasspathScanner(ClassLoaderUtils::getDefaultClassLoader, - trackingClassLoader); + private final DefaultClasspathScanner classpathScanner = new DefaultClasspathScanner( + ClassLoaderUtils::getDefaultClassLoader, trackingClassLoader); @Test void scanForClassesInClasspathRootWhenMalformedClassnameInternalErrorOccursWithNullDetailedMessage( @@ -152,7 +154,7 @@ private void assertResourcesScannedWhenExceptionIsThrown(Predicate fil private void assertDebugMessageLogged(LogRecordListener listener, String regex) { // @formatter:off - assertThat(listener.stream(ClasspathScanner.class, Level.FINE) + assertThat(listener.stream(DefaultClasspathScanner.class, Level.FINE) .map(LogRecord::getMessage) .filter(m -> m.matches(regex)) ).hasSize(1); @@ -187,7 +189,7 @@ private void scanForClassesInClasspathRootWithinJarFile(String resourceName) thr var jarfile = getClass().getResource(resourceName); try (var classLoader = new URLClassLoader(new URL[] { jarfile }, null)) { - var classpathScanner = new ClasspathScanner(() -> classLoader, ReflectionUtils::tryToLoadClass); + var classpathScanner = new DefaultClasspathScanner(() -> classLoader, ReflectionUtils::tryToLoadClass); var classes = classpathScanner.scanForClassesInClasspathRoot(jarfile.toURI(), allClasses); assertThat(classes).extracting(Class::getName) // @@ -211,7 +213,7 @@ private void scanForResourcesInClasspathRootWithinJarFile(String resourceName) t var jarfile = getClass().getResource(resourceName); try (var classLoader = new URLClassLoader(new URL[] { jarfile }, null)) { - var classpathScanner = new ClasspathScanner(() -> classLoader, ReflectionUtils::tryToLoadClass); + var classpathScanner = new DefaultClasspathScanner(() -> classLoader, ReflectionUtils::tryToLoadClass); var resources = classpathScanner.scanForResourcesInClasspathRoot(jarfile.toURI(), allResources); assertThat(resources).extracting(Resource::getName) // @@ -228,7 +230,7 @@ void scanForResourcesInShadowedClassPathRoot() throws Exception { var shadowedJarFile = getClass().getResource("/jartest-shadowed.jar"); try (var classLoader = new URLClassLoader(new URL[] { jarFile, shadowedJarFile }, null)) { - var classpathScanner = new ClasspathScanner(() -> classLoader, ReflectionUtils::tryToLoadClass); + var classpathScanner = new DefaultClasspathScanner(() -> classLoader, ReflectionUtils::tryToLoadClass); var resources = classpathScanner.scanForResourcesInClasspathRoot(shadowedJarFile.toURI(), allResources); assertThat(resources).extracting(Resource::getName).containsExactlyInAnyOrder( @@ -238,7 +240,7 @@ void scanForResourcesInShadowedClassPathRoot() throws Exception { "META-INF/MANIFEST.MF"); assertThat(resources).extracting(Resource::getUri) // - .map(ClasspathScannerTests::jarFileAndEntry) // + .map(DefaultClasspathScannerTests::jarFileAndEntry) // .containsExactlyInAnyOrder( // This resource only exists in the shadowed jar file "jartest-shadowed.jar!/org/junit/platform/jartest/included/unique.resource", @@ -256,13 +258,13 @@ void scanForResourcesInPackageWithDuplicateResources() throws Exception { var shadowedJarFile = getClass().getResource("/jartest-shadowed.jar"); try (var classLoader = new URLClassLoader(new URL[] { jarFile, shadowedJarFile }, null)) { - var classpathScanner = new ClasspathScanner(() -> classLoader, ReflectionUtils::tryToLoadClass); + var classpathScanner = new DefaultClasspathScanner(() -> classLoader, ReflectionUtils::tryToLoadClass); var resources = classpathScanner.scanForResourcesInPackage("org.junit.platform.jartest.included", allResources); assertThat(resources).extracting(Resource::getUri) // - .map(ClasspathScannerTests::jarFileAndEntry) // + .map(DefaultClasspathScannerTests::jarFileAndEntry) // .containsExactlyInAnyOrder( // This resource only exists in the shadowed jar file "jartest-shadowed.jar!/org/junit/platform/jartest/included/unique.resource", @@ -329,7 +331,8 @@ private void checkModules2500(ModuleFinder finder) { var parent = ClassLoader.getPlatformClassLoader(); var layer = ModuleLayer.defineModulesWithOneLoader(configuration, List.of(boot), parent).layer(); - var classpathScanner = new ClasspathScanner(() -> layer.findLoader(root), ReflectionUtils::tryToLoadClass); + var classpathScanner = new DefaultClasspathScanner(() -> layer.findLoader(root), + ReflectionUtils::tryToLoadClass); { var classes = classpathScanner.scanForClassesInPackage("foo", allClasses); var classNames = classes.stream().map(Class::getName).collect(Collectors.toList()); @@ -348,7 +351,7 @@ void findAllClassesInPackageWithinJarFileConcurrently() throws Exception { var jarUri = URI.create("jar:" + jarFile); try (var classLoader = new URLClassLoader(new URL[] { jarFile })) { - var classpathScanner = new ClasspathScanner(() -> classLoader, ReflectionUtils::tryToLoadClass); + var classpathScanner = new DefaultClasspathScanner(() -> classLoader, ReflectionUtils::tryToLoadClass); var results = executeConcurrently(10, () -> classpathScanner.scanForClassesInPackage("org.junit.platform.jartest.included", allClasses)); @@ -369,7 +372,7 @@ void findAllResourcesInPackageWithinJarFileConcurrently() throws Exception { var jarUri = URI.create("jar:" + jarFile); try (var classLoader = new URLClassLoader(new URL[] { jarFile })) { - var classpathScanner = new ClasspathScanner(() -> classLoader, ReflectionUtils::tryToLoadClass); + var classpathScanner = new DefaultClasspathScanner(() -> classLoader, ReflectionUtils::tryToLoadClass); var results = executeConcurrently(10, () -> classpathScanner.scanForResourcesInPackage("org.junit.platform.jartest.included", allResources)); @@ -410,9 +413,9 @@ void scanForResourcesInDefaultPackage() { @Test void scanForClassesInPackageWithFilter() { - var thisClassOnly = ClassFilter.of(clazz -> clazz == ClasspathScannerTests.class); + var thisClassOnly = ClassFilter.of(clazz -> clazz == DefaultClasspathScannerTests.class); var classes = classpathScanner.scanForClassesInPackage("org.junit.platform.commons", thisClassOnly); - assertSame(ClasspathScannerTests.class, classes.get(0)); + assertSame(DefaultClasspathScannerTests.class, classes.get(0)); } @Test @@ -471,34 +474,34 @@ void scanForClassesInPackageForNullClassFilter() { @Test void scanForClassesInPackageWhenIOExceptionOccurs() { - var scanner = new ClasspathScanner(ThrowingClassLoader::new, ReflectionUtils::tryToLoadClass); + var scanner = new DefaultClasspathScanner(ThrowingClassLoader::new, ReflectionUtils::tryToLoadClass); var classes = scanner.scanForClassesInPackage("org.junit.platform.commons", allClasses); assertThat(classes).isEmpty(); } @Test void scanForResourcesInPackageWhenIOExceptionOccurs() { - var scanner = new ClasspathScanner(ThrowingClassLoader::new, ReflectionUtils::tryToLoadClass); + var scanner = new DefaultClasspathScanner(ThrowingClassLoader::new, ReflectionUtils::tryToLoadClass); var classes = scanner.scanForResourcesInPackage("org.junit.platform.commons", allResources); assertThat(classes).isEmpty(); } @Test void scanForClassesInPackageOnlyLoadsClassesThatAreIncludedByTheClassNameFilter() { - Predicate classNameFilter = name -> ClasspathScannerTests.class.getName().equals(name); + Predicate classNameFilter = name -> DefaultClasspathScannerTests.class.getName().equals(name); var classFilter = ClassFilter.of(classNameFilter, type -> true); classpathScanner.scanForClassesInPackage("org.junit.platform.commons", classFilter); - assertThat(loadedClasses).containsExactly(ClasspathScannerTests.class); + assertThat(loadedClasses).containsExactly(DefaultClasspathScannerTests.class); } @Test void findAllClassesInClasspathRoot() throws Exception { - var thisClassOnly = ClassFilter.of(clazz -> clazz == ClasspathScannerTests.class); + var thisClassOnly = ClassFilter.of(clazz -> clazz == DefaultClasspathScannerTests.class); var root = getTestClasspathRoot(); var classes = classpathScanner.scanForClassesInClasspathRoot(root, thisClassOnly); - assertSame(ClasspathScannerTests.class, classes.get(0)); + assertSame(DefaultClasspathScannerTests.class, classes.get(0)); } @Test @@ -543,7 +546,7 @@ void findAllClassesInClasspathRootWithFilter() throws Exception { var classes = classpathScanner.scanForClassesInClasspathRoot(root, allClasses); assertThat(classes).hasSizeGreaterThanOrEqualTo(20); - assertTrue(classes.contains(ClasspathScannerTests.class)); + assertTrue(classes.contains(DefaultClasspathScannerTests.class)); } @Test @@ -566,16 +569,17 @@ void findAllClassesInClasspathRootForNullClassFilter() { @Test void onlyLoadsClassesInClasspathRootThatAreIncludedByTheClassNameFilter() throws Exception { - var classFilter = ClassFilter.of(name -> ClasspathScannerTests.class.getName().equals(name), type -> true); + var classFilter = ClassFilter.of(name -> DefaultClasspathScannerTests.class.getName().equals(name), + type -> true); var root = getTestClasspathRoot(); classpathScanner.scanForClassesInClasspathRoot(root, classFilter); - assertThat(loadedClasses).containsExactly(ClasspathScannerTests.class); + assertThat(loadedClasses).containsExactly(DefaultClasspathScannerTests.class); } private static URI uriOf(String name) { - var resource = ClasspathScannerTests.class.getResource(name); + var resource = DefaultClasspathScannerTests.class.getResource(name); try { return requireNonNull(resource).toURI(); } diff --git a/platform-tooling-support-tests/projects/jar-describe-module/junit-platform-commons.expected.txt b/platform-tooling-support-tests/projects/jar-describe-module/junit-platform-commons.expected.txt index cb3eb72ae947..11e66a7ca44f 100644 --- a/platform-tooling-support-tests/projects/jar-describe-module/junit-platform-commons.expected.txt +++ b/platform-tooling-support-tests/projects/jar-describe-module/junit-platform-commons.expected.txt @@ -4,9 +4,11 @@ exports org.junit.platform.commons.annotation exports org.junit.platform.commons.function exports org.junit.platform.commons.support exports org.junit.platform.commons.support.conversion +exports org.junit.platform.commons.support.scanning requires java.base mandated requires java.logging requires java.management requires org.apiguardian.api static transitive +uses org.junit.platform.commons.support.scanning.ClasspathScanner qualified exports org.junit.platform.commons.logging to org.junit.jupiter.api org.junit.jupiter.engine org.junit.jupiter.migrationsupport org.junit.jupiter.params org.junit.platform.console org.junit.platform.engine org.junit.platform.launcher org.junit.platform.reporting org.junit.platform.runner org.junit.platform.suite.api org.junit.platform.suite.engine org.junit.platform.testkit org.junit.vintage.engine qualified exports org.junit.platform.commons.util to org.junit.jupiter.api org.junit.jupiter.engine org.junit.jupiter.migrationsupport org.junit.jupiter.params org.junit.platform.console org.junit.platform.engine org.junit.platform.launcher org.junit.platform.reporting org.junit.platform.runner org.junit.platform.suite.api org.junit.platform.suite.commons org.junit.platform.suite.engine org.junit.platform.testkit org.junit.vintage.engine diff --git a/platform-tooling-support-tests/projects/multi-release-jar/src/test/java/integration/integration/ModuleUtilsTests.java b/platform-tooling-support-tests/projects/multi-release-jar/src/test/java/integration/integration/ModuleUtilsTests.java index d4d961dcc251..c74a8e97c853 100644 --- a/platform-tooling-support-tests/projects/multi-release-jar/src/test/java/integration/integration/ModuleUtilsTests.java +++ b/platform-tooling-support-tests/projects/multi-release-jar/src/test/java/integration/integration/ModuleUtilsTests.java @@ -20,7 +20,7 @@ import org.junit.jupiter.api.Test; import org.junit.platform.commons.PreconditionViolationException; -import org.junit.platform.commons.util.ClassFilter; +import org.junit.platform.commons.support.scanning.ClassFilter; import org.junit.platform.commons.util.ModuleUtils; /** From f95e2495d770700a7f1afce3bf1431baf962e64b Mon Sep 17 00:00:00 2001 From: Juliette de Rancourt Date: Thu, 19 Dec 2024 10:15:09 +0100 Subject: [PATCH 419/611] Fail `@ParameterizedTest` if there are no registered `ArgumentProviders` (#4201) Resolves #4146. --- .../params/ParameterizedTestExtension.java | 8 ++++- .../ParameterizedTestExtensionTests.java | 34 ++++++++++++++++--- .../ParameterizedTestIntegrationTests.java | 17 +++++++++- 3 files changed, 52 insertions(+), 7 deletions(-) diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java index 8aed7644f2d8..023dd6fea6d2 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java @@ -14,6 +14,7 @@ import static org.junit.platform.commons.support.AnnotationSupport.findRepeatableAnnotations; import java.lang.reflect.Method; +import java.util.List; import java.util.Optional; import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Stream; @@ -74,8 +75,13 @@ public Stream provideTestTemplateInvocationContex ParameterizedTestNameFormatter formatter = createNameFormatter(extensionContext, methodContext); AtomicLong invocationCount = new AtomicLong(0); + List argumentsSources = findRepeatableAnnotations(methodContext.method, ArgumentsSource.class); + + Preconditions.notEmpty(argumentsSources, + "Configuration error: You must configure at least one arguments source for this @ParameterizedTest"); + // @formatter:off - return findRepeatableAnnotations(methodContext.method, ArgumentsSource.class) + return argumentsSources .stream() .map(ArgumentsSource::value) .map(clazz -> ParameterizedTestSpiInstantiator.instantiate(ArgumentsProvider.class, clazz, extensionContext)) diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java index 638cdbf95e1f..fbdf70e080c7 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java @@ -146,16 +146,23 @@ void throwsExceptionWhenParameterizedTestIsNotInvokedAtLeastOnce() { @Test void doesNotThrowExceptionWhenParametrizedTestDoesNotRequireArguments() { - var extensionContextWithAnnotatedTestMethod = getExtensionContextReturningSingleMethod( - new TestCaseAllowNoArgumentsMethod()); + var extensionContext = getExtensionContextReturningSingleMethod(new TestCaseAllowNoArgumentsMethod()); - var stream = this.parameterizedTestExtension.provideTestTemplateInvocationContexts( - extensionContextWithAnnotatedTestMethod); + var stream = this.parameterizedTestExtension.provideTestTemplateInvocationContexts(extensionContext); // cause the stream to be evaluated stream.toArray(); stream.close(); } + @Test + void throwsExceptionWhenParameterizedTestHasNoArgumentsSource() { + var extensionContext = getExtensionContextReturningSingleMethod(new TestCaseWithNoArgumentsSource()); + + assertThrows(PreconditionViolationException.class, + () -> this.parameterizedTestExtension.provideTestTemplateInvocationContexts(extensionContext), + "Configuration error: You must configure at least one arguments source for this @ParameterizedTest"); + } + @Test void throwsExceptionWhenArgumentsProviderIsNotStatic() { var extensionContextWithAnnotatedTestMethod = getExtensionContextReturningSingleMethod( @@ -323,8 +330,8 @@ void method() { static class TestCaseWithAnnotatedMethod { - @SuppressWarnings("JUnitMalformedDeclaration") @ParameterizedTest + @ArgumentsSource(ZeroArgumentsProvider.class) void method() { } } @@ -332,10 +339,27 @@ void method() { static class TestCaseAllowNoArgumentsMethod { @ParameterizedTest(allowZeroInvocations = true) + @ArgumentsSource(ZeroArgumentsProvider.class) void method() { } } + static class TestCaseWithNoArgumentsSource { + + @ParameterizedTest(allowZeroInvocations = true) + @SuppressWarnings("JUnitMalformedDeclaration") + void method() { + } + } + + static class ZeroArgumentsProvider implements ArgumentsProvider { + + @Override + public Stream provideArguments(ExtensionContext context) { + return Stream.empty(); + } + } + static class ArgumentsProviderWithCloseHandlerTestCase { @ParameterizedTest diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java index 13739ea4e018..ad28cd7fa555 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java @@ -457,7 +457,7 @@ void failsWhenArgumentsRequiredButNoneProvided() { } @Test - void failsWhenArgumentsAreNotRequiredAndNoneProvided() { + void doesNotFailWhenArgumentsAreNotRequiredAndNoneProvided() { var result = execute(ZeroArgumentsTestCase.class, "testThatDoesNotRequireArguments", String.class); result.allEvents().assertEventsMatchExactly( // event(engine(), started()), event(container(ZeroArgumentsTestCase.class), started()), @@ -467,6 +467,15 @@ void failsWhenArgumentsAreNotRequiredAndNoneProvided() { event(engine(), finishedSuccessfully())); } + @Test + void failsWhenNoArgumentsSourceIsDeclared() { + var result = execute(ZeroArgumentsTestCase.class, "testThatHasNoArgumentsSource", String.class); + result.containerEvents().assertThatEvents() // + .haveExactly(1, // + event(displayName("testThatHasNoArgumentsSource(String)"), finishedWithFailure(message( + "Configuration error: You must configure at least one arguments source for this @ParameterizedTest")))); + } + private EngineExecutionResults execute(DiscoverySelector... selectors) { return EngineTestKit.engine(new JupiterTestEngine()).selectors(selectors).execute(); } @@ -2428,6 +2437,12 @@ void testThatDoesNotRequireArguments(String argument) { fail("This test should not be executed, because no arguments are provided."); } + @ParameterizedTest(allowZeroInvocations = true) + @SuppressWarnings("JUnitMalformedDeclaration") + void testThatHasNoArgumentsSource(String argument) { + fail("This test should not be executed, because no arguments source is declared."); + } + public static Stream zeroArgumentsProvider() { return Stream.empty(); } From 47af824a0c7907c67e0842a1576c586c1847fa6d Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 19 Dec 2024 11:48:19 +0100 Subject: [PATCH 420/611] Add mandatory media type for publishing files --- .../test/java/example/TestReporterDemo.java | 17 +- .../org/junit/jupiter/api/TestReporter.java | 86 +++++- .../api/extension/ExtensionContext.java | 26 +- .../jupiter/api/extension/MediaType.java | 155 +++++++++++ .../descriptor/AbstractExtensionContext.java | 58 +++- .../engine/extension/DefaultTestReporter.java | 13 +- .../platform/console/tasks/TreePrinter.java | 2 +- .../platform/engine/reporting/FileEntry.java | 48 ++-- .../jfr/FlightRecordingExecutionListener.java | 2 +- .../launcher/TestExecutionListener.java | 3 +- .../xml/OpenTestReportGeneratingListener.java | 2 +- .../testkit/engine/EventConditions.java | 6 +- .../jupiter/api/extension/MediaTypeTests.java | 62 +++++ .../junit/jupiter/engine/ReportingTests.java | 25 +- .../descriptor/ExtensionContextTests.java | 254 +++++++++++++----- .../extension/DefaultTestReporterTests.java | 92 +++++-- .../ParameterizedTestExtensionTests.java | 7 +- .../tasks/FlatPrintingListenerTests.java | 5 +- .../console/tasks/TreePrinterTests.java | 2 +- .../VerboseTreePrintingListenerTests.java | 7 +- ...dingExecutionListenerIntegrationTests.java | 3 +- .../engine/testcases/SingleTestTestCase.java | 3 +- 22 files changed, 716 insertions(+), 162 deletions(-) create mode 100644 junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/MediaType.java create mode 100644 jupiter-tests/src/test/java/org/junit/jupiter/api/extension/MediaTypeTests.java diff --git a/documentation/src/test/java/example/TestReporterDemo.java b/documentation/src/test/java/example/TestReporterDemo.java index bafc00f83a3e..a6fddc53eb45 100644 --- a/documentation/src/test/java/example/TestReporterDemo.java +++ b/documentation/src/test/java/example/TestReporterDemo.java @@ -19,6 +19,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestReporter; +import org.junit.jupiter.api.extension.MediaType; import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.api.parallel.Execution; import org.junit.jupiter.api.parallel.ExecutionMode; @@ -49,15 +50,21 @@ void reportMultipleKeyValuePairs(TestReporter testReporter) { @Test void reportFiles(TestReporter testReporter, @TempDir Path tempDir) throws Exception { - testReporter.publishFile("test1.txt", file -> Files.write(file, singletonList("Test 1"))); + testReporter.publishFile("test1.txt", MediaType.TEXT_PLAIN_UTF_8, + file -> Files.write(file, singletonList("Test 1"))); Path existingFile = Files.write(tempDir.resolve("test2.txt"), singletonList("Test 2")); - testReporter.publishFile(existingFile); + testReporter.publishFile(existingFile, MediaType.TEXT_PLAIN_UTF_8); - testReporter.publishFile("test3", dir -> { - Path nestedFile = Files.createDirectory(dir).resolve("nested.txt"); - Files.write(nestedFile, singletonList("Nested content")); + testReporter.publishDirectory("test3", dir -> { + Files.write(dir.resolve("nested1.txt"), singletonList("Nested content 1")); + Files.write(dir.resolve("nested2.txt"), singletonList("Nested content 2")); }); + + Path existingDir = Files.createDirectory(tempDir.resolve("test4")); + Files.write(existingDir.resolve("nested1.txt"), singletonList("Nested content 1")); + Files.write(existingDir.resolve("nested2.txt"), singletonList("Nested content 2")); + testReporter.publishDirectory(existingDir); } } // end::user_guide[] diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestReporter.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestReporter.java index 3039692b083f..79f3f721fbfa 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestReporter.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestReporter.java @@ -14,13 +14,18 @@ import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.STABLE; +import java.io.IOException; +import java.io.UncheckedIOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.Collections; import java.util.Map; +import java.util.stream.Stream; import org.apiguardian.api.API; +import org.junit.jupiter.api.extension.MediaType; import org.junit.jupiter.api.function.ThrowingConsumer; +import org.junit.platform.commons.util.Preconditions; /** * Parameters of type {@code TestReporter} can be injected into @@ -88,29 +93,88 @@ default void publishEntry(String value) { * The file will be copied to the report output directory replacing any * potentially existing file with the same name. * - * @param file the file to be attached; never {@code null} or blank + * @param file the file to be attached; never {@code null} or blank + * @param mediaType the media type of the file; never {@code null}; use + * {@link MediaType#APPLICATION_OCTET_STREAM} if unknown * @since 5.12 */ @API(status = EXPERIMENTAL, since = "5.12") - default void publishFile(Path file) { - publishFile(file.getFileName().toString(), path -> Files.copy(file, path, REPLACE_EXISTING)); + default void publishFile(Path file, MediaType mediaType) { + Preconditions.condition(Files.exists(file), () -> "file must exist: " + file); + Preconditions.condition(Files.isRegularFile(file), () -> "file must be a regular file: " + file); + publishFile(file.getFileName().toString(), mediaType, path -> Files.copy(file, path, REPLACE_EXISTING)); } /** - * Publish a file with the supplied name written by the supplied action and - * attach it to the current test or container. + * Publish the supplied directory and attach it to the current test or + * container. + *

    + * The entire directory will be copied to the report output directory + * replacing any potentially existing files with the same name. + * + * @param directory the file to be attached; never {@code null} or blank + * @since 5.12 + */ + @API(status = EXPERIMENTAL, since = "5.12") + default void publishDirectory(Path directory) { + Preconditions.condition(Files.exists(directory), () -> "directory must exist: " + directory); + Preconditions.condition(Files.isDirectory(directory), () -> "directory must be a directory: " + directory); + publishDirectory(directory.getFileName().toString(), path -> { + try (Stream stream = Files.walk(directory)) { + stream.forEach(source -> { + Path destination = path.resolve(directory.relativize(source)); + try { + if (Files.isDirectory(source)) { + Files.createDirectories(destination); + } + else { + Files.copy(source, destination, REPLACE_EXISTING); + } + } + catch (IOException e) { + throw new UncheckedIOException("Failed to copy files to the output directory", e); + } + }); + } + }); + } + + /** + * Publish a file or directory with the supplied name and media type written + * by the supplied action and attach it to the current test or container. + *

    + * The {@link Path} passed to the supplied action will be relative to the + * report output directory, but it's up to the action to write the file. + * + * @param name the name of the file to be attached; never {@code null} + * or blank and must not contain any path separators + * @param mediaType the media type of the file; never {@code null}; use + * {@link MediaType#APPLICATION_OCTET_STREAM} if unknown + * @param action the action to be executed to write the file; never + * {@code null} + * @since 5.12 + */ + @API(status = EXPERIMENTAL, since = "5.12") + default void publishFile(String name, MediaType mediaType, ThrowingConsumer action) { + throw new UnsupportedOperationException(); + } + + /** + * Publish a directory with the supplied name written by the supplied action + * and attach it to the current test or container. *

    * The {@link Path} passed to the supplied action will be relative to the - * report output directory, but it's up to the action to write the file or - * directory. + * report output directory and point to an existing directory, but it's up + * to the action to write files to it. * - * @param fileName the name of the file to be attached; never {@code null} or blank - * and must not contain any path separators - * @param action the action to be executed to write the file; never {@code null} + * @param name the name of the directory to be attached; never {@code null} + * or blank and must not contain any path separators + * @param action the action to be executed to write the file; never + * {@code null} * @since 5.12 */ @API(status = EXPERIMENTAL, since = "5.12") - default void publishFile(String fileName, ThrowingConsumer action) { + default void publishDirectory(String name, ThrowingConsumer action) { throw new UnsupportedOperationException(); } diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtensionContext.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtensionContext.java index 36ef064bc17b..fddbbf6b638f 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtensionContext.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtensionContext.java @@ -374,14 +374,32 @@ default void publishReportEntry(String value) { * The file will be resolved in the report output directory prior to * invoking the supplied action. * - * @param fileName the name of the file to be attached; never {@code null} or blank - * and must not contain any path separators - * @param action the action to be executed to write the file; never {@code null} + * @param name the name of the file to be attached; never {@code null} + * or blank and must not contain any path separators + * @param mediaType the media type of the file; never {@code null}; use + * {@link MediaType#APPLICATION_OCTET_STREAM} if unknown + * @param action the action to be executed to write the file; never {@code null} * @since 5.12 * @see org.junit.platform.engine.EngineExecutionListener#fileEntryPublished */ @API(status = EXPERIMENTAL, since = "5.12") - void publishFile(String fileName, ThrowingConsumer action); + void publishFile(String name, MediaType mediaType, ThrowingConsumer action); + + /** + * Publish a directory with the supplied name written by the supplied action + * and attach it to the current test or container. + *

    + * The directory will be resolved and created in the report output directory + * prior to invoking the supplied action. + * + * @param name the name of the directory to be attached; never {@code null} + * or blank and must not contain any path separators + * @param action the action to be executed to write the file; never {@code null} + * @since 5.12 + * @see org.junit.platform.engine.EngineExecutionListener#fileEntryPublished + */ + @API(status = EXPERIMENTAL, since = "5.12") + void publishDirectory(String name, ThrowingConsumer action); /** * Get the {@link Store} for the supplied {@link Namespace}. diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/MediaType.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/MediaType.java new file mode 100644 index 000000000000..d45f808c84b1 --- /dev/null +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/MediaType.java @@ -0,0 +1,155 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.api.extension; + +import static java.nio.charset.StandardCharsets.UTF_8; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; + +import java.nio.charset.Charset; +import java.nio.file.Path; +import java.util.Objects; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apiguardian.api.API; +import org.junit.jupiter.api.TestReporter; +import org.junit.jupiter.api.function.ThrowingConsumer; +import org.junit.platform.commons.PreconditionViolationException; +import org.junit.platform.commons.util.Preconditions; + +/** + * Represents a media type as defined by + * RFC 2045. + * + * @since 5.12 + * @see TestReporter#publishFile(Path, MediaType) + * @see TestReporter#publishFile(String, MediaType, ThrowingConsumer) + * @see ExtensionContext#publishFile(String, MediaType, ThrowingConsumer) + */ +@API(status = EXPERIMENTAL, since = "5.12") +public class MediaType { + + private static final Pattern PATTERN; + static { + // https://datatracker.ietf.org/doc/html/rfc2045#section-5.1 + String whitespace = "[ \t]*"; + String token = "[0-9A-Za-z!#$%&'*+.^_`|~-]+"; + String quotedString = "\"(?:[^\"\\\\]|\\.)*\""; + String parameter = ";" + whitespace + token + "=" + "(?:" + token + "|" + quotedString + ")"; + PATTERN = Pattern.compile(token + "/" + token + "(?:" + whitespace + parameter + ")*"); + } + + /** + * The {@code text/plain} media type. + */ + public static final MediaType TEXT_PLAIN = create("text", "plain"); + + /** + * The {@code text/plain; charset=UTF-8} media type. + */ + public static final MediaType TEXT_PLAIN_UTF_8 = create("text", "plain", UTF_8); + + /** + * The {@code application/json} media type. + */ + public static final MediaType APPLICATION_JSON = create("application", "json"); + + /** + * The {@code application/json; charset=UTF-8} media type. + */ + public static final MediaType APPLICATION_JSON_UTF_8 = create("application", "json", UTF_8); + + /** + * The {@code application/octet-stream} media type. + */ + public static final MediaType APPLICATION_OCTET_STREAM = create("application", "octet-stream"); + + /** + * The {@code image/jpeg} media type. + */ + public static final MediaType IMAGE_JPEG = create("image", "jpeg"); + + /** + * The {@code image/png} media type. + */ + public static final MediaType IMAGE_PNG = create("image", "png"); + + private final String value; + + /** + * Parse the given media type value. + *

    + * Must be valid according to + * RFC 2045. + * + * @param value the media type value to parse; never {@code null} + * @return the parsed media type + * @throws PreconditionViolationException if the value is not a valid media type + */ + public static MediaType parse(String value) { + return new MediaType(value); + } + + /** + * Create a media type with the given type and subtype. + * + * @param type the type; never {@code null} + * @param subtype the subtype; never {@code null} + * @return the media type + */ + public static MediaType create(String type, String subtype) { + Preconditions.notNull(type, "type must not be null"); + Preconditions.notNull(subtype, "subtype must not be null"); + return new MediaType(type + "/" + subtype); + } + + /** + * Create a media type with the given type, subtype, and charset. + * + * @param type the type; never {@code null} + * @param subtype the subtype; never {@code null} + * @param charset the charset; never {@code null} + * @return the media type + */ + public static MediaType create(String type, String subtype, Charset charset) { + Preconditions.notNull(type, "type must not be null"); + Preconditions.notNull(subtype, "subtype must not be null"); + Preconditions.notNull(charset, "charset must not be null"); + return new MediaType(type + "/" + subtype + "; charset=" + charset.name()); + } + + private MediaType(String value) { + Matcher matcher = PATTERN.matcher(Preconditions.notNull(value, "value must not be null")); + Preconditions.condition(matcher.matches(), () -> "Invalid media type: '" + value + "'"); + this.value = value; + } + + /** + * {@return string representation of this media type} + */ + @Override + public String toString() { + return value; + } + + @Override + public boolean equals(Object o) { + if (o == null || getClass() != o.getClass()) + return false; + MediaType that = (MediaType) o; + return Objects.equals(this.value, that.value); + } + + @Override + public int hashCode() { + return Objects.hashCode(value); + } +} diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/AbstractExtensionContext.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/AbstractExtensionContext.java index 32fc7339582e..a44756df3e21 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/AbstractExtensionContext.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/AbstractExtensionContext.java @@ -14,6 +14,7 @@ import static java.util.stream.Collectors.toCollection; import java.io.IOException; +import java.nio.file.Files; import java.nio.file.Path; import java.util.Collections; import java.util.LinkedHashSet; @@ -27,6 +28,7 @@ import org.junit.jupiter.api.extension.Extension; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ExtensionContext.Store.CloseableResource; +import org.junit.jupiter.api.extension.MediaType; import org.junit.jupiter.api.function.ThrowingConsumer; import org.junit.jupiter.api.parallel.ExecutionMode; import org.junit.jupiter.engine.config.JupiterConfiguration; @@ -115,18 +117,52 @@ public void publishReportEntry(Map values) { } @Override - public void publishFile(String fileName, ThrowingConsumer action) { + public void publishFile(String name, MediaType mediaType, ThrowingConsumer action) { + Preconditions.notNull(name, "name must not be null"); + Preconditions.notNull(mediaType, "mediaType must not be null"); + Preconditions.notNull(action, "action must not be null"); + + publishFileEntry(name, action, file -> { + Preconditions.condition(Files.isRegularFile(file), () -> "Published path must be a regular file: " + file); + return FileEntry.from(file, mediaType.toString()); + }); + } + + @Override + public void publishDirectory(String name, ThrowingConsumer action) { + Preconditions.notNull(name, "name must not be null"); + Preconditions.notNull(action, "action must not be null"); + + ThrowingConsumer enhancedAction = path -> { + Files.createDirectory(path); + action.accept(path); + }; + publishFileEntry(name, enhancedAction, file -> { + Preconditions.condition(Files.isDirectory(file), () -> "Published path must be a directory: " + file); + return FileEntry.from(file, null); + }); + } + + private void publishFileEntry(String name, ThrowingConsumer action, + Function fileEntryCreator) { + Path dir = createOutputDirectory(); + Path path = dir.resolve(name); + Preconditions.condition(path.getParent().equals(dir), () -> "name must not contain path separators: " + name); + try { + action.accept(path); + } + catch (Throwable t) { + UnrecoverableExceptions.rethrowIfUnrecoverable(t); + throw new JUnitException("Failed to publish path", t); + } + Preconditions.condition(Files.exists(path), () -> "Published path must exist: " + path); + FileEntry fileEntry = fileEntryCreator.apply(path); + this.engineExecutionListener.fileEntryPublished(this.testDescriptor, fileEntry); + } + + private Path createOutputDirectory() { try { - Path dir = configuration.getOutputDirectoryProvider().createOutputDirectory(this.testDescriptor); - try { - Path file = dir.resolve(fileName); - action.accept(file); - this.engineExecutionListener.fileEntryPublished(this.testDescriptor, FileEntry.from(file)); - } - catch (Throwable t) { - UnrecoverableExceptions.rethrowIfUnrecoverable(t); - throw new JUnitException("Failed to publish file", t); - } + return configuration.getOutputDirectoryProvider().createOutputDirectory(this.testDescriptor); } catch (IOException e) { throw new JUnitException("Failed to create output directory", e); diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultTestReporter.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultTestReporter.java index b776a0fe3b94..4d9d9b354ee5 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultTestReporter.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultTestReporter.java @@ -15,7 +15,9 @@ import org.junit.jupiter.api.TestReporter; import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.MediaType; import org.junit.jupiter.api.function.ThrowingConsumer; +import org.junit.platform.commons.util.Preconditions; /** * @since 1.12 @@ -34,7 +36,14 @@ public void publishEntry(Map map) { } @Override - public void publishFile(String fileName, ThrowingConsumer action) { - extensionContext.publishFile(fileName, action); + public void publishFile(String name, MediaType mediaType, ThrowingConsumer action) { + extensionContext.publishFile(name, mediaType, action); + } + + @Override + public void publishDirectory(String name, ThrowingConsumer action) { + Preconditions.notNull(name, "name must not be null"); + Preconditions.notNull(action, "action must not be null"); + extensionContext.publishDirectory(name, action); } } diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreePrinter.java b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreePrinter.java index dceaa952ce50..7d078c34da7f 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreePrinter.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreePrinter.java @@ -158,7 +158,7 @@ private void printFileEntry(String indent, FileEntry fileEntry) { out.print(indent); out.print(fileEntry.getTimestamp()); out.print(" "); - out.print(color(Style.SUCCESSFUL, fileEntry.getFile().toUri().toString())); + out.print(color(Style.SUCCESSFUL, fileEntry.getPath().toUri().toString())); out.println(); } diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/FileEntry.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/FileEntry.java index 9dab655e5a1f..8ba69a748ef3 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/FileEntry.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/FileEntry.java @@ -14,35 +14,41 @@ import java.nio.file.Path; import java.time.LocalDateTime; +import java.util.Optional; import org.apiguardian.api.API; import org.junit.platform.commons.util.Preconditions; import org.junit.platform.commons.util.ToStringBuilder; /** - * {@code FileEntry} encapsulates a file to be published to the reporting - * infrastructure. + * {@code FileEntry} encapsulates a file or directory to be published to the + * reporting infrastructure. * * @since 1.12 - * @see #from(Path) + * @see #from(Path, String) */ @API(status = EXPERIMENTAL, since = "1.12") public final class FileEntry { /** - * Factory for creating a new {@code FileEntry} from the supplied file. + * Factory for creating a new {@code FileEntry} from the supplied path and + * media type. * - * @param file the file to publish; never {@code null} + * @param path the path to publish; never {@code null} + * @param mediaType the media type of the path to publish; may be + * {@code null} */ - public static FileEntry from(Path file) { - return new FileEntry(file); + public static FileEntry from(Path path, String mediaType) { + return new FileEntry(path, mediaType); } private final LocalDateTime timestamp = LocalDateTime.now(); - private final Path file; + private final Path path; + private final String mediaType; - private FileEntry(Path file) { - this.file = Preconditions.notNull(file, "file must not be null"); + private FileEntry(Path path, String mediaType) { + this.path = Preconditions.notNull(path, "path must not be null"); + this.mediaType = mediaType; } /** @@ -55,19 +61,31 @@ public LocalDateTime getTimestamp() { } /** - * Get the file to be published. + * Get the path to be published. * - * @return the file to publish; never {@code null} + * @return the path to publish; never {@code null} */ - public Path getFile() { - return file; + public Path getPath() { + return path; + } + + /** + * Get the media type of the path to be published. + * + * @return the media type of the path to publish; never {@code null} + */ + public Optional getMediaType() { + return Optional.ofNullable(mediaType); } @Override public String toString() { ToStringBuilder builder = new ToStringBuilder(this); builder.append("timestamp", this.timestamp); - builder.append("file", this.file); + builder.append("path", this.path); + if (this.mediaType != null) { + builder.append("mediaType", this.mediaType); + } return builder.toString(); } diff --git a/junit-platform-jfr/src/main/java/org/junit/platform/jfr/FlightRecordingExecutionListener.java b/junit-platform-jfr/src/main/java/org/junit/platform/jfr/FlightRecordingExecutionListener.java index 04d72df4cb87..9d416e609010 100644 --- a/junit-platform-jfr/src/main/java/org/junit/platform/jfr/FlightRecordingExecutionListener.java +++ b/junit-platform-jfr/src/main/java/org/junit/platform/jfr/FlightRecordingExecutionListener.java @@ -102,7 +102,7 @@ public void reportingEntryPublished(TestIdentifier test, ReportEntry reportEntry public void fileEntryPublished(TestIdentifier testIdentifier, FileEntry file) { FileEntryEvent event = new FileEntryEvent(); event.uniqueId = testIdentifier.getUniqueId(); - event.path = file.getFile().toAbsolutePath().toString(); + event.path = file.getPath().toAbsolutePath().toString(); event.commit(); } diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestExecutionListener.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestExecutionListener.java index ad3c98105bb0..3593d44c8401 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestExecutionListener.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestExecutionListener.java @@ -187,7 +187,8 @@ default void reportingEntryPublished(TestIdentifier testIdentifier, ReportEntry } /** - * Called when a file has been published for the supplied {@link TestIdentifier}. + * Called when a file or directory has been published for the supplied + * {@link TestIdentifier}. * *

    Can be called at any time during the execution of a test plan. * diff --git a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java index 82be764786fd..677c1320b862 100644 --- a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java +++ b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java @@ -377,7 +377,7 @@ public void fileEntryPublished(TestIdentifier testIdentifier, FileEntry entry) { String id = inProgressIds.get(testIdentifier.getUniqueIdObject()); eventsFileWriter.append(reported(id, Instant.now()), // reported -> reported.append(attachments(), attachments -> attachments.append(file(entry.getTimestamp()), // - file -> file.withPath(outputDir.relativize(entry.getFile()).toString())))); + file -> file.withPath(outputDir.relativize(entry.getPath()).toString())))); } @Override diff --git a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventConditions.java b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventConditions.java index 339321e3c5b5..776c6d410ab3 100644 --- a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventConditions.java +++ b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventConditions.java @@ -28,7 +28,6 @@ import static org.junit.platform.testkit.engine.EventType.SKIPPED; import static org.junit.platform.testkit.engine.EventType.STARTED; -import java.nio.file.Path; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -482,9 +481,8 @@ public static Condition reportEntry(Map keyValuePairs) { * @since 1.12 */ @API(status = EXPERIMENTAL, since = "1.12") - public static Condition fileEntry(Predicate filePredicate) { - return new Condition<>(byPayload(FileEntry.class, it -> filePredicate.test(it.getFile())), - "event for file entry with custom predicate"); + public static Condition fileEntry(Predicate predicate) { + return new Condition<>(byPayload(FileEntry.class, predicate), "event for file entry with custom predicate"); } } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/MediaTypeTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/MediaTypeTests.java new file mode 100644 index 000000000000..d91aad51804e --- /dev/null +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/MediaTypeTests.java @@ -0,0 +1,62 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.api.extension; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.EqualsAndHashCodeAssertions.assertEqualsAndHashCode; + +import java.nio.charset.StandardCharsets; + +import org.junit.jupiter.api.Test; +import org.junit.platform.commons.PreconditionViolationException; + +class MediaTypeTests { + + @Test + void parse() { + MediaType mediaType = MediaType.parse("text/plain"); + assertEquals("text/plain", mediaType.toString()); + } + + @Test + void create() { + MediaType mediaType = MediaType.create("application", "json"); + assertEquals("application/json", mediaType.toString()); + } + + @Test + void createWithCharset() { + MediaType mediaType = MediaType.create("application", "json", StandardCharsets.UTF_8); + assertEquals("application/json; charset=UTF-8", mediaType.toString()); + } + + @Test + void parseWithInvalidMediaType() { + var exception = assertThrows(PreconditionViolationException.class, () -> MediaType.parse("invalid")); + assertEquals("Invalid media type: 'invalid'", exception.getMessage()); + } + + @Test + void parseWithNullMediaType() { + var exception = assertThrows(PreconditionViolationException.class, () -> MediaType.parse(null)); + assertEquals("value must not be null", exception.getMessage()); + } + + @Test + void equals() { + MediaType mediaType1 = MediaType.TEXT_PLAIN; + MediaType mediaType2 = MediaType.parse("text/plain"); + MediaType mediaType3 = MediaType.parse("application/json"); + + assertEqualsAndHashCode(mediaType1, mediaType2, mediaType3); + } +} diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java index 4cf84f61e430..f73a59a4f163 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java @@ -31,10 +31,12 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance.Lifecycle; import org.junit.jupiter.api.TestReporter; +import org.junit.jupiter.api.extension.MediaType; import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; import org.junit.platform.commons.PreconditionViolationException; +import org.junit.platform.engine.reporting.FileEntry; /** * @since 5.0 @@ -72,13 +74,13 @@ void reportAndFileEntriesArePublished(Lifecycle lifecycle, int containerEntries, .fileEntryPublished(testFileEntries)) // .assertThatEvents() // .haveExactly(2, reportEntry(Map.of("value", "@BeforeEach"))) // - .haveExactly(2, fileEntry(nameAndContent("beforeEach"))) // + .haveExactly(2, fileEntry(nameAndContent("beforeEach", MediaType.TEXT_PLAIN_UTF_8))) // .haveExactly(1, reportEntry(Map.of())) // .haveExactly(1, reportEntry(Map.of("user name", "dk38"))) // .haveExactly(1, reportEntry(Map.of("value", "message"))) // - .haveExactly(1, fileEntry(nameAndContent("succeedingTest"))) // + .haveExactly(1, fileEntry(nameAndContent("succeedingTest", MediaType.APPLICATION_OCTET_STREAM))) // .haveExactly(2, reportEntry(Map.of("value", "@AfterEach"))) // - .haveExactly(2, fileEntry(nameAndContent("afterEach"))); + .haveExactly(2, fileEntry(nameAndContent("afterEach", MediaType.TEXT_PLAIN_UTF_8))); } @SuppressWarnings("JUnitMalformedDeclaration") @@ -87,19 +89,21 @@ static class MyReportingTestCase { public MyReportingTestCase(TestReporter reporter) { // Reported on class-level for PER_CLASS lifecycle and on method-level for PER_METHOD lifecycle reporter.publishEntry("Constructor"); - reporter.publishFile("constructor", file -> Files.writeString(file, "constructor")); + reporter.publishFile("constructor", MediaType.TEXT_PLAIN_UTF_8, + file -> Files.writeString(file, "constructor")); } @BeforeEach void beforeEach(TestReporter reporter) { reporter.publishEntry("@BeforeEach"); - reporter.publishFile("beforeEach", file -> Files.writeString(file, "beforeEach")); + reporter.publishFile("beforeEach", MediaType.TEXT_PLAIN_UTF_8, + file -> Files.writeString(file, "beforeEach")); } @AfterEach void afterEach(TestReporter reporter) { reporter.publishEntry("@AfterEach"); - reporter.publishFile("afterEach", file -> Files.writeString(file, "afterEach")); + reporter.publishFile("afterEach", MediaType.TEXT_PLAIN_UTF_8, file -> Files.writeString(file, "afterEach")); } @Test @@ -107,7 +111,8 @@ void succeedingTest(TestReporter reporter) { reporter.publishEntry(Map.of()); reporter.publishEntry("user name", "dk38"); reporter.publishEntry("message"); - reporter.publishFile("succeedingTest", file -> Files.writeString(file, "succeedingTest")); + reporter.publishFile("succeedingTest", MediaType.APPLICATION_OCTET_STREAM, + file -> Files.writeString(file, "succeedingTest")); } @Test @@ -135,8 +140,8 @@ void invalidReportData(TestReporter reporter) { } - private static Predicate nameAndContent(String expectedName) { - return file -> { + private static Predicate nameAndContent(String expectedName, MediaType mediaType) { + Predicate filePredicate = file -> { try { return Path.of(expectedName).equals(file.getFileName()) && expectedName.equals(Files.readString(file)); } @@ -144,6 +149,8 @@ private static Predicate nameAndContent(String expectedName) { throw new UncheckedIOException(e); } }; + return fileEntry -> filePredicate.test(fileEntry.getPath()) // + && mediaType.toString().equals(fileEntry.getMediaType().orElse(null)); } } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java index 66caeeb639f5..04dc2cf5ece1 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java @@ -10,20 +10,28 @@ package org.junit.jupiter.engine.descriptor; +import static java.nio.charset.StandardCharsets.UTF_8; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertAll; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Named.named; import static org.junit.platform.launcher.core.OutputDirectoryProviders.dummyOutputDirectoryProvider; +import static org.junit.platform.launcher.core.OutputDirectoryProviders.hierarchicalOutputDirectoryProvider; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import java.lang.reflect.Method; +import java.io.File; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.function.Function; @@ -36,7 +44,9 @@ import org.junit.jupiter.api.extension.Extension; import org.junit.jupiter.api.extension.ExtensionContext; import org.junit.jupiter.api.extension.ExtensionContext.Namespace; +import org.junit.jupiter.api.extension.MediaType; import org.junit.jupiter.api.extension.PreInterruptCallback; +import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.api.parallel.ExecutionMode; import org.junit.jupiter.engine.config.DefaultJupiterConfiguration; import org.junit.jupiter.engine.config.JupiterConfiguration; @@ -50,11 +60,10 @@ import org.junit.platform.engine.EngineExecutionListener; import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.UniqueId; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; import org.junit.platform.engine.support.hierarchical.OpenTest4JAwareThrowableCollector; import org.mockito.ArgumentCaptor; -import org.mockito.ArgumentMatchers; -import org.mockito.Mockito; /** * Unit tests for concrete implementations of {@link ExtensionContext}: @@ -73,12 +82,12 @@ void setUp() { when(configuration.getDefaultDisplayNameGenerator()).thenReturn(new DisplayNameGenerator.Standard()); when(configuration.getDefaultExecutionMode()).thenReturn(ExecutionMode.SAME_THREAD); when(configuration.getDefaultClassesExecutionMode()).thenReturn(ExecutionMode.SAME_THREAD); + when(configuration.getOutputDirectoryProvider()).thenReturn(dummyOutputDirectoryProvider()); } @Test void fromJupiterEngineDescriptor() { - JupiterEngineDescriptor engineTestDescriptor = new JupiterEngineDescriptor( - UniqueId.root("engine", "junit-jupiter"), configuration); + var engineTestDescriptor = new JupiterEngineDescriptor(UniqueId.root("engine", "junit-jupiter"), configuration); try (var engineContext = new JupiterEngineExtensionContext(null, engineTestDescriptor, configuration, extensionRegistry)) { @@ -102,13 +111,12 @@ void fromJupiterEngineDescriptor() { } @Test - @SuppressWarnings("resource") void fromClassTestDescriptor() { - NestedClassTestDescriptor nestedClassDescriptor = nestedClassDescriptor(); - ClassTestDescriptor outerClassDescriptor = outerClassDescriptor(nestedClassDescriptor); + var nestedClassDescriptor = nestedClassDescriptor(); + var outerClassDescriptor = outerClassDescriptor(nestedClassDescriptor); - ClassExtensionContext outerExtensionContext = new ClassExtensionContext(null, null, outerClassDescriptor, - configuration, extensionRegistry, null); + var outerExtensionContext = new ClassExtensionContext(null, null, outerClassDescriptor, configuration, + extensionRegistry, null); // @formatter:off assertAll("outerContext", @@ -126,16 +134,16 @@ void fromClassTestDescriptor() { ); // @formatter:on - ClassExtensionContext nestedExtensionContext = new ClassExtensionContext(outerExtensionContext, null, - nestedClassDescriptor, configuration, extensionRegistry, null); + var nestedExtensionContext = new ClassExtensionContext(outerExtensionContext, null, nestedClassDescriptor, + configuration, extensionRegistry, null); assertThat(nestedExtensionContext.getParent()).containsSame(outerExtensionContext); } @Test void ExtensionContext_With_ExtensionRegistry_getExtensions() { - NestedClassTestDescriptor classTestDescriptor = nestedClassDescriptor(); - try (ClassExtensionContext ctx = new ClassExtensionContext(null, null, classTestDescriptor, configuration, - extensionRegistry, null)) { + var classTestDescriptor = nestedClassDescriptor(); + try (var ctx = new ClassExtensionContext(null, null, classTestDescriptor, configuration, extensionRegistry, + null)) { Extension ext = mock(); when(extensionRegistry.getExtensions(Extension.class)).thenReturn(List.of(ext)); @@ -145,49 +153,46 @@ void ExtensionContext_With_ExtensionRegistry_getExtensions() { } @Test - @SuppressWarnings("resource") void tagsCanBeRetrievedInExtensionContext() { - NestedClassTestDescriptor nestedClassDescriptor = nestedClassDescriptor(); - ClassTestDescriptor outerClassDescriptor = outerClassDescriptor(nestedClassDescriptor); - TestMethodTestDescriptor methodTestDescriptor = methodDescriptor(); + var nestedClassDescriptor = nestedClassDescriptor(); + var outerClassDescriptor = outerClassDescriptor(nestedClassDescriptor); + var methodTestDescriptor = methodDescriptor(); outerClassDescriptor.addChild(methodTestDescriptor); - ClassExtensionContext outerExtensionContext = new ClassExtensionContext(null, null, outerClassDescriptor, - configuration, extensionRegistry, null); + var outerExtensionContext = new ClassExtensionContext(null, null, outerClassDescriptor, configuration, + extensionRegistry, null); assertThat(outerExtensionContext.getTags()).containsExactly("outer-tag"); assertThat(outerExtensionContext.getRoot()).isSameAs(outerExtensionContext); - ClassExtensionContext nestedExtensionContext = new ClassExtensionContext(outerExtensionContext, null, - nestedClassDescriptor, configuration, extensionRegistry, null); + var nestedExtensionContext = new ClassExtensionContext(outerExtensionContext, null, nestedClassDescriptor, + configuration, extensionRegistry, null); assertThat(nestedExtensionContext.getTags()).containsExactlyInAnyOrder("outer-tag", "nested-tag"); assertThat(nestedExtensionContext.getRoot()).isSameAs(outerExtensionContext); - MethodExtensionContext methodExtensionContext = new MethodExtensionContext(outerExtensionContext, null, - methodTestDescriptor, configuration, extensionRegistry, new OpenTest4JAwareThrowableCollector()); + var methodExtensionContext = new MethodExtensionContext(outerExtensionContext, null, methodTestDescriptor, + configuration, extensionRegistry, new OpenTest4JAwareThrowableCollector()); methodExtensionContext.setTestInstances(DefaultTestInstances.of(new OuterClass())); assertThat(methodExtensionContext.getTags()).containsExactlyInAnyOrder("outer-tag", "method-tag"); assertThat(methodExtensionContext.getRoot()).isSameAs(outerExtensionContext); } @Test - @SuppressWarnings("resource") void fromMethodTestDescriptor() { - TestMethodTestDescriptor methodTestDescriptor = methodDescriptor(); - ClassTestDescriptor classTestDescriptor = outerClassDescriptor(methodTestDescriptor); - JupiterEngineDescriptor engineDescriptor = new JupiterEngineDescriptor(UniqueId.forEngine("junit-jupiter"), - configuration); + var methodTestDescriptor = methodDescriptor(); + var classTestDescriptor = outerClassDescriptor(methodTestDescriptor); + var engineDescriptor = new JupiterEngineDescriptor(UniqueId.forEngine("junit-jupiter"), configuration); engineDescriptor.addChild(classTestDescriptor); Object testInstance = new OuterClass(); - Method testMethod = methodTestDescriptor.getTestMethod(); + var testMethod = methodTestDescriptor.getTestMethod(); - JupiterEngineExtensionContext engineExtensionContext = new JupiterEngineExtensionContext(null, engineDescriptor, - configuration, extensionRegistry); - ClassExtensionContext classExtensionContext = new ClassExtensionContext(engineExtensionContext, null, - classTestDescriptor, configuration, extensionRegistry, null); - MethodExtensionContext methodExtensionContext = new MethodExtensionContext(classExtensionContext, null, - methodTestDescriptor, configuration, extensionRegistry, new OpenTest4JAwareThrowableCollector()); + var engineExtensionContext = new JupiterEngineExtensionContext(null, engineDescriptor, configuration, + extensionRegistry); + var classExtensionContext = new ClassExtensionContext(engineExtensionContext, null, classTestDescriptor, + configuration, extensionRegistry, null); + var methodExtensionContext = new MethodExtensionContext(classExtensionContext, null, methodTestDescriptor, + configuration, extensionRegistry, new OpenTest4JAwareThrowableCollector()); methodExtensionContext.setTestInstances(DefaultTestInstances.of(testInstance)); // @formatter:off @@ -209,28 +214,28 @@ void fromMethodTestDescriptor() { @Test @SuppressWarnings("resource") - void reportEntriesArePublishedToExecutionContext() { - ClassTestDescriptor classTestDescriptor = outerClassDescriptor(null); - EngineExecutionListener engineExecutionListener = Mockito.spy(EngineExecutionListener.class); + void reportEntriesArePublishedToExecutionListener() { + var classTestDescriptor = outerClassDescriptor(null); + var engineExecutionListener = spy(EngineExecutionListener.class); ExtensionContext extensionContext = new ClassExtensionContext(null, engineExecutionListener, classTestDescriptor, configuration, extensionRegistry, null); - Map map1 = Collections.singletonMap("key", "value"); - Map map2 = Collections.singletonMap("other key", "other value"); + var map1 = Collections.singletonMap("key", "value"); + var map2 = Collections.singletonMap("other key", "other value"); extensionContext.publishReportEntry(map1); extensionContext.publishReportEntry(map2); extensionContext.publishReportEntry("3rd key", "third value"); extensionContext.publishReportEntry("status message"); - ArgumentCaptor entryCaptor = ArgumentCaptor.forClass(ReportEntry.class); - Mockito.verify(engineExecutionListener, Mockito.times(4)).reportingEntryPublished( - ArgumentMatchers.eq(classTestDescriptor), entryCaptor.capture()); + var entryCaptor = ArgumentCaptor.forClass(ReportEntry.class); + verify(engineExecutionListener, times(4)) // + .reportingEntryPublished(eq(classTestDescriptor), entryCaptor.capture()); - ReportEntry reportEntry1 = entryCaptor.getAllValues().get(0); - ReportEntry reportEntry2 = entryCaptor.getAllValues().get(1); - ReportEntry reportEntry3 = entryCaptor.getAllValues().get(2); - ReportEntry reportEntry4 = entryCaptor.getAllValues().get(3); + var reportEntry1 = entryCaptor.getAllValues().get(0); + var reportEntry2 = entryCaptor.getAllValues().get(1); + var reportEntry3 = entryCaptor.getAllValues().get(2); + var reportEntry4 = entryCaptor.getAllValues().get(3); assertEquals(map1, reportEntry1.getKeyValuePairs()); assertEquals(map2, reportEntry2.getKeyValuePairs()); @@ -238,22 +243,126 @@ void reportEntriesArePublishedToExecutionContext() { assertEquals("status message", reportEntry4.getKeyValuePairs().get("value")); } + @Test + void fileEntriesArePublishedToExecutionListener(@TempDir Path tempDir) { + var engineExecutionListener = mock(EngineExecutionListener.class); + var classTestDescriptor = outerClassDescriptor(null); + var extensionContext = createExtensionContextForFilePublishing(tempDir, engineExecutionListener, + classTestDescriptor); + + extensionContext.publishFile("test1.txt", MediaType.TEXT_PLAIN_UTF_8, + file -> Files.writeString(file, "Test 1")); + extensionContext.publishDirectory("test2", dir -> { + Files.writeString(dir.resolve("nested1.txt"), "Nested content 1"); + Files.writeString(dir.resolve("nested2.txt"), "Nested content 2"); + }); + + var entryCaptor = ArgumentCaptor.forClass(FileEntry.class); + verify(engineExecutionListener, times(2)) // + .fileEntryPublished(eq(classTestDescriptor), entryCaptor.capture()); + var fileEntries = entryCaptor.getAllValues(); + + var fileEntry1 = fileEntries.getFirst(); + assertThat(fileEntry1.getPath()).isEqualTo(tempDir.resolve("OuterClass/test1.txt")); + assertThat(fileEntry1.getMediaType()).contains(MediaType.TEXT_PLAIN_UTF_8.toString()); + + var fileEntry2 = fileEntries.get(1); + assertThat(fileEntry2.getPath()).isEqualTo(tempDir.resolve("OuterClass/test2")); + assertThat(fileEntry2.getMediaType()).isEmpty(); + assertThat(fileEntry2.getPath().resolve("nested1.txt")).usingCharset(UTF_8).hasContent("Nested content 1"); + assertThat(fileEntry2.getPath().resolve("nested2.txt")).usingCharset(UTF_8).hasContent("Nested content 2"); + } + + @Test + void failsWhenAttemptingToPublishFileWithPathSeparators(@TempDir Path tempDir) { + var extensionContext = createExtensionContextForFilePublishing(tempDir); + var name = "test" + File.separator + "subDir"; + + var exception = assertThrows(PreconditionViolationException.class, () -> extensionContext.publishFile(name, + MediaType.APPLICATION_OCTET_STREAM, __ -> fail("should not be called"))); + assertThat(exception).hasMessage("name must not contain path separators: " + name); + } + + @Test + void failsWhenAttemptingToPublishDirectoryWithPathSeparators(@TempDir Path tempDir) { + var extensionContext = createExtensionContextForFilePublishing(tempDir); + var name = "test" + File.separator + "subDir"; + + var exception = assertThrows(PreconditionViolationException.class, + () -> extensionContext.publishDirectory(name, __ -> fail("should not be called"))); + assertThat(exception).hasMessage("name must not contain path separators: " + name); + } + + @Test + void failsWhenAttemptingToPublishMissingFiles(@TempDir Path tempDir) { + var extensionContext = createExtensionContextForFilePublishing(tempDir); + + var exception = assertThrows(PreconditionViolationException.class, + () -> extensionContext.publishFile("test", MediaType.APPLICATION_OCTET_STREAM, Files::deleteIfExists)); + assertThat(exception).hasMessage("Published path must exist: " + tempDir.resolve("OuterClass").resolve("test")); + } + + @Test + void failsWhenAttemptingToPublishMissingDirectory(@TempDir Path tempDir) { + var extensionContext = createExtensionContextForFilePublishing(tempDir); + + var exception = assertThrows(PreconditionViolationException.class, + () -> extensionContext.publishDirectory("test", Files::delete)); + assertThat(exception).hasMessage("Published path must exist: " + tempDir.resolve("OuterClass").resolve("test")); + } + + @Test + void failsWhenAttemptingToPublishDirectoriesAsRegularFiles(@TempDir Path tempDir) { + var extensionContext = createExtensionContextForFilePublishing(tempDir); + + var exception = assertThrows(PreconditionViolationException.class, + () -> extensionContext.publishFile("test", MediaType.APPLICATION_OCTET_STREAM, Files::createDirectory)); + assertThat(exception).hasMessage( + "Published path must be a regular file: " + tempDir.resolve("OuterClass").resolve("test")); + } + + @Test + void failsWhenAttemptingToPublishRegularFilesAsDirectories(@TempDir Path tempDir) { + var extensionContext = createExtensionContextForFilePublishing(tempDir); + + var exception = assertThrows(PreconditionViolationException.class, + () -> extensionContext.publishDirectory("test", dir -> { + Files.delete(dir); + Files.createFile(dir); + })); + assertThat(exception).hasMessage( + "Published path must be a directory: " + tempDir.resolve("OuterClass").resolve("test")); + } + + private ExtensionContext createExtensionContextForFilePublishing(Path tempDir) { + return createExtensionContextForFilePublishing(tempDir, mock(EngineExecutionListener.class), + outerClassDescriptor(null)); + } + + private ExtensionContext createExtensionContextForFilePublishing(Path tempDir, + EngineExecutionListener engineExecutionListener, ClassTestDescriptor classTestDescriptor) { + when(configuration.getOutputDirectoryProvider()) // + .thenReturn(hierarchicalOutputDirectoryProvider(tempDir)); + return new ClassExtensionContext(null, engineExecutionListener, classTestDescriptor, configuration, + extensionRegistry, null); + } + @Test @SuppressWarnings("resource") void usingStore() { - TestMethodTestDescriptor methodTestDescriptor = methodDescriptor(); - ClassTestDescriptor classTestDescriptor = outerClassDescriptor(methodTestDescriptor); + var methodTestDescriptor = methodDescriptor(); + var classTestDescriptor = outerClassDescriptor(methodTestDescriptor); ExtensionContext parentContext = new ClassExtensionContext(null, null, classTestDescriptor, configuration, extensionRegistry, null); - MethodExtensionContext childContext = new MethodExtensionContext(parentContext, null, methodTestDescriptor, - configuration, extensionRegistry, new OpenTest4JAwareThrowableCollector()); + var childContext = new MethodExtensionContext(parentContext, null, methodTestDescriptor, configuration, + extensionRegistry, new OpenTest4JAwareThrowableCollector()); childContext.setTestInstances(DefaultTestInstances.of(new OuterClass())); - ExtensionContext.Store childStore = childContext.getStore(Namespace.GLOBAL); - ExtensionContext.Store parentStore = parentContext.getStore(Namespace.GLOBAL); + var childStore = childContext.getStore(Namespace.GLOBAL); + var parentStore = parentContext.getStore(Namespace.GLOBAL); final Object key1 = "key 1"; - final String value1 = "a value"; + final var value1 = "a value"; childStore.put(key1, value1); assertEquals(value1, childStore.get(key1)); assertEquals(value1, childStore.remove(key1)); @@ -265,14 +374,14 @@ void usingStore() { assertNull(childStore.get(key1)); final Object key2 = "key 2"; - final String value2 = "other value"; + final var value2 = "other value"; assertEquals(value2, childStore.getOrComputeIfAbsent(key2, key -> value2)); assertEquals(value2, childStore.getOrComputeIfAbsent(key2, key -> value2, String.class)); assertEquals(value2, childStore.get(key2)); assertEquals(value2, childStore.get(key2, String.class)); final Object parentKey = "parent key"; - final String parentValue = "parent value"; + final var parentValue = "parent value"; parentStore.put(parentKey, parentValue); assertEquals(parentValue, childStore.getOrComputeIfAbsent(parentKey, k -> "a different value")); assertEquals(parentValue, childStore.get(parentKey)); @@ -283,8 +392,8 @@ void usingStore() { void configurationParameter(Function extensionContextFactory) { JupiterConfiguration echo = new DefaultJupiterConfiguration(new EchoParameters(), dummyOutputDirectoryProvider()); - String key = "123"; - Optional expected = Optional.of(key); + var key = "123"; + var expected = Optional.of(key); var context = extensionContextFactory.apply(echo); @@ -293,25 +402,24 @@ void configurationParameter(Function>> extensionContextFactories() { ExtensionRegistry extensionRegistry = mock(); - Class testClass = ExtensionContextTests.class; + var testClass = ExtensionContextTests.class; return List.of( // named("engine", (JupiterConfiguration configuration) -> { - UniqueId engineUniqueId = UniqueId.parse("[engine:junit-jupiter]"); - JupiterEngineDescriptor engineDescriptor = new JupiterEngineDescriptor(engineUniqueId, configuration); + var engineUniqueId = UniqueId.parse("[engine:junit-jupiter]"); + var engineDescriptor = new JupiterEngineDescriptor(engineUniqueId, configuration); return new JupiterEngineExtensionContext(null, engineDescriptor, configuration, extensionRegistry); }), // named("class", (JupiterConfiguration configuration) -> { - UniqueId classUniqueId = UniqueId.parse("[engine:junit-jupiter]/[class:MyClass]"); - ClassTestDescriptor classTestDescriptor = new ClassTestDescriptor(classUniqueId, testClass, - configuration); + var classUniqueId = UniqueId.parse("[engine:junit-jupiter]/[class:MyClass]"); + var classTestDescriptor = new ClassTestDescriptor(classUniqueId, testClass, configuration); return new ClassExtensionContext(null, null, classTestDescriptor, configuration, extensionRegistry, null); }), // named("method", (JupiterConfiguration configuration) -> { - Method method = ReflectionSupport.findMethod(testClass, "extensionContextFactories").orElseThrow(); - UniqueId methodUniqueId = UniqueId.parse("[engine:junit-jupiter]/[class:MyClass]/[method:myMethod]"); - TestMethodTestDescriptor methodTestDescriptor = new TestMethodTestDescriptor(methodUniqueId, testClass, - method, configuration); + var method = ReflectionSupport.findMethod(testClass, "extensionContextFactories").orElseThrow(); + var methodUniqueId = UniqueId.parse("[engine:junit-jupiter]/[class:MyClass]/[method:myMethod]"); + var methodTestDescriptor = new TestMethodTestDescriptor(methodUniqueId, testClass, method, + configuration); return new MethodExtensionContext(null, null, methodTestDescriptor, configuration, extensionRegistry, null); }) // @@ -324,8 +432,8 @@ private NestedClassTestDescriptor nestedClassDescriptor() { } private ClassTestDescriptor outerClassDescriptor(TestDescriptor child) { - ClassTestDescriptor classTestDescriptor = new ClassTestDescriptor(UniqueId.root("class", "OuterClass"), - OuterClass.class, configuration); + var classTestDescriptor = new ClassTestDescriptor(UniqueId.root("class", "OuterClass"), OuterClass.class, + configuration); if (child != null) { classTestDescriptor.addChild(child); } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/DefaultTestReporterTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/DefaultTestReporterTests.java index 68fc7dbff8a7..9405ff457aca 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/DefaultTestReporterTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/DefaultTestReporterTests.java @@ -10,18 +10,22 @@ package org.junit.jupiter.engine.extension; +import static java.nio.charset.StandardCharsets.UTF_8; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; +import java.nio.charset.Charset; import java.nio.file.Files; -import java.nio.file.NoSuchFileException; import java.nio.file.Path; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.MediaType; import org.junit.jupiter.api.function.ThrowingConsumer; import org.junit.jupiter.api.io.TempDir; +import org.junit.platform.commons.PreconditionViolationException; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.InjectMocks; @@ -37,9 +41,6 @@ public class DefaultTestReporterTests { @Mock ExtensionContext extensionContext; - @Captor - ArgumentCaptor fileNameCaptor; - @Captor ArgumentCaptor> actionCaptor; @@ -48,33 +49,92 @@ public class DefaultTestReporterTests { @Test void copiesExistingFileToTarget() throws Throwable { - testReporter.publishFile(Files.writeString(tempDir.resolve("source"), "content")); + testReporter.publishFile(Files.writeString(tempDir.resolve("source"), "content"), MediaType.TEXT_PLAIN_UTF_8); - verify(extensionContext).publishFile(fileNameCaptor.capture(), actionCaptor.capture()); - assertThat(fileNameCaptor.getValue()).isEqualTo("source"); + verify(extensionContext).publishFile(eq("source"), eq(MediaType.TEXT_PLAIN_UTF_8), actionCaptor.capture()); actionCaptor.getValue().accept(tempDir.resolve("target")); - assertThat(tempDir.resolve("target")).hasContent("content"); + assertThat(tempDir.resolve("target")).usingCharset(UTF_8).hasContent("content"); } @Test void executesCustomActionWithTargetFile() throws Throwable { - testReporter.publishFile("target", file -> Files.writeString(file, "content")); + testReporter.publishFile("target", MediaType.APPLICATION_OCTET_STREAM, + file -> Files.write(file, "content".getBytes())); - verify(extensionContext).publishFile(fileNameCaptor.capture(), actionCaptor.capture()); - assertThat(fileNameCaptor.getValue()).isEqualTo("target"); + verify(extensionContext).publishFile(eq("target"), eq(MediaType.APPLICATION_OCTET_STREAM), + actionCaptor.capture()); actionCaptor.getValue().accept(tempDir.resolve("target")); assertThat(tempDir.resolve("target")).hasContent("content"); } + @Test + void copiesExistingDirectoryToTarget() throws Throwable { + var source = Files.createDirectory(tempDir.resolve("source")); + Files.writeString(source.resolve("source1"), "content1"); + var sourceSubDir = Files.createDirectory(source.resolve("subDir")); + Files.writeString(sourceSubDir.resolve("source2"), "content2"); + Files.writeString(Files.createDirectory(sourceSubDir.resolve("subSubDir")).resolve("source3"), "content3"); + + testReporter.publishDirectory(source); + + verify(extensionContext).publishDirectory(eq("source"), actionCaptor.capture()); + + var target = tempDir.resolve("target"); + actionCaptor.getValue().accept(target); + + assertThat(target).isDirectory(); + assertThat(target.resolve("source1")).usingCharset(UTF_8).hasContent("content1"); + var targetSubDir = target.resolve("subDir"); + assertThat(targetSubDir.resolve("source2")).usingCharset(UTF_8).hasContent("content2"); + assertThat(targetSubDir.resolve("subSubDir").resolve("source3")).usingCharset(UTF_8).hasContent("content3"); + } + + @Test + void executesCustomActionWithTargetDirectory() throws Throwable { + testReporter.publishDirectory("target", + dir -> Files.writeString(Files.createDirectory(dir).resolve("file"), "content", Charset.defaultCharset())); + + verify(extensionContext).publishDirectory(eq("target"), actionCaptor.capture()); + + var target = tempDir.resolve("target"); + actionCaptor.getValue().accept(target); + + assertThat(target.resolve("file")).hasContent("content"); + } + @Test void failsWhenPublishingMissingFile() { - testReporter.publishFile(tempDir.resolve("source")); + var missingFile = tempDir.resolve("missingFile"); + + assertThatThrownBy(() -> testReporter.publishFile(missingFile, MediaType.APPLICATION_OCTET_STREAM)) // + .isInstanceOf(PreconditionViolationException.class) // + .hasMessage("file must exist: " + missingFile); + } + + @Test + void failsWhenPublishingDirectoryAsFile() { + assertThatThrownBy(() -> testReporter.publishFile(tempDir, MediaType.APPLICATION_OCTET_STREAM)) // + .isInstanceOf(PreconditionViolationException.class) // + .hasMessage("file must be a regular file: " + tempDir); + } + + @Test + void failsWhenPublishingMissingDirectory() { + var missingDir = tempDir.resolve("missingDir"); + + assertThatThrownBy(() -> testReporter.publishDirectory(missingDir)) // + .isInstanceOf(PreconditionViolationException.class) // + .hasMessage("directory must exist: " + missingDir); + } + + @Test + void failsWhenPublishingFileAsDirectory() throws Exception { + var file = Files.createFile(tempDir.resolve("source")); - verify(extensionContext).publishFile(fileNameCaptor.capture(), actionCaptor.capture()); - assertThat(fileNameCaptor.getValue()).isEqualTo("source"); - assertThatThrownBy(() -> actionCaptor.getValue().accept(tempDir.resolve("target"))) // - .isInstanceOf(NoSuchFileException.class); + assertThatThrownBy(() -> testReporter.publishDirectory(file)) // + .isInstanceOf(PreconditionViolationException.class) // + .hasMessage("directory must be a directory: " + file); } } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java index fbdf70e080c7..03862588dc3c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java @@ -34,6 +34,7 @@ import org.junit.jupiter.api.TestInstance.Lifecycle; import org.junit.jupiter.api.extension.ExecutableInvoker; import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.MediaType; import org.junit.jupiter.api.extension.TestInstances; import org.junit.jupiter.api.function.ThrowingConsumer; import org.junit.jupiter.api.parallel.ExecutionMode; @@ -285,7 +286,11 @@ public void publishReportEntry(Map map) { } @Override - public void publishFile(String fileName, ThrowingConsumer action) { + public void publishFile(String fileName, MediaType mediaType, ThrowingConsumer action) { + } + + @Override + public void publishDirectory(String name, ThrowingConsumer action) { } @Override diff --git a/platform-tests/src/test/java/org/junit/platform/console/tasks/FlatPrintingListenerTests.java b/platform-tests/src/test/java/org/junit/platform/console/tasks/FlatPrintingListenerTests.java index afff86ab473a..cba9f30a84b3 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/tasks/FlatPrintingListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/tasks/FlatPrintingListenerTests.java @@ -65,14 +65,15 @@ void reportingEntryPublished() { @Test void fileEntryPublished() { var stringWriter = new StringWriter(); - listener(stringWriter).fileEntryPublished(newTestIdentifier(), FileEntry.from(Path.of("test.txt"))); + listener(stringWriter).fileEntryPublished(newTestIdentifier(), + FileEntry.from(Path.of("test.txt"), "text/plain")); var lines = lines(stringWriter); assertEquals(2, lines.length); assertAll("lines in the output", // () -> assertEquals("Reported: demo-test ([engine:demo-engine])", lines[0]), // () -> assertTrue(lines[1].startsWith(INDENTATION + "=> Reported file: FileEntry [timestamp =")), // - () -> assertTrue(lines[1].endsWith(", file = test.txt]"))); + () -> assertTrue(lines[1].endsWith(", path = test.txt, mediaType = 'text/plain']"))); } @Test diff --git a/platform-tests/src/test/java/org/junit/platform/console/tasks/TreePrinterTests.java b/platform-tests/src/test/java/org/junit/platform/console/tasks/TreePrinterTests.java index 7cafb539423f..49577c4b9fa7 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/tasks/TreePrinterTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/tasks/TreePrinterTests.java @@ -94,7 +94,7 @@ void reportsAreTabbedCorrectly() { c1.addChild(m1); var m2 = new TreeNode(identifier("m-2", "method two")).setResult(successful()); - m2.addFileEntry(FileEntry.from(Path.of("test.txt"))); + m2.addFileEntry(FileEntry.from(Path.of("test.txt"), "text/plain")); c1.addChild(m2); new TreePrinter(out, Theme.UNICODE, ColorPalette.NONE).print(root); diff --git a/platform-tests/src/test/java/org/junit/platform/console/tasks/VerboseTreePrintingListenerTests.java b/platform-tests/src/test/java/org/junit/platform/console/tasks/VerboseTreePrintingListenerTests.java index 8da61de46ea8..c8ae4f0ec3b3 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/tasks/VerboseTreePrintingListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/tasks/VerboseTreePrintingListenerTests.java @@ -61,10 +61,13 @@ void reportingEntryPublished() { @Test void fileEntryPublished() { var stringWriter = new StringWriter(); - listener(stringWriter).fileEntryPublished(newTestIdentifier(), FileEntry.from(Path.of("test.txt"))); + listener(stringWriter).fileEntryPublished(newTestIdentifier(), + FileEntry.from(Path.of("test.txt"), "text/plain")); var lines = lines(stringWriter); - assertLinesMatch(List.of(" reports: FileEntry \\[timestamp = .+, file = test.txt\\]"), List.of(lines)); + assertLinesMatch( + List.of(" reports: FileEntry \\[timestamp = .+, path = test.txt, mediaType = 'text/plain'\\]"), + List.of(lines)); } @Test diff --git a/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingExecutionListenerIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingExecutionListenerIntegrationTests.java index cef08d696d9d..0faf037f2d2a 100644 --- a/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingExecutionListenerIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingExecutionListenerIntegrationTests.java @@ -24,6 +24,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestReporter; import org.junit.jupiter.api.extension.DisabledOnOpenJ9; +import org.junit.jupiter.api.extension.MediaType; import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.engine.JupiterTestEngine; import org.junit.platform.launcher.core.LauncherFactoryForTestingPurposesOnly; @@ -81,7 +82,7 @@ static class TestCase { @Test void test(TestReporter reporter) { reporter.publishEntry("message", "Hello JFR!"); - reporter.publishFile("test.txt", file -> Files.writeString(file, "test")); + reporter.publishFile("test.txt", MediaType.TEXT_PLAIN_UTF_8, file -> Files.writeString(file, "test")); } @Test diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/SingleTestTestCase.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/SingleTestTestCase.java index eb6dc4734034..e8aa2c9e3e41 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/SingleTestTestCase.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/SingleTestTestCase.java @@ -14,6 +14,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestReporter; +import org.junit.jupiter.api.extension.MediaType; /** * @since 1.8 @@ -22,6 +23,6 @@ public class SingleTestTestCase { @Test void test(TestReporter testReporter) { - testReporter.publishFile("test.txt", file -> Files.writeString(file, "test")); + testReporter.publishFile("test.txt", MediaType.TEXT_PLAIN_UTF_8, file -> Files.writeString(file, "test")); } } From 0447db6e10ae44a7011ee6f7ea7572a87cab3543 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 19 Dec 2024 12:47:32 +0100 Subject: [PATCH 421/611] Include media type in Open Test Report XML output --- .../xml/OpenTestReportGeneratingListener.java | 5 ++++- ...OpenTestReportGeneratingListenerTests.java | 22 +++++++++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java index 677c1320b862..8573707420a9 100644 --- a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java +++ b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java @@ -377,7 +377,10 @@ public void fileEntryPublished(TestIdentifier testIdentifier, FileEntry entry) { String id = inProgressIds.get(testIdentifier.getUniqueIdObject()); eventsFileWriter.append(reported(id, Instant.now()), // reported -> reported.append(attachments(), attachments -> attachments.append(file(entry.getTimestamp()), // - file -> file.withPath(outputDir.relativize(entry.getPath()).toString())))); + file -> { + file.withPath(outputDir.relativize(entry.getPath()).toString()); + entry.getMediaType().ifPresent(file::withMediaType); + }))); } @Override diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java index b0efc6a5318e..fb69d86d9345 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java @@ -37,8 +37,10 @@ import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import org.junit.platform.commons.util.ExceptionUtils; import org.junit.platform.engine.TestEngine; import org.junit.platform.engine.UniqueId; +import org.junit.platform.engine.reporting.FileEntry; import org.junit.platform.engine.reporting.ReportEntry; import org.junit.platform.engine.support.hierarchical.DemoHierarchicalTestEngine; import org.junit.platform.tests.process.ProcessResult; @@ -78,10 +80,17 @@ void restoreSystemPrintStreams() { void writesValidXmlReport(@TempDir Path tempDirectory) throws Exception { var engine = new DemoHierarchicalTestEngine("dummy"); engine.addTest("failingTest", "display<-->Name 😎", (context, descriptor) -> { - var listener = context.request.getEngineExecutionListener(); - listener.reportingEntryPublished(descriptor, ReportEntry.from("key", "value")); - System.out.println("Hello, stdout!"); - System.err.println("Hello, stderr!"); + try { + var listener = context.request.getEngineExecutionListener(); + listener.reportingEntryPublished(descriptor, ReportEntry.from("key", "value")); + listener.fileEntryPublished(descriptor, FileEntry.from( + Files.writeString(tempDirectory.resolve("test.txt"), "Hello, world!"), "text/plain")); + System.out.println("Hello, stdout!"); + System.err.println("Hello, stderr!"); + } + catch (Throwable t) { + throw ExceptionUtils.throwAsUncheckedException(t); + } fail("failure message"); }); @@ -130,6 +139,11 @@ void writesValidXmlReport(@TempDir Path tempDirectory) throws Exception { + + + + + From f1b5d7aec1f82e5884bd690a94c43a546b5a0437 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 19 Dec 2024 14:54:00 +0100 Subject: [PATCH 422/611] Fix test on Windows --- .../open/xml/OpenTestReportGeneratingListenerTests.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java index fb69d86d9345..fd82f3355bb9 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java @@ -141,7 +141,7 @@ void writesValidXmlReport(@TempDir Path tempDirectory) throws Exception { - + From aa922c7adf1b90c6db83fa4ead9be79b7bd837fb Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 19 Dec 2024 16:07:05 +0100 Subject: [PATCH 423/611] Capture process output as file attachments --- .../platform/tests/process/OutputFiles.java | 16 +++ .../tests/process/ProcessStarter.java | 36 ++++++- .../platform/tests/process/WatchedOutput.java | 11 ++- .../tests/process/WatchedProcess.java | 17 ++++ .../support/tests/AntStarterTests.java | 5 +- .../tooling/support/tests/FilePrefix.java | 25 +++++ .../support/tests/GraalVmStarterTests.java | 5 +- .../tests/GradleKotlinExtensionsTests.java | 4 +- .../tests/GradleMissingEngineTests.java | 5 +- .../support/tests/GradleStarterTests.java | 4 +- .../support/tests/JarDescribeModuleTests.java | 4 +- .../support/tests/JavaVersionsTests.java | 11 ++- .../support/tests/MavenStarterTests.java | 5 +- .../MavenSurefireCompatibilityTests.java | 6 +- .../support/tests/ModularUserGuideTests.java | 9 +- .../support/tests/MultiReleaseJarTests.java | 4 +- .../tests/OutputAttachingExtension.java | 99 +++++++++++++++++++ .../tests/ReflectionCompatibilityTests.java | 4 +- .../support/tests/StandaloneTests.java | 54 ++++++---- .../tests/VintageGradleIntegrationTests.java | 12 ++- .../tests/VintageMavenIntegrationTests.java | 12 ++- 21 files changed, 286 insertions(+), 62 deletions(-) create mode 100644 platform-tests/src/processStarter/java/org/junit/platform/tests/process/OutputFiles.java create mode 100644 platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/FilePrefix.java create mode 100644 platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/OutputAttachingExtension.java diff --git a/platform-tests/src/processStarter/java/org/junit/platform/tests/process/OutputFiles.java b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/OutputFiles.java new file mode 100644 index 000000000000..379e94e124d4 --- /dev/null +++ b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/OutputFiles.java @@ -0,0 +1,16 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.tests.process; + +import java.nio.file.Path; + +public record OutputFiles(Path stdOut, Path stdErr) { +} diff --git a/platform-tests/src/processStarter/java/org/junit/platform/tests/process/ProcessStarter.java b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/ProcessStarter.java index 329f1fab138f..277ecf13508c 100644 --- a/platform-tests/src/processStarter/java/org/junit/platform/tests/process/ProcessStarter.java +++ b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/ProcessStarter.java @@ -15,11 +15,14 @@ import java.io.OutputStream; import java.io.PrintStream; import java.io.UncheckedIOException; +import java.nio.charset.Charset; +import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.function.BiFunction; import java.util.stream.Stream; @@ -28,10 +31,13 @@ public class ProcessStarter { + public static final Charset OUTPUT_ENCODING = Charset.forName(System.getProperty("native.encoding")); + private Path executable; private Path workingDir; private final List arguments = new ArrayList<>(); private final Map environment = new LinkedHashMap<>(); + private Optional outputFiles = Optional.empty(); public ProcessStarter executable(Path executable) { this.executable = executable; @@ -62,6 +68,11 @@ public ProcessStarter putEnvironment(Map values) { return this; } + public ProcessStarter redirectOutput(OutputFiles outputFiles) { + this.outputFiles = Optional.of(outputFiles); + return this; + } + public ProcessResult startAndWait() throws InterruptedException { return start().waitFor(); } @@ -75,8 +86,10 @@ public WatchedProcess start() { } builder.environment().putAll(environment); var process = builder.start(); - var out = forwardAndCaptureOutput(process, System.out, ProcessGroovyMethods::consumeProcessOutputStream); - var err = forwardAndCaptureOutput(process, System.err, ProcessGroovyMethods::consumeProcessErrorStream); + var out = forwardAndCaptureOutput(process, System.out, outputFiles.map(OutputFiles::stdOut), + ProcessGroovyMethods::consumeProcessOutputStream); + var err = forwardAndCaptureOutput(process, System.err, outputFiles.map(OutputFiles::stdErr), + ProcessGroovyMethods::consumeProcessErrorStream); return new WatchedProcess(process, out, err); } catch (IOException e) { @@ -85,10 +98,23 @@ public WatchedProcess start() { } private static WatchedOutput forwardAndCaptureOutput(Process process, PrintStream delegate, - BiFunction captureAction) { + Optional outputFile, BiFunction captureAction) { var capturingStream = new ByteArrayOutputStream(); - var thread = captureAction.apply(process, new TeeOutputStream(delegate, capturingStream)); - return new WatchedOutput(thread, capturingStream); + Optional fileStream = outputFile.map(path -> { + try { + return Files.newOutputStream(path); + } + catch (IOException e) { + throw new UncheckedIOException("Failed to open output file: " + path, e); + } + }); + var attachedStream = tee(delegate, fileStream.map(it -> tee(capturingStream, it)).orElse(capturingStream)); + var thread = captureAction.apply(process, attachedStream); + return new WatchedOutput(thread, capturingStream, fileStream); + } + + private static OutputStream tee(OutputStream out, OutputStream branch) { + return new TeeOutputStream(out, branch); } } diff --git a/platform-tests/src/processStarter/java/org/junit/platform/tests/process/WatchedOutput.java b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/WatchedOutput.java index 47cf7e5c2c12..573dd4933128 100644 --- a/platform-tests/src/processStarter/java/org/junit/platform/tests/process/WatchedOutput.java +++ b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/WatchedOutput.java @@ -10,14 +10,15 @@ package org.junit.platform.tests.process; -import java.io.ByteArrayOutputStream; -import java.nio.charset.Charset; +import static org.junit.platform.tests.process.ProcessStarter.OUTPUT_ENCODING; -record WatchedOutput(Thread thread, ByteArrayOutputStream stream) { +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; +import java.util.Optional; - private static final Charset CHARSET = Charset.forName(System.getProperty("native.encoding")); +record WatchedOutput(Thread thread, ByteArrayOutputStream stream, Optional fileStream) { String streamAsString() { - return stream.toString(CHARSET); + return stream.toString(OUTPUT_ENCODING); } } diff --git a/platform-tests/src/processStarter/java/org/junit/platform/tests/process/WatchedProcess.java b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/WatchedProcess.java index 4bf675244197..62bdbd5eede2 100644 --- a/platform-tests/src/processStarter/java/org/junit/platform/tests/process/WatchedProcess.java +++ b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/WatchedProcess.java @@ -10,6 +10,10 @@ package org.junit.platform.tests.process; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Optional; + public class WatchedProcess { private final Process process; @@ -46,6 +50,19 @@ ProcessResult waitFor() throws InterruptedException { } finally { process.destroyForcibly(); + closeQuietly(out.fileStream()); + closeQuietly(err.fileStream()); + } + } + + private static void closeQuietly(Optional fileStream) { + if (fileStream.isEmpty()) { + return; + } + try { + fileStream.get().close(); + } + catch (IOException ignore) { } } } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java index b57d24f4f272..c7cac81bbb4a 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java @@ -22,6 +22,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Timeout; import org.junit.jupiter.api.io.TempDir; +import org.junit.platform.tests.process.OutputFiles; import platform.tooling.support.ProcessStarters; @@ -32,10 +33,11 @@ class AntStarterTests { @Test @Timeout(60) - void ant_starter(@TempDir Path workspace) throws Exception { + void ant_starter(@TempDir Path workspace, @FilePrefix("ant") OutputFiles outputFiles) throws Exception { var result = ProcessStarters.java() // .workingDir(copyToWorkspace(Projects.ANT_STARTER, workspace)) // .addArguments("-cp", System.getProperty("antJars"), Main.class.getName()) // + .redirectOutput(outputFiles) // .startAndWait(); assertEquals(0, result.exitCode()); @@ -57,5 +59,4 @@ void ant_starter(@TempDir Path workspace) throws Exception { var testResultsDir = workspace.resolve("build/test-report"); verifyContainsExpectedStartedOpenTestReport(testResultsDir); } - } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/FilePrefix.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/FilePrefix.java new file mode 100644 index 000000000000..e19dfc041f22 --- /dev/null +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/FilePrefix.java @@ -0,0 +1,25 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package platform.tooling.support.tests; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.junit.jupiter.api.extension.ExtendWith; + +@Target(ElementType.PARAMETER) +@Retention(RetentionPolicy.RUNTIME) +@ExtendWith(OutputAttachingExtension.class) +@interface FilePrefix { + String value(); +} diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java index b9f76e059010..9376899354f1 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java @@ -23,6 +23,7 @@ import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; import org.junit.jupiter.api.extension.DisabledOnOpenJ9; import org.junit.jupiter.api.io.TempDir; +import org.junit.platform.tests.process.OutputFiles; import platform.tooling.support.MavenRepo; import platform.tooling.support.ProcessStarters; @@ -37,12 +38,14 @@ class GraalVmStarterTests { @Test @Timeout(value = 10, unit = MINUTES) - void runsTestsInNativeImage(@TempDir Path workspace) throws Exception { + void runsTestsInNativeImage(@TempDir Path workspace, @FilePrefix("gradle") OutputFiles outputFiles) + throws Exception { var result = ProcessStarters.gradlew() // .workingDir(copyToWorkspace(Projects.GRAALVM_STARTER, workspace)) // .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("javaToolchains", "nativeTest", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // + .redirectOutput(outputFiles) // .startAndWait(); assertEquals(0, result.exitCode()); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java index 042a06b066cc..89364149d815 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java @@ -18,6 +18,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; +import org.junit.platform.tests.process.OutputFiles; import org.opentest4j.TestAbortedException; import platform.tooling.support.Helper; @@ -30,12 +31,13 @@ class GradleKotlinExtensionsTests { @Test - void gradle_wrapper(@TempDir Path workspace) throws Exception { + void gradle_wrapper(@TempDir Path workspace, @FilePrefix("gradle") OutputFiles outputFiles) throws Exception { var result = ProcessStarters.gradlew() // .workingDir(copyToWorkspace(Projects.GRADLE_KOTLIN_EXTENSIONS, workspace)) // .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // + .redirectOutput(outputFiles) // .startAndWait(); assertEquals(0, result.exitCode(), "result=" + result); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java index 6c51f84c5f71..79895cad55c4 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java @@ -19,6 +19,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; import org.junit.platform.reporting.testutil.FileUtils; +import org.junit.platform.tests.process.OutputFiles; import org.opentest4j.TestAbortedException; import platform.tooling.support.Helper; @@ -31,13 +32,13 @@ class GradleMissingEngineTests { @Test - void gradle_wrapper(@TempDir Path workspace) throws Exception { + void gradle_wrapper(@TempDir Path workspace, @FilePrefix("gradle") OutputFiles outputFiles) throws Exception { var result = ProcessStarters.gradlew() // .workingDir(copyToWorkspace(Projects.GRADLE_MISSING_ENGINE, workspace)) // .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // - .startAndWait(); + .redirectOutput(outputFiles).startAndWait(); assertEquals(1, result.exitCode()); assertThat(result.stdErrLines()) // diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java index e2d9297dbd2a..6c61b76125b3 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java @@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; +import org.junit.platform.tests.process.OutputFiles; import org.opentest4j.TestAbortedException; import platform.tooling.support.Helper; @@ -32,12 +33,13 @@ class GradleStarterTests { @Test - void gradle_wrapper(@TempDir Path workspace) throws Exception { + void gradle_wrapper(@TempDir Path workspace, @FilePrefix("gradle") OutputFiles outputFiles) throws Exception { var result = ProcessStarters.gradlew() // .workingDir(copyToWorkspace(Projects.GRADLE_STARTER, workspace)) // .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // + .redirectOutput(outputFiles) // .startAndWait(); assertEquals(0, result.exitCode()); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java index 3bb8ca941ade..94999aaefcaa 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java @@ -21,6 +21,7 @@ import org.junit.jupiter.api.Order; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; +import org.junit.platform.tests.process.OutputFiles; import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; @@ -34,13 +35,14 @@ class JarDescribeModuleTests { @ParameterizedTest @MethodSource("platform.tooling.support.Helper#loadModuleDirectoryNames") - void describeModule(String module) throws Exception { + void describeModule(String module, @FilePrefix("jar") OutputFiles outputFiles) throws Exception { var sourceDirectory = getSourceDirectory(Projects.JAR_DESCRIBE_MODULE); var modulePath = MavenRepo.jar(module); var result = ProcessStarters.javaCommand("jar") // .workingDir(sourceDirectory) // .addArguments("--describe-module", "--file", modulePath.toAbsolutePath().toString()) // + .redirectOutput(outputFiles) // .startAndWait(); assertEquals(0, result.exitCode()); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java index 311a4711084a..fff8079e90d8 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java @@ -22,6 +22,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; +import org.junit.platform.tests.process.OutputFiles; import platform.tooling.support.Helper; import platform.tooling.support.MavenRepo; @@ -39,22 +40,22 @@ class JavaVersionsTests { Path workspace; @Test - void java_8() throws Exception { + void java_8(@FilePrefix("maven") OutputFiles outputFiles) throws Exception { var java8Home = Helper.getJavaHome("8"); assumeTrue(java8Home.isPresent(), "Java 8 installation directory not found!"); - var actualLines = execute(java8Home.get(), Map.of()); + var actualLines = execute(java8Home.get(), outputFiles, Map.of()); assertTrue(actualLines.contains("[WARNING] Tests run: 2, Failures: 0, Errors: 0, Skipped: 1")); } @Test - void java_default() throws Exception { - var actualLines = execute(currentJdkHome(), MavenEnvVars.FOR_JDK24_AND_LATER); + void java_default(@FilePrefix("maven") OutputFiles outputFiles) throws Exception { + var actualLines = execute(currentJdkHome(), outputFiles, MavenEnvVars.FOR_JDK24_AND_LATER); assertTrue(actualLines.contains("[WARNING] Tests run: 2, Failures: 0, Errors: 0, Skipped: 1")); } - List execute(Path javaHome, Map environmentVars) throws Exception { + List execute(Path javaHome, OutputFiles outputFiles, Map environmentVars) throws Exception { var result = ProcessStarters.maven(javaHome) // .workingDir(copyToWorkspace(Projects.JAVA_VERSIONS, workspace)) // .putEnvironment(environmentVars) // diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java index 75e13c36e898..4adbbcec40c1 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java @@ -20,6 +20,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; +import org.junit.platform.tests.process.OutputFiles; import org.opentest4j.TestAbortedException; import platform.tooling.support.Helper; @@ -38,12 +39,14 @@ class MavenStarterTests { MavenRepoProxy mavenRepoProxy; @Test - void verifyMavenStarterProject(@TempDir Path workspace) throws Exception { + void verifyMavenStarterProject(@TempDir Path workspace, @FilePrefix("maven") OutputFiles outputFiles) + throws Exception { var result = ProcessStarters.maven(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // .workingDir(copyToWorkspace(Projects.MAVEN_STARTER, workspace)) // .addArguments(localMavenRepo.toCliArgument(), "-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("-Dsnapshot.repo.url=" + mavenRepoProxy.getBaseUri()) // .addArguments("--update-snapshots", "--batch-mode", "verify") // + .redirectOutput(outputFiles) // .startAndWait(); assertEquals(0, result.exitCode()); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java index d5a379c6c7b4..49066bd07a39 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java @@ -21,6 +21,7 @@ import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; +import org.junit.platform.tests.process.OutputFiles; import org.opentest4j.TestAbortedException; import platform.tooling.support.Helper; @@ -40,8 +41,8 @@ class MavenSurefireCompatibilityTests { 2.22.2 | --activate-profiles=manual-platform-dependency 3.0.0-M4 | """) - void testMavenSurefireCompatibilityProject(String surefireVersion, String extraArg, @TempDir Path workspace) - throws Exception { + void testMavenSurefireCompatibilityProject(String surefireVersion, String extraArg, @TempDir Path workspace, + @FilePrefix("maven") OutputFiles outputFiles) throws Exception { var extraArgs = extraArg == null ? new String[0] : new String[] { extraArg }; var result = ProcessStarters.maven(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // .workingDir(copyToWorkspace(Projects.MAVEN_SUREFIRE_COMPATIBILITY, workspace)) // @@ -49,6 +50,7 @@ void testMavenSurefireCompatibilityProject(String surefireVersion, String extraA .addArguments("-Dsurefire.version=" + surefireVersion) // .addArguments("--update-snapshots", "--batch-mode", "test") // .addArguments(extraArgs) // + .redirectOutput(outputFiles) // .startAndWait(); assertEquals(0, result.exitCode()); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java index 7aa591963757..794de9468ba6 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java @@ -31,6 +31,7 @@ import org.junit.jupiter.api.extension.DisabledOnOpenJ9; import org.junit.jupiter.api.io.TempDir; import org.junit.platform.launcher.LauncherConstants; +import org.junit.platform.tests.process.OutputFiles; import platform.tooling.support.MavenRepo; import platform.tooling.support.ProcessStarters; @@ -121,7 +122,7 @@ private static List compile(Path temp, Writer out, Writer err) throws Ex return args; } - private static void junit(Path temp) throws Exception { + private static void junit(Path temp, OutputFiles outputFiles) throws Exception { var projectDir = Path.of("../documentation").toAbsolutePath(); var result = ProcessStarters.java() // @@ -144,13 +145,15 @@ private static void junit(Path temp) throws Exception { .addArguments("--include-classname", ".*Demo") // .addArguments("--exclude-tag", "exclude") // .addArguments("--exclude-tag", "exclude") // + .redirectOutput(outputFiles) // .startAndWait(); assertEquals(0, result.exitCode()); } @Test - void runTestsFromUserGuideWithinModularBoundaries(@TempDir Path temp) throws Exception { + void runTestsFromUserGuideWithinModularBoundaries(@TempDir Path temp, + @FilePrefix("console-launcher") OutputFiles outputFiles) throws Exception { var out = new StringWriter(); var err = new StringWriter(); @@ -179,7 +182,7 @@ void runTestsFromUserGuideWithinModularBoundaries(@TempDir Path temp) throws Exc // System.out.println("______________"); // listing.forEach(System.out::println); - junit(temp); + junit(temp, outputFiles); } private static void loadAllJUnitModules(Path target) throws Exception { diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java index 6f6ea1112d8c..70c2679fc2d5 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java @@ -22,6 +22,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; +import org.junit.platform.tests.process.OutputFiles; import platform.tooling.support.MavenRepo; import platform.tooling.support.ProcessStarters; @@ -38,7 +39,7 @@ class MultiReleaseJarTests { MavenRepoProxy mavenRepoProxy; @Test - void checkDefault(@TempDir Path workspace) throws Exception { + void checkDefault(@TempDir Path workspace, @FilePrefix("maven") OutputFiles outputFiles) throws Exception { var expectedLines = List.of( // ">> BANNER >>", // ".", // @@ -76,6 +77,7 @@ void checkDefault(@TempDir Path workspace) throws Exception { .addArguments("--update-snapshots", "--show-version", "--errors", "--batch-mode") // .addArguments("test") // .putEnvironment(MavenEnvVars.FOR_JDK24_AND_LATER) // + .redirectOutput(outputFiles) // .startAndWait(); assertEquals(0, result.exitCode()); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/OutputAttachingExtension.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/OutputAttachingExtension.java new file mode 100644 index 000000000000..9e7c2c3fa0e9 --- /dev/null +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/OutputAttachingExtension.java @@ -0,0 +1,99 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package platform.tooling.support.tests; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Comparator; + +import org.junit.jupiter.api.extension.AfterTestExecutionCallback; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.MediaType; +import org.junit.jupiter.api.extension.ParameterContext; +import org.junit.jupiter.api.extension.ParameterResolutionException; +import org.junit.jupiter.api.extension.ParameterResolver; +import org.junit.platform.tests.process.OutputFiles; +import org.junit.platform.tests.process.ProcessStarter; + +class OutputAttachingExtension implements ParameterResolver, AfterTestExecutionCallback { + + private static final ExtensionContext.Namespace NAMESPACE = ExtensionContext.Namespace.create( + OutputAttachingExtension.class); + private static final MediaType MEDIA_TYPE = MediaType.create("text", "plain", ProcessStarter.OUTPUT_ENCODING); + + @Override + public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) + throws ParameterResolutionException { + return parameterContext.isAnnotated(FilePrefix.class); + } + + @Override + public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) + throws ParameterResolutionException { + var outputDir = extensionContext.getStore(NAMESPACE).getOrComputeIfAbsent("outputDir", __ -> { + try { + return new OutputDir(Files.createTempDirectory("output")); + } + catch (Exception e) { + throw new ParameterResolutionException("Failed to create temp directory", e); + } + }, OutputDir.class); + var prefix = parameterContext.findAnnotation(FilePrefix.class) // + .map(FilePrefix::value) // + .orElseThrow(); + return outputDir.toOutputFiles(prefix); + } + + @Override + public void afterTestExecution(ExtensionContext context) throws Exception { + var outputDir = context.getStore(NAMESPACE).get("outputDir", OutputDir.class); + if (outputDir != null) { + try (var stream = Files.list(outputDir.root()).filter(Files::isRegularFile).sorted()) { + stream.filter(OutputAttachingExtension::notEmpty).forEach(file -> { + var fileName = file.getFileName().toString(); + context.publishFile(fileName, MEDIA_TYPE, target -> Files.copy(file, target)); + }); + } + } + } + + private static boolean notEmpty(Path file) { + try { + return Files.size(file) > 0; + } + catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + record OutputDir(Path root) implements ExtensionContext.Store.CloseableResource { + + @Override + public void close() throws Throwable { + try (var stream = Files.walk(root).sorted(Comparator. naturalOrder().reversed())) { + stream.forEach(path -> { + try { + Files.delete(path); + } + catch (IOException e) { + throw new UncheckedIOException("Failed to delete " + path, e); + } + }); + } + } + + private OutputFiles toOutputFiles(String prefix) { + return new OutputFiles(root.resolve(prefix + "-stdout.txt"), root.resolve(prefix + "-stderr.txt")); + } + } +} diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java index 993e8e6012eb..c2f62026313d 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java @@ -19,6 +19,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; +import org.junit.platform.tests.process.OutputFiles; import org.opentest4j.TestAbortedException; import platform.tooling.support.Helper; @@ -31,12 +32,13 @@ class ReflectionCompatibilityTests { @Test - void gradle_wrapper(@TempDir Path workspace) throws Exception { + void gradle_wrapper(@TempDir Path workspace, @FilePrefix("gradle") OutputFiles outputFiles) throws Exception { var result = ProcessStarters.gradlew() // .workingDir(copyToWorkspace(Projects.REFLECTION_TESTS, workspace)) // .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // + .redirectOutput(outputFiles) // .startAndWait(); assertEquals(0, result.exitCode()); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java index 20596d164e35..a511b31f19e2 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java @@ -37,6 +37,7 @@ import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.api.parallel.Execution; +import org.junit.platform.tests.process.OutputFiles; import org.junit.platform.tests.process.ProcessResult; import org.opentest4j.TestAbortedException; @@ -77,11 +78,12 @@ void jarFileWithoutCompiledModuleDescriptorClass() throws Exception { } @Test - void listAllObservableEngines() throws Exception { + void listAllObservableEngines(@FilePrefix("java") OutputFiles outputFiles) throws Exception { var result = ProcessStarters.java() // .workingDir(getSourceDirectory(Projects.STANDALONE)) // .addArguments("-jar", MavenRepo.jar("junit-platform-console-standalone").toString()) // .addArguments("engines", "--disable-ansi-colors", "--disable-banner") // + .redirectOutput(outputFiles) // .startAndWait(); assertEquals(0, result.exitCode()); @@ -98,12 +100,13 @@ void listAllObservableEngines() throws Exception { } @Test - void printVersionViaJar() throws Exception { + void printVersionViaJar(@FilePrefix("java") OutputFiles outputFiles) throws Exception { var result = ProcessStarters.java() // .workingDir(getSourceDirectory(Projects.STANDALONE)) // .addArguments("-jar", MavenRepo.jar("junit-platform-console-standalone").toString()) // .addArguments("--version", "--disable-ansi-colors") // .putEnvironment("CLICOLOR_FORCE", "1") // enable ANSI colors by default (see https://picocli.info/#_heuristics_for_enabling_ansi) + .redirectOutput(outputFiles) // .startAndWait(); assertEquals(0, result.exitCode()); @@ -118,7 +121,7 @@ void printVersionViaJar() throws Exception { } @Test - void printVersionViaModule() throws Exception { + void printVersionViaModule(@FilePrefix("java") OutputFiles outputFiles) throws Exception { var junitJars = Stream.of("junit-platform-console", "junit-platform-reporting", "junit-platform-engine", "junit-platform-launcher", "junit-platform-commons") // .map(MavenRepo::jar); @@ -135,6 +138,7 @@ void printVersionViaModule() throws Exception { .addArguments("--module", "org.junit.platform.console") // .addArguments("--version", "--disable-ansi-colors") // .putEnvironment("CLICOLOR_FORCE", "1") // enable ANSI colors by default (see https://picocli.info/#_heuristics_for_enabling_ansi) + .redirectOutput(outputFiles) // .startAndWait(); assertEquals(0, result.exitCode()); @@ -151,7 +155,8 @@ void printVersionViaModule() throws Exception { @Test @Order(1) @Execution(SAME_THREAD) - void compile() throws Exception { + void compile(@FilePrefix("javac") OutputFiles javacOutputFiles, @FilePrefix("jar") OutputFiles jarOutputFiles) + throws Exception { var result = ProcessStarters.javaCommand("javac") // .workingDir(workspace) // .addArguments("-Xlint:-options") // @@ -163,6 +168,7 @@ void compile() throws Exception { .addArguments(workspace.resolve("src/standalone/JupiterParamsIntegration.java").toString()) // .addArguments(workspace.resolve("src/standalone/SuiteIntegration.java").toString()) // .addArguments(workspace.resolve("src/standalone/VintageIntegration.java").toString()) // + .redirectOutput(javacOutputFiles) // .startAndWait(); assertEquals(0, result.exitCode()); @@ -176,6 +182,7 @@ void compile() throws Exception { .addArguments("--create") // .addArguments("--file", jarFolder.resolve("tests.jar").toString()) // .addArguments("-C", workspace.resolve("bin").toString(), ".") // + .redirectOutput(jarOutputFiles) // .startAndWait(); assertEquals(0, jarResult.exitCode()); } @@ -183,8 +190,8 @@ void compile() throws Exception { @Test @Order(2) @Execution(SAME_THREAD) - void discoverTree() throws Exception { - var result = discover("--details-theme=ascii"); + void discoverTree(@FilePrefix("console-launcher") OutputFiles outputFiles) throws Exception { + var result = discover(outputFiles, "--details-theme=ascii"); var expected = """ . @@ -219,8 +226,8 @@ void discoverTree() throws Exception { @Test @Order(2) @Execution(SAME_THREAD) - void discoverFlat() throws Exception { - var result = discover("--details=flat"); + void discoverFlat(@FilePrefix("console-launcher") OutputFiles outputFiles) throws Exception { + var result = discover(outputFiles, "--details=flat"); var expected = """ JUnit Platform Suite ([engine:junit-platform-suite]) @@ -254,8 +261,8 @@ JUnit Vintage ([engine:junit-vintage]) @Test @Order(2) @Execution(SAME_THREAD) - void discoverVerbose() throws Exception { - var result = discover("--details=verbose", "--details-theme=ascii"); + void discoverVerbose(@FilePrefix("console-launcher") OutputFiles outputFiles) throws Exception { + var result = discover(outputFiles, "--details=verbose", "--details-theme=ascii"); var expected = """ +-- JUnit Platform Suite @@ -339,8 +346,8 @@ void discoverVerbose() throws Exception { @Test @Order(2) @Execution(SAME_THREAD) - void discoverNone() throws Exception { - var result = discover("--details=none"); + void discoverNone(@FilePrefix("console-launcher") OutputFiles outputFiles) throws Exception { + var result = discover(outputFiles, "--details=none"); assertThat(result.stdOut()).isEmpty(); } @@ -348,8 +355,8 @@ void discoverNone() throws Exception { @Test @Order(2) @Execution(SAME_THREAD) - void discoverSummary() throws Exception { - var result = discover("--details=summary"); + void discoverSummary(@FilePrefix("console-launcher") OutputFiles outputFiles) throws Exception { + var result = discover(outputFiles, "--details=summary"); var expected = """ @@ -363,8 +370,8 @@ void discoverSummary() throws Exception { @Test @Order(2) @Execution(SAME_THREAD) - void discoverTestFeed() throws Exception { - var result = discover("--details=testfeed"); + void discoverTestFeed(@FilePrefix("console-launcher") OutputFiles outputFiles) throws Exception { + var result = discover(outputFiles, "--details=testfeed"); var expected = """ JUnit Platform Suite > SuiteIntegration > JUnit Jupiter > SuiteIntegration$SingleTestContainer > successful() JUnit Jupiter > JupiterIntegration > successful() @@ -384,7 +391,7 @@ JUnit Jupiter > JupiterIntegration > disabled() assertLinesMatch(expected.lines(), result.stdOut().lines()); } - private static ProcessResult discover(String... args) throws Exception { + private static ProcessResult discover(OutputFiles outputFiles, String... args) throws Exception { var result = ProcessStarters.java() // .workingDir(workspace) // .putEnvironment("NO_COLOR", "1") // --disable-ansi-colors @@ -395,6 +402,7 @@ private static ProcessResult discover(String... args) throws Exception { .addArguments("--include-classname", "standalone.*") // .addArguments("--classpath", "bin") // .addArguments(args) // + .redirectOutput(outputFiles) // .startAndWait(); assertEquals(0, result.exitCode()); @@ -404,7 +412,7 @@ private static ProcessResult discover(String... args) throws Exception { @Test @Order(3) @Execution(SAME_THREAD) - void execute() throws Exception { + void execute(@FilePrefix("console-launcher") OutputFiles outputFiles) throws Exception { var result = ProcessStarters.java() // .workingDir(workspace) // .putEnvironment("NO_COLOR", "1") // --disable-ansi-colors @@ -418,6 +426,7 @@ void execute() throws Exception { .addArguments("--disable-banner") // .addArguments("--include-classname", "standalone.*") // .addArguments("--classpath", "bin") // + .redirectOutput(outputFiles) // .startAndWait(); assertEquals(1, result.exitCode()); @@ -444,7 +453,7 @@ void execute() throws Exception { @Test @Order(4) @Execution(SAME_THREAD) - void executeOnJava8() throws Exception { + void executeOnJava8(@FilePrefix("console-launcher") OutputFiles outputFiles) throws Exception { var java8Home = Helper.getJavaHome("8").orElseThrow(TestAbortedException::new); var result = ProcessStarters.java(java8Home) // .workingDir(workspace) // @@ -458,6 +467,7 @@ void executeOnJava8() throws Exception { .addArguments("--disable-banner") // .addArguments("--include-classname", "standalone.*") // .addArguments("--classpath", "bin") // + .redirectOutput(outputFiles) // .startAndWait(); assertEquals(1, result.exitCode()); @@ -479,7 +489,7 @@ void executeOnJava8() throws Exception { @Order(5) @Execution(SAME_THREAD) // https://github.com/junit-team/junit5/issues/2600 - void executeOnJava8SelectPackage() throws Exception { + void executeOnJava8SelectPackage(@FilePrefix("console-launcher") OutputFiles outputFiles) throws Exception { var java8Home = Helper.getJavaHome("8").orElseThrow(TestAbortedException::new); var result = ProcessStarters.java(java8Home) // .workingDir(workspace).addArguments("-showversion") // @@ -492,6 +502,7 @@ void executeOnJava8SelectPackage() throws Exception { .addArguments("--disable-banner") // .addArguments("--include-classname", "standalone.*") // .addArguments("--classpath", "bin") // + .redirectOutput(outputFiles) // .startAndWait(); assertEquals(1, result.exitCode()); @@ -520,7 +531,7 @@ private static List getExpectedErrLinesOnJava8(Path workspace) throws IO @Order(6) @Execution(SAME_THREAD) @Disabled("https://github.com/junit-team/junit5/issues/1724") - void executeWithJarredTestClasses() throws Exception { + void executeWithJarredTestClasses(@FilePrefix("console-launcher") OutputFiles outputFiles) throws Exception { var jar = MavenRepo.jar("junit-platform-console-standalone"); var path = new ArrayList(); // path.add("bin"); // "exploded" test classes are found, see also test() above @@ -537,6 +548,7 @@ void executeWithJarredTestClasses() throws Exception { .addArguments("--disable-banner") // .addArguments("--include-classname", "standalone.*") // .addArguments("--fail-if-no-tests") // + .redirectOutput(outputFiles) // .startAndWait(); assertEquals(1, result.exitCode()); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java index e6088c074900..b29abc319d76 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java @@ -19,6 +19,7 @@ import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import org.junit.platform.tests.process.OutputFiles; import org.junit.platform.tests.process.ProcessResult; import org.opentest4j.TestAbortedException; @@ -32,8 +33,8 @@ class VintageGradleIntegrationTests { Path workspace; @Test - void unsupportedVersion() throws Exception { - var result = run("4.11"); + void unsupportedVersion(@FilePrefix("gradle") OutputFiles outputFiles) throws Exception { + var result = run(outputFiles, "4.11"); assertThat(result.exitCode()).isGreaterThan(0); assertThat(result.stdOut()) // @@ -43,8 +44,8 @@ void unsupportedVersion() throws Exception { @ParameterizedTest(name = "{0}") @ValueSource(strings = { "4.12", "4.13.2" }) - void supportedVersions(String version) throws Exception { - var result = run(version); + void supportedVersions(String version, @FilePrefix("gradle") OutputFiles outputFiles) throws Exception { + var result = run(outputFiles, version); assertThat(result.exitCode()).isGreaterThan(0); assertThat(result.stdOut()) // @@ -55,13 +56,14 @@ void supportedVersions(String version) throws Exception { assertThat(testResultsDir.resolve("TEST-com.example.vintage.VintageTest.xml")).isRegularFile(); } - private ProcessResult run(String version) throws Exception { + private ProcessResult run(OutputFiles outputFiles, String version) throws Exception { return ProcessStarters.gradlew() // .workingDir(copyToWorkspace(Projects.VINTAGE, workspace)) // .putEnvironment("JDK8", Helper.getJavaHome("8").orElseThrow(TestAbortedException::new).toString()) // .addArguments("build", "--no-daemon", "--stacktrace", "--no-build-cache", "--warning-mode=fail") // .addArguments("-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("-Djunit4Version=" + version) // + .redirectOutput(outputFiles) // .startAndWait(); } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java index 09e16b826cdb..9fc4294a3d5e 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java @@ -19,6 +19,7 @@ import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; +import org.junit.platform.tests.process.OutputFiles; import org.junit.platform.tests.process.ProcessResult; import org.opentest4j.TestAbortedException; @@ -35,8 +36,8 @@ class VintageMavenIntegrationTests { Path workspace; @Test - void unsupportedVersion() throws Exception { - var result = run("4.11"); + void unsupportedVersion(@FilePrefix("maven") OutputFiles outputFiles) throws Exception { + var result = run(outputFiles, "4.11"); assertThat(result.exitCode()).isEqualTo(1); assertThat(result.stdOut()) // @@ -46,8 +47,8 @@ void unsupportedVersion() throws Exception { @ParameterizedTest(name = "{0}") @ValueSource(strings = { "4.12", "4.13.2" }) - void supportedVersions(String version) throws Exception { - var result = run(version); + void supportedVersions(String version, @FilePrefix("maven") OutputFiles outputFiles) throws Exception { + var result = run(outputFiles, version); assertThat(result.exitCode()).isGreaterThan(0); assertThat(result.stdOut()) // @@ -60,12 +61,13 @@ void supportedVersions(String version) throws Exception { assertThat(surefireReportsDir.resolve("TEST-com.example.vintage.VintageTest.xml")).isRegularFile(); } - private ProcessResult run(String version) throws Exception { + private ProcessResult run(OutputFiles outputFiles, String version) throws Exception { return ProcessStarters.maven(Helper.getJavaHome("8").orElseThrow(TestAbortedException::new)) // .workingDir(copyToWorkspace(Projects.VINTAGE, workspace)) // .addArguments("clean", "test", "--update-snapshots", "--batch-mode") // .addArguments(localMavenRepo.toCliArgument(), "-Dmaven.repo=" + MavenRepo.dir()) // .addArguments("-Djunit4Version=" + version) // + .redirectOutput(outputFiles) // .startAndWait(); } From 7593ded3d68ffdf11439eb5fe18328d2a06c2d92 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 20 Dec 2024 09:00:26 +0100 Subject: [PATCH 424/611] Add native-image.properties files to jars (#4208) This allows adding or removing entries from the set of classes that are initialized at native image build time without requiring changes to graalvm/native-build-tools. The new precompiled script plugin introduced in this commit defines two Gradle tasks: `nativeImageProperties` and `validateNativeImageProperties`. The former is used for writing the `native-image.properties` file to the correct resource folder based (by convention) on the `src/nativeImage/initialize-at-build-time` file in each affected subproject. The latter validates that all listed classes exist and acts as a safeguard when classes are renamed or deleted. Resolves #4207. --- ...itbuild.native-image-properties.gradle.kts | 55 +++++++++++++++++++ .../graalvm/NativeImagePropertiesExtension.kt | 7 +++ .../junit-jupiter-api.gradle.kts | 1 + .../src/nativeImage/initialize-at-build-time | 4 ++ .../junit-jupiter-engine.gradle.kts | 1 + .../src/nativeImage/initialize-at-build-time | 22 ++++++++ .../junit-jupiter-params.gradle.kts | 1 + .../src/nativeImage/initialize-at-build-time | 2 + .../junit-platform-commons.gradle.kts | 1 + .../src/nativeImage/initialize-at-build-time | 5 ++ .../junit-platform-engine.gradle.kts | 1 + .../src/nativeImage/initialize-at-build-time | 7 +++ .../junit-platform-launcher.gradle.kts | 1 + .../src/nativeImage/initialize-at-build-time | 19 +++++++ .../junit-platform-reporting.gradle.kts | 1 + .../src/nativeImage/initialize-at-build-time | 2 + .../junit-platform-suite-engine.gradle.kts | 1 + .../src/nativeImage/initialize-at-build-time | 4 ++ .../junit-vintage-engine.gradle.kts | 1 + .../src/nativeImage/initialize-at-build-time | 5 ++ .../projects/graalvm-starter/build.gradle.kts | 11 +++- .../com/example/project/GraalvmSuite.java | 18 ++++++ .../com/example/project/VintageTests.java | 19 +++++++ .../support/tests/GraalVmStarterTests.java | 1 + 24 files changed, 187 insertions(+), 3 deletions(-) create mode 100644 gradle/plugins/common/src/main/kotlin/junitbuild.native-image-properties.gradle.kts create mode 100644 gradle/plugins/common/src/main/kotlin/junitbuild/graalvm/NativeImagePropertiesExtension.kt create mode 100644 junit-jupiter-api/src/nativeImage/initialize-at-build-time create mode 100644 junit-jupiter-engine/src/nativeImage/initialize-at-build-time create mode 100644 junit-jupiter-params/src/nativeImage/initialize-at-build-time create mode 100644 junit-platform-commons/src/nativeImage/initialize-at-build-time create mode 100644 junit-platform-engine/src/nativeImage/initialize-at-build-time create mode 100644 junit-platform-launcher/src/nativeImage/initialize-at-build-time create mode 100644 junit-platform-reporting/src/nativeImage/initialize-at-build-time create mode 100644 junit-platform-suite-engine/src/nativeImage/initialize-at-build-time create mode 100644 junit-vintage-engine/src/nativeImage/initialize-at-build-time create mode 100644 platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/GraalvmSuite.java create mode 100644 platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/VintageTests.java diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.native-image-properties.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.native-image-properties.gradle.kts new file mode 100644 index 000000000000..262535f2083a --- /dev/null +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.native-image-properties.gradle.kts @@ -0,0 +1,55 @@ +import junitbuild.graalvm.NativeImagePropertiesExtension +import java.util.zip.ZipFile + +plugins { + `java-library` +} + +val extension = extensions.create("nativeImageProperties").apply { + val resourceFile: RegularFile = layout.projectDirectory.file("src/nativeImage/initialize-at-build-time") + if (resourceFile.asFile.exists()) { + initializeAtBuildTime.convention(providers.fileContents(resourceFile).asText.map { it.trim().lines() }) + } else { + initializeAtBuildTime.empty() + } + initializeAtBuildTime.finalizeValueOnRead() +} + +val outputDir = layout.buildDirectory.dir("resources/nativeImage") + +val propertyFileTask = tasks.register("nativeImageProperties") { + destinationFile = outputDir.map { it.file("META-INF/native-image/${project.group}/${project.name}/native-image.properties") } + // see https://www.graalvm.org/latest/reference-manual/native-image/overview/BuildConfiguration/#configuration-file-format + property("Args", extension.initializeAtBuildTime.map { + if (it.isEmpty()) { + "" + } else { + "--initialize-at-build-time=${it.joinToString(",")}" + } + }) +} + +val validationTask = tasks.register("validateNativeImageProperties") { + dependsOn(tasks.jar) + doLast { + val zipEntries = ZipFile(tasks.jar.get().archiveFile.get().asFile).use { zipFile -> + zipFile.entries().asSequence().map { it.name }.filter { it.endsWith(".class") }.toSet() + } + val missingClasses = extension.initializeAtBuildTime.get().filter { className -> + !zipEntries.contains("${className.replace('.', '/')}.class") + } + if (missingClasses.isNotEmpty()) { + throw GradleException("The following classes were specified as initialize-at-build-time but do not exist (you should probably remove them from nativeImageProperties.initializeAtBuildTime):\n${missingClasses.joinToString("\n- ", "- ")}") + } + } +} + +tasks.check { + dependsOn(validationTask) +} + +sourceSets { + main { + output.dir(propertyFileTask.map { outputDir }) + } +} diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild/graalvm/NativeImagePropertiesExtension.kt b/gradle/plugins/common/src/main/kotlin/junitbuild/graalvm/NativeImagePropertiesExtension.kt new file mode 100644 index 000000000000..48cb4042c439 --- /dev/null +++ b/gradle/plugins/common/src/main/kotlin/junitbuild/graalvm/NativeImagePropertiesExtension.kt @@ -0,0 +1,7 @@ +package junitbuild.graalvm + +import org.gradle.api.provider.SetProperty + +abstract class NativeImagePropertiesExtension { + abstract val initializeAtBuildTime: SetProperty +} diff --git a/junit-jupiter-api/junit-jupiter-api.gradle.kts b/junit-jupiter-api/junit-jupiter-api.gradle.kts index 402b5323eb57..378fc86a3d5d 100644 --- a/junit-jupiter-api/junit-jupiter-api.gradle.kts +++ b/junit-jupiter-api/junit-jupiter-api.gradle.kts @@ -1,6 +1,7 @@ plugins { id("junitbuild.kotlin-library-conventions") id("junitbuild.code-generator") + id("junitbuild.native-image-properties") `java-test-fixtures` } diff --git a/junit-jupiter-api/src/nativeImage/initialize-at-build-time b/junit-jupiter-api/src/nativeImage/initialize-at-build-time new file mode 100644 index 000000000000..b8fb5c3d7514 --- /dev/null +++ b/junit-jupiter-api/src/nativeImage/initialize-at-build-time @@ -0,0 +1,4 @@ +org.junit.jupiter.api.DisplayNameGenerator$Standard +org.junit.jupiter.api.TestInstance$Lifecycle +org.junit.jupiter.api.condition.OS +org.junit.jupiter.api.extension.ConditionEvaluationResult diff --git a/junit-jupiter-engine/junit-jupiter-engine.gradle.kts b/junit-jupiter-engine/junit-jupiter-engine.gradle.kts index 04d86e5f0da7..819993462c0e 100644 --- a/junit-jupiter-engine/junit-jupiter-engine.gradle.kts +++ b/junit-jupiter-engine/junit-jupiter-engine.gradle.kts @@ -1,5 +1,6 @@ plugins { id("junitbuild.kotlin-library-conventions") + id("junitbuild.native-image-properties") `java-test-fixtures` } diff --git a/junit-jupiter-engine/src/nativeImage/initialize-at-build-time b/junit-jupiter-engine/src/nativeImage/initialize-at-build-time new file mode 100644 index 000000000000..05880451fb5a --- /dev/null +++ b/junit-jupiter-engine/src/nativeImage/initialize-at-build-time @@ -0,0 +1,22 @@ +org.junit.jupiter.engine.JupiterTestEngine +org.junit.jupiter.engine.config.CachingJupiterConfiguration +org.junit.jupiter.engine.config.DefaultJupiterConfiguration +org.junit.jupiter.engine.config.EnumConfigurationParameterConverter +org.junit.jupiter.engine.config.InstantiatingConfigurationParameterConverter +org.junit.jupiter.engine.descriptor.ClassTestDescriptor +org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor +org.junit.jupiter.engine.descriptor.DynamicDescendantFilter +org.junit.jupiter.engine.descriptor.ExclusiveResourceCollector$1 +org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor +org.junit.jupiter.engine.descriptor.JupiterTestDescriptor +org.junit.jupiter.engine.descriptor.JupiterTestDescriptor$1 +org.junit.jupiter.engine.descriptor.MethodBasedTestDescriptor +org.junit.jupiter.engine.descriptor.NestedClassTestDescriptor +org.junit.jupiter.engine.descriptor.TestFactoryTestDescriptor +org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor +org.junit.jupiter.engine.descriptor.TestTemplateTestDescriptor +org.junit.jupiter.engine.execution.ConditionEvaluator +org.junit.jupiter.engine.execution.InterceptingExecutableInvoker +org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall +org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall$VoidMethodInterceptorCall +org.junit.jupiter.engine.execution.InvocationInterceptorChain diff --git a/junit-jupiter-params/junit-jupiter-params.gradle.kts b/junit-jupiter-params/junit-jupiter-params.gradle.kts index d05a3b72e3e4..e481fdd13674 100644 --- a/junit-jupiter-params/junit-jupiter-params.gradle.kts +++ b/junit-jupiter-params/junit-jupiter-params.gradle.kts @@ -2,6 +2,7 @@ plugins { id("junitbuild.kotlin-library-conventions") id("junitbuild.shadow-conventions") id("junitbuild.jmh-conventions") + id("junitbuild.native-image-properties") } description = "JUnit Jupiter Params" diff --git a/junit-jupiter-params/src/nativeImage/initialize-at-build-time b/junit-jupiter-params/src/nativeImage/initialize-at-build-time new file mode 100644 index 000000000000..44ca7ffbd8ad --- /dev/null +++ b/junit-jupiter-params/src/nativeImage/initialize-at-build-time @@ -0,0 +1,2 @@ +org.junit.jupiter.params.provider.EnumSource$Mode +org.junit.jupiter.params.provider.EnumSource$Mode$Validator diff --git a/junit-platform-commons/junit-platform-commons.gradle.kts b/junit-platform-commons/junit-platform-commons.gradle.kts index 3465b0078020..3de45a7edfee 100644 --- a/junit-platform-commons/junit-platform-commons.gradle.kts +++ b/junit-platform-commons/junit-platform-commons.gradle.kts @@ -3,6 +3,7 @@ import junitbuild.java.UpdateJarAction plugins { id("junitbuild.java-library-conventions") id("junitbuild.java-multi-release-sources") + id("junitbuild.native-image-properties") `java-test-fixtures` } diff --git a/junit-platform-commons/src/nativeImage/initialize-at-build-time b/junit-platform-commons/src/nativeImage/initialize-at-build-time new file mode 100644 index 000000000000..a6c384232123 --- /dev/null +++ b/junit-platform-commons/src/nativeImage/initialize-at-build-time @@ -0,0 +1,5 @@ +org.junit.platform.commons.util.StringUtils +org.junit.platform.commons.logging.LoggerFactory$DelegatingLogger +org.junit.platform.commons.logging.LoggerFactory +org.junit.platform.commons.util.ReflectionUtils +org.junit.platform.commons.util.LruCache diff --git a/junit-platform-engine/junit-platform-engine.gradle.kts b/junit-platform-engine/junit-platform-engine.gradle.kts index 416b227b00c1..ef73763146a5 100644 --- a/junit-platform-engine/junit-platform-engine.gradle.kts +++ b/junit-platform-engine/junit-platform-engine.gradle.kts @@ -1,5 +1,6 @@ plugins { id("junitbuild.java-library-conventions") + id("junitbuild.native-image-properties") `java-test-fixtures` } diff --git a/junit-platform-engine/src/nativeImage/initialize-at-build-time b/junit-platform-engine/src/nativeImage/initialize-at-build-time new file mode 100644 index 000000000000..5b1168bb74a6 --- /dev/null +++ b/junit-platform-engine/src/nativeImage/initialize-at-build-time @@ -0,0 +1,7 @@ +org.junit.platform.engine.TestDescriptor$Type +org.junit.platform.engine.UniqueId +org.junit.platform.engine.UniqueId$Segment +org.junit.platform.engine.UniqueIdFormat +org.junit.platform.engine.support.descriptor.ClassSource +org.junit.platform.engine.support.descriptor.MethodSource +org.junit.platform.engine.support.hierarchical.Node$ExecutionMode diff --git a/junit-platform-launcher/junit-platform-launcher.gradle.kts b/junit-platform-launcher/junit-platform-launcher.gradle.kts index a9b3630762c8..acda6a79436f 100644 --- a/junit-platform-launcher/junit-platform-launcher.gradle.kts +++ b/junit-platform-launcher/junit-platform-launcher.gradle.kts @@ -1,5 +1,6 @@ plugins { id("junitbuild.java-library-conventions") + id("junitbuild.native-image-properties") `java-test-fixtures` } diff --git a/junit-platform-launcher/src/nativeImage/initialize-at-build-time b/junit-platform-launcher/src/nativeImage/initialize-at-build-time new file mode 100644 index 000000000000..4b3770ab5fb1 --- /dev/null +++ b/junit-platform-launcher/src/nativeImage/initialize-at-build-time @@ -0,0 +1,19 @@ +org.junit.platform.launcher.LauncherSessionListener$1 +org.junit.platform.launcher.TestIdentifier +org.junit.platform.launcher.core.DefaultLauncher +org.junit.platform.launcher.core.DefaultLauncherConfig +org.junit.platform.launcher.core.EngineDiscoveryOrchestrator +org.junit.platform.launcher.core.EngineExecutionOrchestrator +org.junit.platform.launcher.core.HierarchicalOutputDirectoryProvider +org.junit.platform.launcher.core.InternalTestPlan +org.junit.platform.launcher.core.LauncherConfig +org.junit.platform.launcher.core.LauncherConfigurationParameters +org.junit.platform.launcher.core.LauncherConfigurationParameters$ParameterProvider$1 +org.junit.platform.launcher.core.LauncherConfigurationParameters$ParameterProvider$2 +org.junit.platform.launcher.core.LauncherConfigurationParameters$ParameterProvider$3 +org.junit.platform.launcher.core.LauncherConfigurationParameters$ParameterProvider$4 +org.junit.platform.launcher.core.LauncherDiscoveryResult +org.junit.platform.launcher.core.LauncherListenerRegistry +org.junit.platform.launcher.core.ListenerRegistry +org.junit.platform.launcher.core.SessionPerRequestLauncher +org.junit.platform.launcher.listeners.UniqueIdTrackingListener diff --git a/junit-platform-reporting/junit-platform-reporting.gradle.kts b/junit-platform-reporting/junit-platform-reporting.gradle.kts index f1dede61555d..e9094c04f2e1 100644 --- a/junit-platform-reporting/junit-platform-reporting.gradle.kts +++ b/junit-platform-reporting/junit-platform-reporting.gradle.kts @@ -1,5 +1,6 @@ plugins { id("junitbuild.java-library-conventions") + id("junitbuild.native-image-properties") id("junitbuild.shadow-conventions") `java-test-fixtures` } diff --git a/junit-platform-reporting/src/nativeImage/initialize-at-build-time b/junit-platform-reporting/src/nativeImage/initialize-at-build-time new file mode 100644 index 000000000000..1b4f355f53cf --- /dev/null +++ b/junit-platform-reporting/src/nativeImage/initialize-at-build-time @@ -0,0 +1,2 @@ +org.junit.platform.reporting.open.xml.OpenTestReportGeneratingListener +org.junit.platform.reporting.shadow.org.opentest4j.reporting.events.api.DocumentWriter$1 diff --git a/junit-platform-suite-engine/junit-platform-suite-engine.gradle.kts b/junit-platform-suite-engine/junit-platform-suite-engine.gradle.kts index 36abcdbc088d..72f90de35321 100644 --- a/junit-platform-suite-engine/junit-platform-suite-engine.gradle.kts +++ b/junit-platform-suite-engine/junit-platform-suite-engine.gradle.kts @@ -1,5 +1,6 @@ plugins { id("junitbuild.java-library-conventions") + id("junitbuild.native-image-properties") } description = "JUnit Platform Suite Engine" diff --git a/junit-platform-suite-engine/src/nativeImage/initialize-at-build-time b/junit-platform-suite-engine/src/nativeImage/initialize-at-build-time new file mode 100644 index 000000000000..a6d7d06046b1 --- /dev/null +++ b/junit-platform-suite-engine/src/nativeImage/initialize-at-build-time @@ -0,0 +1,4 @@ +org.junit.platform.suite.engine.SuiteEngineDescriptor +org.junit.platform.suite.engine.SuiteLauncher +org.junit.platform.suite.engine.SuiteTestDescriptor +org.junit.platform.suite.engine.SuiteTestEngine diff --git a/junit-vintage-engine/junit-vintage-engine.gradle.kts b/junit-vintage-engine/junit-vintage-engine.gradle.kts index 9390bdcd3b4e..d2b22d6b711f 100644 --- a/junit-vintage-engine/junit-vintage-engine.gradle.kts +++ b/junit-vintage-engine/junit-vintage-engine.gradle.kts @@ -1,6 +1,7 @@ plugins { id("junitbuild.java-library-conventions") id("junitbuild.junit4-compatibility") + id("junitbuild.native-image-properties") id("junitbuild.testing-conventions") `java-test-fixtures` groovy diff --git a/junit-vintage-engine/src/nativeImage/initialize-at-build-time b/junit-vintage-engine/src/nativeImage/initialize-at-build-time new file mode 100644 index 000000000000..75ff3d41de5a --- /dev/null +++ b/junit-vintage-engine/src/nativeImage/initialize-at-build-time @@ -0,0 +1,5 @@ +org.junit.vintage.engine.VintageTestEngine +org.junit.vintage.engine.descriptor.RunnerTestDescriptor +org.junit.vintage.engine.descriptor.VintageEngineDescriptor +org.junit.vintage.engine.support.UniqueIdReader +org.junit.vintage.engine.support.UniqueIdStringifier diff --git a/platform-tooling-support-tests/projects/graalvm-starter/build.gradle.kts b/platform-tooling-support-tests/projects/graalvm-starter/build.gradle.kts index 77a7a5053c65..6203c65fdcac 100644 --- a/platform-tooling-support-tests/projects/graalvm-starter/build.gradle.kts +++ b/platform-tooling-support-tests/projects/graalvm-starter/build.gradle.kts @@ -5,6 +5,7 @@ plugins { val jupiterVersion: String by project val platformVersion: String by project +val vintageVersion: String by project repositories { maven { url = uri(file(System.getProperty("maven.repo"))) } @@ -13,11 +14,16 @@ repositories { dependencies { testImplementation("org.junit.jupiter:junit-jupiter:$jupiterVersion") + testImplementation("junit:junit:4.13.2") + testImplementation("org.junit.platform:junit-platform-suite:$platformVersion") + testRuntimeOnly("org.junit.vintage:junit-vintage-engine:$vintageVersion") testRuntimeOnly("org.junit.platform:junit-platform-reporting:$platformVersion") } tasks.test { - useJUnitPlatform() + useJUnitPlatform { + includeEngines("junit-platform-suite") + } val outputDir = reports.junitXml.outputLocation jvmArgumentProviders += CommandLineArgumentProvider { @@ -31,8 +37,7 @@ tasks.test { graalvmNative { binaries { named("test") { - // TODO #3040 Add to native-image.properties - buildArgs.add("--initialize-at-build-time=org.junit.platform.launcher.core.HierarchicalOutputDirectoryProvider") + buildArgs.add("--strict-image-heap") buildArgs.add("-H:+ReportExceptionStackTraces") } } diff --git a/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/GraalvmSuite.java b/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/GraalvmSuite.java new file mode 100644 index 000000000000..82796513068d --- /dev/null +++ b/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/GraalvmSuite.java @@ -0,0 +1,18 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package com.example.project; + +import org.junit.platform.suite.api.*; + +@Suite +@SelectPackages("com.example.project") +public class GraalvmSuite { +} diff --git a/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/VintageTests.java b/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/VintageTests.java new file mode 100644 index 000000000000..3ce117dea75b --- /dev/null +++ b/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/VintageTests.java @@ -0,0 +1,19 @@ +/* + * Copyright 2015-2024 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package com.example.project; + +import org.junit.Test; + +public class VintageTests { + @Test + public void test() { + } +} diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java index 9376899354f1..1a36ff86d129 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java @@ -53,6 +53,7 @@ void runsTestsInNativeImage(@TempDir Path workspace, @FilePrefix("gradle") Outpu .anyMatch(line -> line.contains("CalculatorTests > 1 + 1 = 2 SUCCESSFUL")) // .anyMatch(line -> line.contains("CalculatorTests > 1 + 100 = 101 SUCCESSFUL")) // .anyMatch(line -> line.contains("ClassLevelAnnotationTests$Inner > test() SUCCESSFUL")) // + .anyMatch(line -> line.contains("com.example.project.VintageTests > test SUCCESSFUL")) // .anyMatch(line -> line.contains("BUILD SUCCESSFUL")); } } From d36d653bad57345782c6d181a97faa4349bccbd8 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 20 Dec 2024 09:06:46 +0100 Subject: [PATCH 425/611] Document #4207 in release notes --- .../release-notes/release-notes-5.12.0-M1.adoc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 4b3b26d38b76..3c29620bee9a 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -10,6 +10,17 @@ link:{junit5-repo}+/milestone/75?closed=1+[5.12.0-M1] milestone page in the JUnit repository on GitHub. +[[release-notes-5.12.0-M1-overall-improvements]] +=== Overall Improvements + +[[release-notes-5.12.0-M1-overall-new-features-and-improvements]] +==== New Features and Improvements + +* All affected JAR files now include `native-image.properties` files that contain the + `--initialize-at-build-time` option to avoid breakages in GraalVM projects when updating + to newer versions of JUnit. + + [[release-notes-5.12.0-M1-junit-platform]] === JUnit Platform From c1efd003b89d0e4040f76e6bfacd78d40be5ae78 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 08:21:14 +0000 Subject: [PATCH 426/611] Update dependency org.assertj:assertj-core to v3.27.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 53037426b835..908b15934c0c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,7 +3,7 @@ ant = "1.10.15" apiguardian = "1.1.2" asciidoctorj-pdf = "2.3.19" asciidoctor-plugins = "4.0.3" # Check if workaround in documentation.gradle.kts can be removed when upgrading -assertj = "3.26.3" +assertj = "3.27.0" bnd = "7.1.0" checkstyle = "10.21.0" eclipse = "4.34.0" From f535af39e33c4af635ecd1d80b2ca158d1c6087b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 09:11:32 +0000 Subject: [PATCH 427/611] Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-core to v1.10.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 908b15934c0c..e323309f3d57 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -47,7 +47,7 @@ jmh-generator-annprocess = { module = "org.openjdk.jmh:jmh-generator-annprocess" joox = { module = "org.jooq:joox", version = "2.0.1" } jte = { module = "gg.jte:jte", version = "3.1.15" } junit4 = { module = "junit:junit", version = { require = "[4.12,)", prefer = "4.13.2" } } -kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.9.0" } +kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.10.0" } log4j-core = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j" } log4j-jul = { module = "org.apache.logging.log4j:log4j-jul", version.ref = "log4j" } maven = { module = "org.apache.maven:apache-maven", version = "3.9.9" } From 963a9fd6557260d0329c34433008db1c093a4ea5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 20:31:55 +0000 Subject: [PATCH 428/611] Update github/codeql-action digest to 48ab28a --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/ossf-scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 95a8e40797b4..6bdcd3958901 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -34,7 +34,7 @@ jobs: - name: Check out repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Initialize CodeQL - uses: github/codeql-action/init@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3 + uses: github/codeql-action/init@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3 with: languages: ${{ matrix.language }} tools: linked @@ -47,4 +47,4 @@ jobs: -Dscan.tag.CodeQL \ allMainClasses - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3 + uses: github/codeql-action/analyze@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3 diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index e9f84d9ab498..85adecb323ac 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard (optional). # Commenting out will disable upload of results to your repo's Code Scanning dashboard - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3 + uses: github/codeql-action/upload-sarif@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3 with: sarif_file: results.sarif From 77b76145dbd5d3a6935464bebdad844274f3e654 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 17:08:16 +0000 Subject: [PATCH 429/611] Update dependency gradle to v8.12 --- gradle/wrapper/gradle-wrapper.properties | 4 ++-- gradlew | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index eb1a55be0e15..e1b837a19c22 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=f397b287023acdba1e9f6fc5ea72d22dd63669d59ed4a289a29b1a76eee151c6 -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip +distributionSha256Sum=7a00d51fb93147819aab76024feece20b6b84e420694101f276be952e08bef03 +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index f5feea6d6b11..f3b75f3b0d4f 100755 --- a/gradlew +++ b/gradlew @@ -86,8 +86,7 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s -' "$PWD" ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum From efc375d763ac83019523ac40497b4301df3d9bb2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 21 Dec 2024 12:38:38 +0000 Subject: [PATCH 430/611] Update dependency org.jetbrains.kotlinx:kotlinx-coroutines-core to v1.10.1 (#4215) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e323309f3d57..b14409d0d9ef 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -47,7 +47,7 @@ jmh-generator-annprocess = { module = "org.openjdk.jmh:jmh-generator-annprocess" joox = { module = "org.jooq:joox", version = "2.0.1" } jte = { module = "gg.jte:jte", version = "3.1.15" } junit4 = { module = "junit:junit", version = { require = "[4.12,)", prefer = "4.13.2" } } -kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.10.0" } +kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.10.1" } log4j-core = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j" } log4j-jul = { module = "org.apache.logging.log4j:log4j-jul", version.ref = "log4j" } maven = { module = "org.apache.maven:apache-maven", version = "3.9.9" } From 863e4d40c4bd5073a246b255f21b0f20eba16e38 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 28 Dec 2024 15:06:22 +0000 Subject: [PATCH 431/611] Update dependency com.puppycrawl.tools:checkstyle to v10.21.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b14409d0d9ef..0dbe6b31936c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ asciidoctorj-pdf = "2.3.19" asciidoctor-plugins = "4.0.3" # Check if workaround in documentation.gradle.kts can be removed when upgrading assertj = "3.27.0" bnd = "7.1.0" -checkstyle = "10.21.0" +checkstyle = "10.21.1" eclipse = "4.34.0" jackson = "2.18.2" jacoco = "0.8.12" From 5a4e409fece125192f096b7216820df63ae0ad9c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 28 Dec 2024 15:22:54 +0000 Subject: [PATCH 432/611] Update asciidoctor.plugins to v4.0.4 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0dbe6b31936c..774066c9be9e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,7 +2,7 @@ ant = "1.10.15" apiguardian = "1.1.2" asciidoctorj-pdf = "2.3.19" -asciidoctor-plugins = "4.0.3" # Check if workaround in documentation.gradle.kts can be removed when upgrading +asciidoctor-plugins = "4.0.4" # Check if workaround in documentation.gradle.kts can be removed when upgrading assertj = "3.27.0" bnd = "7.1.0" checkstyle = "10.21.1" From bd3b94545f40cbcfe790debd0814fb0680e9e6cc Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 30 Dec 2024 17:37:50 +0100 Subject: [PATCH 433/611] Work around CVE-2024-12798 and CVE-2024-12801 in Logback --- gradle/libs.versions.toml | 2 ++ .../kotlin/junitbuild.checkstyle-nohttp.gradle.kts | 11 +++++++++++ .../kotlin/junitbuild.spotless-conventions.gradle.kts | 10 ++++++++++ 3 files changed, 23 insertions(+) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 774066c9be9e..6aaf92f83d47 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -14,6 +14,7 @@ junit4 = "4.13.2" junit4Min = "4.12" ktlint = "1.5.0" log4j = "2.24.3" +logback = "1.5.15" mockito = "5.14.2" opentest4j = "1.3.0" openTestReporting = "0.2.0-SNAPSHOT" @@ -76,6 +77,7 @@ eclipse-platform = { module = "org.eclipse.platform:org.eclipse.platform", versi jacoco = { module = "org.jacoco:jacoco", version.ref = "jacoco" } junit4-latest = { module = "junit:junit", version.ref = "junit4" } junit4-bundle = { module = "org.apache.servicemix.bundles:org.apache.servicemix.bundles.junit", version = "4.13.2_1" } +logback-core = { module = "ch.qos.logback:logback-core", version.ref = "logback" } ktlint-cli = { module = "com.pinterest.ktlint:ktlint-cli", version.ref = "ktlint" } [bundles] diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.checkstyle-nohttp.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.checkstyle-nohttp.gradle.kts index e1b742545cc6..641002f94ad2 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.checkstyle-nohttp.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.checkstyle-nohttp.gradle.kts @@ -6,6 +6,17 @@ dependencies { checkstyle(dependencyFromLibs("nohttp-checkstyle")) } +configurations.checkstyle { + resolutionStrategy { + eachDependency { + // Workaround for CVE-2024-12798 and CVE-2024-12801 + if (requested.group == "ch.qos.logback") { + useVersion(requiredVersionFromLibs("logback")) + } + } + } +} + tasks.register("checkstyleNohttp") { group = "verification" description = "Checks for illegal uses of http://" diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.spotless-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.spotless-conventions.gradle.kts index 5af8f263d205..171daf71ff8e 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.spotless-conventions.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.spotless-conventions.gradle.kts @@ -46,6 +46,16 @@ spotless { trimTrailingWhitespace() endWithNewline() } + configurations.named { it.startsWith("spotless") }.configureEach { + // Workaround for CVE-2024-12798 and CVE-2024-12801 + resolutionStrategy { + eachDependency { + if (requested.group == "ch.qos.logback") { + useVersion(requiredVersionFromLibs("logback")) + } + } + } + } } } From f5137fb79dc5dd1da7ce13df4f338fb12b5ca87d Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 31 Dec 2024 10:13:38 +0100 Subject: [PATCH 434/611] Depend on macOS instead of Linux job because it's faster on average --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 20bc9c761640..c68ca19203a9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -69,7 +69,7 @@ jobs: publish_artifacts: name: Publish Snapshot Artifacts - needs: Linux + needs: macOS runs-on: ubuntu-latest permissions: attestations: write # required for build provenance attestation @@ -100,7 +100,7 @@ jobs: concurrency: group: github-pages-${{ github.ref }} cancel-in-progress: true - needs: Linux + needs: macOS runs-on: ubuntu-latest steps: - name: Check out repository From 6db5a0db79dcd1e2a283bf4a94dd64429c5cdbb9 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 31 Dec 2024 10:28:53 +0100 Subject: [PATCH 435/611] Extract methods to improve readability --- .../SuiteLauncherDiscoveryRequestBuilder.java | 61 ++++++++++--------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilder.java b/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilder.java index 56fd410ce06e..e2284b4eb72b 100644 --- a/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilder.java +++ b/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilder.java @@ -457,23 +457,7 @@ private MethodSelector selectMethod(Class suiteClass, SelectMethod annotation private MethodSelector toMethodSelector(Class suiteClass, SelectMethod annotation) { if (!annotation.value().isEmpty()) { - Preconditions.condition(annotation.type() == Class.class, - () -> prefixErrorMessageForInvalidSelectMethodUsage(suiteClass, - "type must not be set in conjunction with fully qualified method name")); - Preconditions.condition(annotation.typeName().isEmpty(), - () -> prefixErrorMessageForInvalidSelectMethodUsage(suiteClass, - "type name must not be set in conjunction with fully qualified method name")); - Preconditions.condition(annotation.name().isEmpty(), - () -> prefixErrorMessageForInvalidSelectMethodUsage(suiteClass, - "method name must not be set in conjunction with fully qualified method name")); - Preconditions.condition(annotation.parameterTypes().length == 0, - () -> prefixErrorMessageForInvalidSelectMethodUsage(suiteClass, - "parameter types must not be set in conjunction with fully qualified method name")); - Preconditions.condition(annotation.parameterTypeNames().isEmpty(), - () -> prefixErrorMessageForInvalidSelectMethodUsage(suiteClass, - "parameter type names must not be set in conjunction with fully qualified method name")); - - return DiscoverySelectors.selectMethod(annotation.value()); + return toMethodSelectorFromFQMN(suiteClass, annotation); } Class type = annotation.type() == Class.class ? null : annotation.type(); @@ -487,25 +471,44 @@ private MethodSelector toMethodSelector(Class suiteClass, SelectMethod annota () -> prefixErrorMessageForInvalidSelectMethodUsage(suiteClass, "either parameter type names or parameter types must be set but not both")); } + return toMethodSelector(suiteClass, type, typeName, parameterTypes, methodName, parameterTypeNames); + } + + private static MethodSelector toMethodSelectorFromFQMN(Class suiteClass, SelectMethod annotation) { + Preconditions.condition(annotation.type() == Class.class, + () -> prefixErrorMessageForInvalidSelectMethodUsage(suiteClass, + "type must not be set in conjunction with fully qualified method name")); + Preconditions.condition(annotation.typeName().isEmpty(), + () -> prefixErrorMessageForInvalidSelectMethodUsage(suiteClass, + "type name must not be set in conjunction with fully qualified method name")); + Preconditions.condition(annotation.name().isEmpty(), + () -> prefixErrorMessageForInvalidSelectMethodUsage(suiteClass, + "method name must not be set in conjunction with fully qualified method name")); + Preconditions.condition(annotation.parameterTypes().length == 0, + () -> prefixErrorMessageForInvalidSelectMethodUsage(suiteClass, + "parameter types must not be set in conjunction with fully qualified method name")); + Preconditions.condition(annotation.parameterTypeNames().isEmpty(), + () -> prefixErrorMessageForInvalidSelectMethodUsage(suiteClass, + "parameter type names must not be set in conjunction with fully qualified method name")); + + return DiscoverySelectors.selectMethod(annotation.value()); + } + + private static MethodSelector toMethodSelector(Class suiteClass, Class type, String typeName, + Class[] parameterTypes, String methodName, String parameterTypeNames) { if (type == null) { Preconditions.notBlank(typeName, () -> prefixErrorMessageForInvalidSelectMethodUsage(suiteClass, "type must be set or type name must not be blank")); - if (parameterTypes == null) { - return DiscoverySelectors.selectMethod(typeName, methodName, parameterTypeNames); - } - else { - return DiscoverySelectors.selectMethod(typeName, methodName, parameterTypes); - } + return parameterTypes == null // + ? DiscoverySelectors.selectMethod(typeName, methodName, parameterTypeNames) // + : DiscoverySelectors.selectMethod(typeName, methodName, parameterTypes); } else { Preconditions.condition(typeName == null, () -> prefixErrorMessageForInvalidSelectMethodUsage(suiteClass, "either type name or type must be set but not both")); - if (parameterTypes == null) { - return DiscoverySelectors.selectMethod(type, methodName, parameterTypeNames); - } - else { - return DiscoverySelectors.selectMethod(type, methodName, parameterTypes); - } + return parameterTypes == null // + ? DiscoverySelectors.selectMethod(type, methodName, parameterTypeNames) // + : DiscoverySelectors.selectMethod(type, methodName, parameterTypes); } } From 529da15aa840ba4d063af94db915b7e81d5fa8d4 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 31 Dec 2024 11:01:27 +0100 Subject: [PATCH 436/611] Extract more methods to improve readability --- .../SuiteLauncherDiscoveryRequestBuilder.java | 104 ++++++++++-------- 1 file changed, 59 insertions(+), 45 deletions(-) diff --git a/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilder.java b/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilder.java index e2284b4eb72b..44a335d3c7b0 100644 --- a/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilder.java +++ b/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilder.java @@ -338,6 +338,7 @@ public SuiteLauncherDiscoveryRequestBuilder applyConfigurationParametersFromSuit *

  • {@link SelectModules}
  • *
  • {@link SelectUris}
  • *
  • {@link SelectPackages}
  • + *
  • {@link Select}
  • * * * @param suiteClass the class to apply the discovery selectors and filter @@ -349,71 +350,84 @@ public SuiteLauncherDiscoveryRequestBuilder applyConfigurationParametersFromSuit public SuiteLauncherDiscoveryRequestBuilder applySelectorsAndFiltersFromSuite(Class suiteClass) { Preconditions.notNull(suiteClass, "Suite class must not be null"); - // Annotations in alphabetical order (except @SelectClasses) - // @formatter:off - findAnnotationValues(suiteClass, ExcludeClassNamePatterns.class, ExcludeClassNamePatterns::value) - .flatMap(SuiteLauncherDiscoveryRequestBuilder::trimmed) - .map(ClassNameFilter::excludeClassNamePatterns) + addExcludeFilters(suiteClass); + // Process @SelectClasses and @SelectMethod before @IncludeClassNamePatterns, since the names + // of selected classes get automatically added to the include filter. + addClassAndMethodSelectors(suiteClass); + addIncludeFilters(suiteClass); + addOtherSelectors(suiteClass); + return this; + } + + private void addExcludeFilters(Class suiteClass) { + findAnnotationValues(suiteClass, ExcludeClassNamePatterns.class, ExcludeClassNamePatterns::value) // + .flatMap(SuiteLauncherDiscoveryRequestBuilder::trimmed) // + .map(ClassNameFilter::excludeClassNamePatterns) // .ifPresent(this::filters); - findAnnotationValues(suiteClass, ExcludeEngines.class, ExcludeEngines::value) - .map(EngineFilter::excludeEngines) + findAnnotationValues(suiteClass, ExcludeEngines.class, ExcludeEngines::value) // + .map(EngineFilter::excludeEngines) // .ifPresent(this::filters); - findAnnotationValues(suiteClass, ExcludePackages.class, ExcludePackages::value) - .map(PackageNameFilter::excludePackageNames) + findAnnotationValues(suiteClass, ExcludePackages.class, ExcludePackages::value) // + .map(PackageNameFilter::excludePackageNames) // .ifPresent(this::filters); - findAnnotationValues(suiteClass, ExcludeTags.class, ExcludeTags::value) - .map(TagFilter::excludeTags) + findAnnotationValues(suiteClass, ExcludeTags.class, ExcludeTags::value) // + .map(TagFilter::excludeTags) // .ifPresent(this::filters); - // Process @SelectClasses before @IncludeClassNamePatterns, since the names - // of selected classes get automatically added to the include filter. - findAnnotation(suiteClass, SelectClasses.class) - .map(annotation -> selectClasses(suiteClass, annotation)) + } + + private void addClassAndMethodSelectors(Class suiteClass) { + findAnnotation(suiteClass, SelectClasses.class) // + .map(annotation -> selectClasses(suiteClass, annotation)) // .ifPresent(this::selectors); - findRepeatableAnnotations(suiteClass, SelectMethod.class) - .stream() - .map(annotation -> selectMethod(suiteClass, annotation)) + findRepeatableAnnotations(suiteClass, SelectMethod.class) // + .stream() // + .map(annotation -> selectMethod(suiteClass, annotation)) // .forEach(this::selectors); - findAnnotationValues(suiteClass, IncludeClassNamePatterns.class, IncludeClassNamePatterns::value) - .flatMap(SuiteLauncherDiscoveryRequestBuilder::trimmed) - .map(this::createIncludeClassNameFilter) + } + + private void addIncludeFilters(Class suiteClass) { + findAnnotationValues(suiteClass, IncludeClassNamePatterns.class, IncludeClassNamePatterns::value) // + .flatMap(SuiteLauncherDiscoveryRequestBuilder::trimmed) // + .map(this::createIncludeClassNameFilter) // .ifPresent(filters -> { this.includeClassNamePatternsUsed = true; filters(filters); }); - findAnnotationValues(suiteClass, IncludeEngines.class, IncludeEngines::value) - .map(EngineFilter::includeEngines) + findAnnotationValues(suiteClass, IncludeEngines.class, IncludeEngines::value) // + .map(EngineFilter::includeEngines) // .ifPresent(this::filters); - findAnnotationValues(suiteClass, IncludePackages.class, IncludePackages::value) - .map(PackageNameFilter::includePackageNames) + findAnnotationValues(suiteClass, IncludePackages.class, IncludePackages::value) // + .map(PackageNameFilter::includePackageNames) // .ifPresent(this::filters); - findAnnotationValues(suiteClass, IncludeTags.class, IncludeTags::value) - .map(TagFilter::includeTags) + findAnnotationValues(suiteClass, IncludeTags.class, IncludeTags::value) // + .map(TagFilter::includeTags) // .ifPresent(this::filters); - findRepeatableAnnotations(suiteClass, SelectClasspathResource.class) - .stream() - .map(annotation -> selectClasspathResource(annotation.value(), annotation.line(), annotation.column())) + } + + private void addOtherSelectors(Class suiteClass) { + findRepeatableAnnotations(suiteClass, SelectClasspathResource.class) // + .stream() // + .map(annotation -> selectClasspathResource(annotation.value(), annotation.line(), annotation.column())) // .forEach(this::selectors); - findAnnotationValues(suiteClass, SelectDirectories.class, SelectDirectories::value) - .map(AdditionalDiscoverySelectors::selectDirectories) + findAnnotationValues(suiteClass, SelectDirectories.class, SelectDirectories::value) // + .map(AdditionalDiscoverySelectors::selectDirectories) // .ifPresent(this::selectors); - findRepeatableAnnotations(suiteClass, SelectFile.class) - .stream() - .map(annotation -> selectFile(annotation.value(), annotation.line(), annotation.column())) + findRepeatableAnnotations(suiteClass, SelectFile.class) // + .stream() // + .map(annotation -> selectFile(annotation.value(), annotation.line(), annotation.column())) // .forEach(this::selectors); - findAnnotationValues(suiteClass, SelectModules.class, SelectModules::value) - .map(AdditionalDiscoverySelectors::selectModules) + findAnnotationValues(suiteClass, SelectModules.class, SelectModules::value) // + .map(AdditionalDiscoverySelectors::selectModules) // .ifPresent(this::selectors); - findAnnotationValues(suiteClass, SelectUris.class, SelectUris::value) - .map(AdditionalDiscoverySelectors::selectUris) + findAnnotationValues(suiteClass, SelectUris.class, SelectUris::value) // + .map(AdditionalDiscoverySelectors::selectUris) // .ifPresent(this::selectors); - findAnnotationValues(suiteClass, SelectPackages.class, SelectPackages::value) - .map(AdditionalDiscoverySelectors::selectPackages) + findAnnotationValues(suiteClass, SelectPackages.class, SelectPackages::value) // + .map(AdditionalDiscoverySelectors::selectPackages) // .ifPresent(this::selectors); - findAnnotationValues(suiteClass, Select.class, Select::value) - .map(AdditionalDiscoverySelectors::parseIdentifiers) + findAnnotationValues(suiteClass, Select.class, Select::value) // + .map(AdditionalDiscoverySelectors::parseIdentifiers) // .ifPresent(this::selectors); - // @formatter:on - return this; } /** From bd7db617acc1b69d2ac5d933395d8c1ce3dd0385 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 31 Dec 2024 14:09:59 +0100 Subject: [PATCH 437/611] Fail build when assembling a release version that depends on snapshots (#4223) --- documentation/documentation.gradle.kts | 12 ++++++------ .../common/src/main/kotlin/VersionExtensions.kt | 1 + .../junitbuild.java-library-conventions.gradle.kts | 11 +++++++++++ .../junitbuild.publishing-conventions.gradle.kts | 4 +--- 4 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 gradle/plugins/common/src/main/kotlin/VersionExtensions.kt diff --git a/documentation/documentation.gradle.kts b/documentation/documentation.gradle.kts index e5f5fb28fdb8..02c96f3035fc 100644 --- a/documentation/documentation.gradle.kts +++ b/documentation/documentation.gradle.kts @@ -93,15 +93,15 @@ asciidoctorj { } val buildRevision: String by rootProject.extra -val snapshot = rootProject.version.toString().contains("SNAPSHOT") -val docsVersion = if (snapshot) "snapshot" else rootProject.version -val releaseBranch = if (snapshot) "HEAD" else "r${rootProject.version}" +val snapshot = version.isSnapshot() +val docsVersion = if (snapshot) "snapshot" else version +val releaseBranch = if (snapshot) "HEAD" else "r${version}" val docsDir = layout.buildDirectory.dir("ghpages-docs") val replaceCurrentDocs = buildParameters.documentation.replaceCurrentDocs val uploadPdfs = !snapshot -val userGuidePdfFileName = "junit-user-guide-${rootProject.version}.pdf" -val ota4jDocVersion = if (libs.versions.opentest4j.get().contains("SNAPSHOT")) "snapshot" else libs.versions.opentest4j.get() -val apiGuardianDocVersion = if (libs.versions.apiguardian.get().contains("SNAPSHOT")) "snapshot" else libs.versions.apiguardian.get() +val userGuidePdfFileName = "junit-user-guide-${version}.pdf" +val ota4jDocVersion = libs.versions.opentest4j.map { if (it.isSnapshot()) "snapshot" else it }.get() +val apiGuardianDocVersion = libs.versions.apiguardian.map { if (it.isSnapshot()) "snapshot" else it }.get() gitPublish { repoUri = "https://github.com/junit-team/junit5.git" diff --git a/gradle/plugins/common/src/main/kotlin/VersionExtensions.kt b/gradle/plugins/common/src/main/kotlin/VersionExtensions.kt new file mode 100644 index 000000000000..8d106218b896 --- /dev/null +++ b/gradle/plugins/common/src/main/kotlin/VersionExtensions.kt @@ -0,0 +1 @@ +fun Any.isSnapshot(): Boolean = toString().contains("SNAPSHOT") diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts index 1865609af928..b14973e05474 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts @@ -120,6 +120,17 @@ if (project in mavenizedProjects) { } } + if (!project.version.isSnapshot()) { + configurations { + compileClasspath { + resolutionStrategy.failOnChangingVersions() + } + runtimeClasspath { + resolutionStrategy.failOnChangingVersions() + } + } + } + } else { tasks { jar { diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.publishing-conventions.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.publishing-conventions.gradle.kts index ad877035e1f3..90146181e380 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.publishing-conventions.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.publishing-conventions.gradle.kts @@ -5,8 +5,6 @@ plugins { id("junitbuild.build-parameters") } -val isSnapshot = project.version.toString().contains("SNAPSHOT") - val jupiterProjects: List by rootProject val platformProjects: List by rootProject val vintageProjects: List by rootProject @@ -40,7 +38,7 @@ tasks.withType().configureEach { dependsOn(tasks.build) } -val signArtifacts = buildParameters.publishing.signArtifacts.getOrElse(!(isSnapshot || buildParameters.ci)) +val signArtifacts = buildParameters.publishing.signArtifacts.getOrElse(!(project.version.isSnapshot() || buildParameters.ci)) signing { useGpgCmd() From 0a9374d1c3e3268e64e00e7da6f22034edb484be Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 31 Dec 2024 14:47:03 +0100 Subject: [PATCH 438/611] Use lazy filtering API --- .../src/main/kotlin/junitbuild.temp-maven-repo.gradle.kts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.temp-maven-repo.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.temp-maven-repo.gradle.kts index f60def6c4df2..c7d0530580d8 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.temp-maven-repo.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.temp-maven-repo.gradle.kts @@ -22,10 +22,10 @@ subprojects { } } } - tasks.withType().configureEach { - if (name.endsWith("To${tempRepoName.capitalized()}Repository")) { - dependsOn(clearTempRepoDir) + tasks.withType() + .named { it.endsWith("To${tempRepoName.capitalized()}Repository") } + .configureEach { + dependsOn(clearTempRepoDir) } - } } } From 9d8d864961d6e9dc995bd4bb75d7729599267dd4 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 1 Jan 2025 15:06:43 +0100 Subject: [PATCH 439/611] Move script closer to GitHub Actions workflow --- {gradle => .github}/scripts/checkBuildReproducibility.sh | 7 ++++--- .github/workflows/reproducible-build.yml | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) rename {gradle => .github}/scripts/checkBuildReproducibility.sh (80%) diff --git a/gradle/scripts/checkBuildReproducibility.sh b/.github/scripts/checkBuildReproducibility.sh similarity index 80% rename from gradle/scripts/checkBuildReproducibility.sh rename to .github/scripts/checkBuildReproducibility.sh index b9ede2c77cf4..9c6bd410b383 100755 --- a/gradle/scripts/checkBuildReproducibility.sh +++ b/.github/scripts/checkBuildReproducibility.sh @@ -1,8 +1,9 @@ #!/bin/bash -e -rm -rf checksums* +rm -f checksums-1.txt checksums-2.txt -export SOURCE_DATE_EPOCH=$(date +%s) +SOURCE_DATE_EPOCH=$(date +%s) +export SOURCE_DATE_EPOCH function calculate_checksums() { OUTPUT=$1 @@ -20,7 +21,7 @@ function calculate_checksums() { | grep '/build/libs/' \ | grep --invert-match 'javadoc' \ | sort \ - | xargs sha256sum > "${OUTPUT}" + | xargs sha512sum > "${OUTPUT}" } diff --git a/.github/workflows/reproducible-build.yml b/.github/workflows/reproducible-build.yml index 0112a1162f59..323185ad9ac9 100644 --- a/.github/workflows/reproducible-build.yml +++ b/.github/workflows/reproducible-build.yml @@ -32,5 +32,4 @@ jobs: --no-configuration-cache # Disable configuration cache due to https://github.com/diffplug/spotless/issues/2318 - name: Build and compare checksums shell: bash - run: | - ./gradle/scripts/checkBuildReproducibility.sh + run: ./.github/scripts/checkBuildReproducibility.sh From 3c10fd202f7b25665c7b1b39378fa5a3f64290a2 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 1 Jan 2025 17:34:05 +0100 Subject: [PATCH 440/611] Add workflow to verify reproducibility of binary release artifacts (#4225) This workflow is supposed to be triggered manually _after_ release artifacts have been uploaded to a staging repository and the corresponding Git tag has been pushed to GitHub. To ensure their integrity and reproducibility, the workflow rebuilds all binary artifacts and verifies that their checksums are identical to those in the staging repository. --- .github/workflows/release.yml | 57 +++++++++++++ .../junitbuild.temp-maven-repo.gradle.kts | 16 +++- .../VerifyBinaryArtifactsAreIdentical.kt | 80 +++++++++++++++++++ 3 files changed, 149 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 gradle/plugins/common/src/main/kotlin/junitbuild/release/VerifyBinaryArtifactsAreIdentical.kt diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000000..a582073c37a4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,57 @@ +name: Release + +on: + workflow_dispatch: + inputs: + releaseVersion: + description: Version to be released (e.g. "5.12.0-M1") + required: true + stagingRepoId: + description: ID of the Nexus staging repository (e.g. "orgjunit-1159") + required: true + +permissions: read-all + +env: + DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + +jobs: + + verify_reproducibility: + name: Verify artifacts are reproducible + runs-on: ubuntu-24.04 # required to get a recent version of `jc` + permissions: + attestations: write # required for build provenance attestation + id-token: write # required for build provenance attestation + steps: + - name: Check out repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + with: + fetch-depth: 1 + # TODO ref: "refs/tags/r${{ github.event.inputs.releaseVersion }}" + - name: Set staging repository URL + id: stagingRepo + run: echo "url=https://oss.sonatype.org/service/local/repositories/${{ github.event.inputs.stagingRepoId }}/content" > "$GITHUB_OUTPUT" + - name: Download reference JAR from staging repository + id: referenceJar + run: | + curl --silent --fail --location --output /tmp/reference.jar \ + "${{ steps.stagingRepo.outputs.url }}/org/junit/jupiter/junit-jupiter-api/${{ github.event.inputs.releaseVersion }}/junit-jupiter-api-${{ github.event.inputs.releaseVersion }}.jar" + sudo apt-get update && sudo apt-get install --yes jc + unzip -c /tmp/reference.jar META-INF/MANIFEST.MF | jc --jar-manifest | jq '.[0]' > /tmp/manifest.json + echo "createdBy=$(jq --raw-output .Created_By /tmp/manifest.json)" >> "$GITHUB_OUTPUT" + echo "buildTimestamp=$(jq --raw-output .Build_Date /tmp/manifest.json) $(jq --raw-output .Build_Time /tmp/manifest.json)" >> "$GITHUB_OUTPUT" + - name: Verify artifacts + uses: ./.github/actions/run-gradle + with: + encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} + arguments: | + --rerun-tasks \ + -Pmanifest.buildTimestamp="${{ steps.referenceJar.outputs.buildTimestamp }}" \ + -Pmanifest.createdBy="${{ steps.referenceJar.outputs.createdBy }}" \ + :verifyArtifactsInStagingRepositoryAreReproducible \ + --remote-repo-url=${{ steps.stagingRepo.outputs.url }} + - name: Generate build provenance attestations + uses: actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0 + with: + subject-path: build/repo/**/*.jar diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild.temp-maven-repo.gradle.kts b/gradle/plugins/common/src/main/kotlin/junitbuild.temp-maven-repo.gradle.kts index c7d0530580d8..3f48f5d656d7 100644 --- a/gradle/plugins/common/src/main/kotlin/junitbuild.temp-maven-repo.gradle.kts +++ b/gradle/plugins/common/src/main/kotlin/junitbuild.temp-maven-repo.gradle.kts @@ -1,4 +1,5 @@ import junitbuild.extensions.capitalized +import junitbuild.release.VerifyBinaryArtifactsAreIdentical val tempRepoName by extra("temp") val tempRepoDir by extra { @@ -12,6 +13,10 @@ val clearTempRepoDir by tasks.registering { } } +val verifyArtifactsInStagingRepositoryAreReproducible by tasks.registering(VerifyBinaryArtifactsAreIdentical::class) { + localRepoDir.set(tempRepoDir) +} + subprojects { pluginManager.withPlugin("maven-publish") { configure { @@ -22,10 +27,13 @@ subprojects { } } } - tasks.withType() + val publishingTasks = tasks.withType() .named { it.endsWith("To${tempRepoName.capitalized()}Repository") } - .configureEach { - dependsOn(clearTempRepoDir) - } + publishingTasks.configureEach { + dependsOn(clearTempRepoDir) + } + verifyArtifactsInStagingRepositoryAreReproducible { + dependsOn(publishingTasks) + } } } diff --git a/gradle/plugins/common/src/main/kotlin/junitbuild/release/VerifyBinaryArtifactsAreIdentical.kt b/gradle/plugins/common/src/main/kotlin/junitbuild/release/VerifyBinaryArtifactsAreIdentical.kt new file mode 100644 index 000000000000..9acd67b96c89 --- /dev/null +++ b/gradle/plugins/common/src/main/kotlin/junitbuild/release/VerifyBinaryArtifactsAreIdentical.kt @@ -0,0 +1,80 @@ +package junitbuild.release + +import org.gradle.api.DefaultTask +import org.gradle.api.file.DirectoryProperty +import org.gradle.api.provider.Property +import org.gradle.api.tasks.Input +import org.gradle.api.tasks.InputDirectory +import org.gradle.api.tasks.PathSensitive +import org.gradle.api.tasks.PathSensitivity +import org.gradle.api.tasks.TaskAction +import org.gradle.api.tasks.options.Option +import java.io.File +import java.net.URI +import java.net.http.HttpClient +import java.net.http.HttpRequest +import java.net.http.HttpResponse.BodyHandlers + +abstract class VerifyBinaryArtifactsAreIdentical : DefaultTask() { + + @get:InputDirectory + @get:PathSensitive(PathSensitivity.RELATIVE) + abstract val localRepoDir: DirectoryProperty + + @get:Input + abstract val remoteRepoUrl: Property + + init { + // Depends on contents of remote repository + outputs.upToDateWhen { false } + } + + @Suppress("unused") + @Option( + option = "remote-repo-url", + description = "The URL of the remote repository to compare the local repository against" + ) + fun remoteRepo(url: String) { + remoteRepoUrl.set(url) + } + + @TaskAction + fun execute() { + val localRootDir = localRepoDir.get().asFile + val baseUrl = remoteRepoUrl.get() + val mismatches = mutableListOf() + var numChecks = 0 + HttpClient.newHttpClient().use { httpClient -> + localRootDir.walk().forEach { file -> + if (file.isFile && file.name.endsWith(".jar.sha512") && !file.name.endsWith("-javadoc.jar.sha512")) { + val localSha512 = file.readText() + val relativeFile = file.relativeTo(localRootDir) + val url = URI.create("${baseUrl}/${relativeFile.path}") + logger.info("Checking {}...", url) + val request = HttpRequest.newBuilder().GET().uri(url).build() + val response = httpClient.send(request, BodyHandlers.ofString()) + val remoteSha512 = if (response.statusCode() == 200) response.body() else "status=${response.statusCode()}" + if (localSha512 != remoteSha512) { + mismatches.add(Mismatch(relativeFile, localSha512, remoteSha512)) + } + numChecks++ + } + } + } + require(numChecks > 0) { + "No files found to compare" + } + require(mismatches.isEmpty()) { + "The following files have different SHA-512 checksums in the local and remote repositories:\n\n" + + mismatches.joinToString("\n\n") { + """ + ${it.file} + local: ${it.localSha512} + remote: ${it.remoteSha512} + """.trimIndent() + } + } + } + + private data class Mismatch(val file: File, val localSha512: String, val remoteSha512: String) +} From f86eedd7cd7cc5e1387a1ab58e098f8109a13f58 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 1 Jan 2025 19:26:11 +0000 Subject: [PATCH 441/611] Update dependency org.assertj:assertj-core to v3.27.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6aaf92f83d47..726c9f381ac8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,7 +3,7 @@ ant = "1.10.15" apiguardian = "1.1.2" asciidoctorj-pdf = "2.3.19" asciidoctor-plugins = "4.0.4" # Check if workaround in documentation.gradle.kts can be removed when upgrading -assertj = "3.27.0" +assertj = "3.27.1" bnd = "7.1.0" checkstyle = "10.21.1" eclipse = "4.34.0" From 0af1e2c29068fcf32fd47e02470e4ffd23b5a918 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 2 Jan 2025 10:44:35 +0100 Subject: [PATCH 442/611] Replace usage of deprecated API --- .../JupiterEngineExecutionContextTests.java | 2 +- .../platform/launcher/core/DefaultLauncherTests.java | 12 ++++++------ ...AbortOnFailureLauncherDiscoveryListenerTests.java | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/JupiterEngineExecutionContextTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/JupiterEngineExecutionContextTests.java index 0a2f8abe0270..c85403ebae22 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/JupiterEngineExecutionContextTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/JupiterEngineExecutionContextTests.java @@ -98,7 +98,7 @@ void closeAttemptExceptionWillBeThrownDownTheCallStack() throws Exception { assertThat(actualException) // .hasMessage("Failed to close extension context") // - .hasCauseReference(expectedCause); + .cause().isSameAs(expectedCause); } } diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/DefaultLauncherTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/DefaultLauncherTests.java index 0f1a3d50f76d..49ba72767990 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/DefaultLauncherTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/DefaultLauncherTests.java @@ -197,7 +197,7 @@ public void execute(ExecutionRequest request) { assertThat(testExecutionResult.getValue().getThrowable()).isPresent(); assertThat(testExecutionResult.getValue().getThrowable().get()) // .hasMessage("TestEngine with ID 'TestEngineStub' failed to execute tests") // - .hasCauseReference(rootCause); + .cause().isSameAs(rootCause); } @Test @@ -221,7 +221,7 @@ public void execute(ExecutionRequest request) { assertThat(testExecutionResult.getValue().getThrowable()).isPresent(); assertThat(testExecutionResult.getValue().getThrowable().get()) // .hasMessage("TestEngine with ID 'TestEngineStub' failed to execute tests") // - .hasCauseReference(rootCause); + .cause().isSameAs(rootCause); } @Test @@ -245,7 +245,7 @@ public void execute(ExecutionRequest request) { assertThat(testExecutionResult.getValue().getThrowable()).isPresent(); assertThat(testExecutionResult.getValue().getThrowable().get()) // .hasMessage("TestEngine with ID 'TestEngineStub' failed to execute tests") // - .hasCauseReference(rootCause); + .cause().isSameAs(rootCause); } @Test @@ -271,7 +271,7 @@ public void execute(ExecutionRequest request) { assertThat(testExecutionResult.getValue().getThrowable()).isPresent(); assertThat(testExecutionResult.getValue().getThrowable().get()) // .hasMessage("TestEngine with ID 'TestEngineStub' failed to execute tests") // - .hasCauseReference(rootCause); + .cause().isSameAs(rootCause); } @Test @@ -298,8 +298,8 @@ public void execute(ExecutionRequest request) { assertThat(testExecutionResult.getValue().getThrowable()).isPresent(); assertThat(testExecutionResult.getValue().getThrowable().get()) // .hasMessage("TestEngine with ID 'TestEngineStub' failed to execute tests") // - .hasCauseReference(rootCause) // - .hasSuppressedException(originalFailure); + .hasSuppressedException(originalFailure) // + .cause().isSameAs(rootCause); } @Test diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/discovery/AbortOnFailureLauncherDiscoveryListenerTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/discovery/AbortOnFailureLauncherDiscoveryListenerTests.java index 223421d72da9..727bb93a399a 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/discovery/AbortOnFailureLauncherDiscoveryListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/discovery/AbortOnFailureLauncherDiscoveryListenerTests.java @@ -69,7 +69,7 @@ void abortsDiscoveryOnSelectorResolutionFailure() { assertThat(exception).hasMessage("TestEngine with ID 'some-engine' failed to discover tests"); assertThat(exception.getCause()) // .hasMessageEndingWith("resolution failed") // - .hasCauseReference(rootCause); + .cause().isSameAs(rootCause); } @Test @@ -90,7 +90,7 @@ public TestDescriptor discover(EngineDiscoveryRequest discoveryRequest, UniqueId var exception = assertThrows(JUnitException.class, () -> launcher.discover(request)); assertThat(exception) // .hasMessage("TestEngine with ID 'some-engine' failed to discover tests") // - .hasCauseReference(rootCause); + .cause().isSameAs(rootCause); } } From 057debcd24f07171f8b3285e4e6e22a4c18c7a27 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 2 Jan 2025 13:33:09 +0100 Subject: [PATCH 443/611] Fix typo --- .../hierarchical/ParallelExecutionIntegrationTests.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionIntegrationTests.java index 156ea60dad6e..26b132d02120 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionIntegrationTests.java @@ -957,7 +957,7 @@ private static int incrementAndBlock(AtomicInteger sharedResource, CountDownLatc throws InterruptedException { var value = sharedResource.incrementAndGet(); countDownLatch.countDown(); - countDownLatch.await(estimateSimulatedTestDurationInMiliseconds(), MILLISECONDS); + countDownLatch.await(estimateSimulatedTestDurationInMilliseconds(), MILLISECONDS); return value; } @@ -966,7 +966,7 @@ private static void storeAndBlockAndCheck(AtomicInteger sharedResource, CountDow throws InterruptedException { var value = sharedResource.get(); countDownLatch.countDown(); - countDownLatch.await(estimateSimulatedTestDurationInMiliseconds(), MILLISECONDS); + countDownLatch.await(estimateSimulatedTestDurationInMilliseconds(), MILLISECONDS); assertEquals(value, sharedResource.get()); } @@ -980,7 +980,7 @@ private static void storeAndBlockAndCheck(AtomicInteger sharedResource, CountDow * * Currently, CI is known to be slow. */ - private static long estimateSimulatedTestDurationInMiliseconds() { + private static long estimateSimulatedTestDurationInMilliseconds() { var runningInCi = Boolean.parseBoolean(System.getenv("CI")); return runningInCi ? 1000 : 100; } From 98422b4237fa7c58d212a84f7c647f6ba36e8113 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 2 Jan 2025 16:46:50 +0100 Subject: [PATCH 444/611] Update Open Test Reporting to 0.2.0-M2 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 726c9f381ac8..be919d49cbe4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -17,7 +17,7 @@ log4j = "2.24.3" logback = "1.5.15" mockito = "5.14.2" opentest4j = "1.3.0" -openTestReporting = "0.2.0-SNAPSHOT" +openTestReporting = "0.2.0-M2" surefire = "3.5.2" xmlunit = "2.10.0" From d0294f311d25059f82eeefcd38baef6aaefd129f Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 2 Jan 2025 16:47:08 +0100 Subject: [PATCH 445/611] Remove snapshot dependency setup --- .github/actions/run-gradle/action.yml | 1 - .github/scripts/checkBuildReproducibility.sh | 1 - settings.gradle.kts | 6 ------ 3 files changed, 8 deletions(-) diff --git a/.github/actions/run-gradle/action.yml b/.github/actions/run-gradle/action.yml index 5310fd62e29b..a7f12e1fc13a 100644 --- a/.github/actions/run-gradle/action.yml +++ b/.github/actions/run-gradle/action.yml @@ -29,6 +29,5 @@ runs: -Pjunit.develocity.predictiveTestSelection.enabled=true \ -Pjunit.develocity.predictiveTestSelection.selectRemainingTests=${{ github.event_name != 'pull_request' }} \ "-Dscan.value.GitHub job=${{ github.job }}" \ - --refresh-dependencies \ javaToolchains \ ${{ inputs.arguments }} diff --git a/.github/scripts/checkBuildReproducibility.sh b/.github/scripts/checkBuildReproducibility.sh index 9c6bd410b383..60f2bd165022 100755 --- a/.github/scripts/checkBuildReproducibility.sh +++ b/.github/scripts/checkBuildReproducibility.sh @@ -13,7 +13,6 @@ function calculate_checksums() { --no-build-cache \ -Porg.gradle.java.installations.auto-download=false \ -Dscan.tag.Reproducibility \ - --refresh-dependencies \ clean \ assemble diff --git a/settings.gradle.kts b/settings.gradle.kts index 6af29a55f440..ba5ae9fd677f 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -15,12 +15,6 @@ plugins { dependencyResolutionManagement { repositories { mavenCentral() - // TODO Remove --refresh-dependencies from CI builds when no longer consuming snapshots - maven(url = "https://oss.sonatype.org/content/repositories/snapshots") { - mavenContent { - snapshotsOnly() - } - } } } From 767150eb75958df6ded1ff0d1a65fe24bebb16f3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 2 Jan 2025 20:19:26 +0000 Subject: [PATCH 446/611] Update mockito monorepo to v5.15.2 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index be919d49cbe4..921c3f707ae0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -15,7 +15,7 @@ junit4Min = "4.12" ktlint = "1.5.0" log4j = "2.24.3" logback = "1.5.15" -mockito = "5.14.2" +mockito = "5.15.2" opentest4j = "1.3.0" openTestReporting = "0.2.0-M2" surefire = "3.5.2" From ccaab7b9815446eff4a172308a2e83c40d444ec6 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 3 Jan 2025 10:06:03 +0100 Subject: [PATCH 447/611] Automate verification of releases artifact consumability (#4227) The new GitHub Actions workflow updates sample projects to use the version about to be releases, injects the staging repository, and builds all samples. --- .github/workflows/release.yml | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a582073c37a4..19520dd88276 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,7 @@ permissions: read-all env: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + STAGING_REPO_URL: https://oss.sonatype.org/service/local/repositories/${{ github.event.inputs.stagingRepoId }}/content jobs: @@ -29,14 +30,11 @@ jobs: with: fetch-depth: 1 # TODO ref: "refs/tags/r${{ github.event.inputs.releaseVersion }}" - - name: Set staging repository URL - id: stagingRepo - run: echo "url=https://oss.sonatype.org/service/local/repositories/${{ github.event.inputs.stagingRepoId }}/content" > "$GITHUB_OUTPUT" - name: Download reference JAR from staging repository id: referenceJar run: | curl --silent --fail --location --output /tmp/reference.jar \ - "${{ steps.stagingRepo.outputs.url }}/org/junit/jupiter/junit-jupiter-api/${{ github.event.inputs.releaseVersion }}/junit-jupiter-api-${{ github.event.inputs.releaseVersion }}.jar" + "${{ env.STAGING_REPO_URL }}/org/junit/jupiter/junit-jupiter-api/${{ github.event.inputs.releaseVersion }}/junit-jupiter-api-${{ github.event.inputs.releaseVersion }}.jar" sudo apt-get update && sudo apt-get install --yes jc unzip -c /tmp/reference.jar META-INF/MANIFEST.MF | jc --jar-manifest | jq '.[0]' > /tmp/manifest.json echo "createdBy=$(jq --raw-output .Created_By /tmp/manifest.json)" >> "$GITHUB_OUTPUT" @@ -50,8 +48,30 @@ jobs: -Pmanifest.buildTimestamp="${{ steps.referenceJar.outputs.buildTimestamp }}" \ -Pmanifest.createdBy="${{ steps.referenceJar.outputs.createdBy }}" \ :verifyArtifactsInStagingRepositoryAreReproducible \ - --remote-repo-url=${{ steps.stagingRepo.outputs.url }} + --remote-repo-url=${{ env.STAGING_REPO_URL }} - name: Generate build provenance attestations uses: actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0 with: subject-path: build/repo/**/*.jar + + verify_consumability: + name: Verify artifacts are consumable + runs-on: ubuntu-latest + steps: + - name: Check out samples repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + with: + repository: junit-team/junit5-samples + token: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 1 + - name: Set up JDK + uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4 + with: + java-version: 21 + distribution: temurin + - name: Update JUnit dependencies in samples + run: java src/Updater.java ${{ github.event.inputs.releaseVersion }} + - name: Inject staging repository URL + run: java src/StagingRepoInjector.java ${{ env.STAGING_REPO_URL }} + - name: Build samples + run: java src/Builder.java From 29666e50d16b34f6b390ae00c57c56c99dc96520 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 3 Jan 2025 10:35:15 +0100 Subject: [PATCH 448/611] Set up sbt explicitly because it will be dropped in ubuntu-24.04 See also: actions/runner-images#10636 --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 19520dd88276..71421c00e4a5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -69,6 +69,7 @@ jobs: with: java-version: 21 distribution: temurin + - uses: sbt/setup-sbt@v1 - name: Update JUnit dependencies in samples run: java src/Updater.java ${{ github.event.inputs.releaseVersion }} - name: Inject staging repository URL From 7d878b8d24f480b03d9f83a3468cb61433f7bc78 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 3 Jan 2025 14:27:38 +0100 Subject: [PATCH 449/611] Add job for releasing the staging repository --- .github/workflows/release.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 71421c00e4a5..c4efc1eaf70d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -76,3 +76,21 @@ jobs: run: java src/StagingRepoInjector.java ${{ env.STAGING_REPO_URL }} - name: Build samples run: java src/Builder.java + + release_staging_repo: + name: Release staging repository + needs: [verify_reproducibility, verify_consumability] + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + with: + fetch-depth: 1 + ref: "refs/tags/r${{ github.event.inputs.releaseVersion }}" + - name: Release staging repository + uses: ./.github/actions/run-gradle + with: + encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} + arguments: | + releaseSonatypeStagingRepository \ + --staging-repository-id=${{ github.event.inputs.stagingRepoId }} From 31e7b809a693b53ff8c0a60e0000d60b8d9a7eea Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 3 Jan 2025 14:28:39 +0100 Subject: [PATCH 450/611] Add job for publishing documentation --- .github/scripts/waitForUrl.sh | 9 +++++++++ .github/workflows/release.yml | 38 +++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100755 .github/scripts/waitForUrl.sh diff --git a/.github/scripts/waitForUrl.sh b/.github/scripts/waitForUrl.sh new file mode 100755 index 000000000000..e7ae8715c055 --- /dev/null +++ b/.github/scripts/waitForUrl.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +URL=$1 +printf 'Waiting for %s' "$URL" +until curl --output /dev/null --silent --location --head --fail "$URL"; do + printf '.' + sleep 5 +done +echo ' OK' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c4efc1eaf70d..806865dadb8d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -94,3 +94,41 @@ jobs: arguments: | releaseSonatypeStagingRepository \ --staging-repository-id=${{ github.event.inputs.stagingRepoId }} + + publish_documentation: + name: Publish documentation + needs: release_staging_repo + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + with: + fetch-depth: 1 + ref: "refs/tags/r${{ github.event.inputs.releaseVersion }}" + - name: Configure Git + run: | + git config --global user.name "JUnit Team" + git config --global user.email "team@junit.org" + - name: Build and publish documentation + uses: ./.github/actions/run-gradle + with: + encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} + arguments: | + --no-build-cache \ + --no-configuration-cache \ + clean \ + gitPublishPush \ + -Pdocumentation.replaceCurrentDocs=${{ contains(github.event.inputs.releaseVersion, '-') && 'false' || 'true' }} + - name: Wait for deployment to GitHub Pages + id: pagesDeployment + timeout-minutes: 20 + run: | + URL="https://junit.org/junit5/docs/${{ github.event.inputs.releaseVersion }}/user-guide/junit-user-guide-${{ github.event.inputs.releaseVersion }}.pdf" + ./.github/scripts/waitForUrl.sh "$URL" + echo "pdfUrl=$URL" >> "$GITHUB_OUTPUT" + - name: Verify integrity of PDF version of User Guide + timeout-minutes: 15 + run: | + curl --silent --fail --location --output /tmp/junit-user-guide.pdf "${{ steps.pagesDeployment.outputs.pdfUrl }}" + sudo apt-get update && sudo apt-get install --yes poppler-utils + pdfinfo /tmp/junit-user-guide.pdf From 6f3ea4000c10ab1d7bef9f54e8b6fc4c4116c46e Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 3 Jan 2025 14:29:20 +0100 Subject: [PATCH 451/611] Add job for closing the GitHub milestone of the release --- .github/workflows/release.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 806865dadb8d..170aac1ce864 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -132,3 +132,27 @@ jobs: curl --silent --fail --location --output /tmp/junit-user-guide.pdf "${{ steps.pagesDeployment.outputs.pdfUrl }}" sudo apt-get update && sudo apt-get install --yes poppler-utils pdfinfo /tmp/junit-user-guide.pdf + + close_github_milestone: + name: Close GitHub milestone + needs: release_staging_repo + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - name: Close milestone + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 + with: + script: | + const openMilestones = await github.rest.issues.listMilestones({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'open' + }); + const [milestone] = openMilestones.data.filter(x => x.title === "${{ github.event.inputs.releaseVersion }}") + await github.rest.issues.updateMilestone({ + owner: context.repo.owner, + repo: context.repo.repo, + milestone_number: milestone.number, + state: 'closed' + }); From d07111091b67ecc3a5dfed1f56afd297bc0eaa3d Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 3 Jan 2025 14:30:22 +0100 Subject: [PATCH 452/611] Add job for waiting for sync to Maven Central --- .github/scripts/waitForMavenCentralSync.sh | 5 +++++ .github/workflows/release.yml | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100755 .github/scripts/waitForMavenCentralSync.sh diff --git a/.github/scripts/waitForMavenCentralSync.sh b/.github/scripts/waitForMavenCentralSync.sh new file mode 100755 index 000000000000..9a281e56d7ba --- /dev/null +++ b/.github/scripts/waitForMavenCentralSync.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +URL_PATH=$1 +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +"$SCRIPT_DIR"/waitForUrl.sh "https://repo1.maven.org/maven2/$URL_PATH" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 170aac1ce864..046f43b68153 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,6 +53,11 @@ jobs: uses: actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0 with: subject-path: build/repo/**/*.jar + - name: Upload local repository for later jobs + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4 + with: + name: local-maven-repository + path: build/repo verify_consumability: name: Verify artifacts are consumable @@ -156,3 +161,18 @@ jobs: milestone_number: milestone.number, state: 'closed' }); + + wait_for_maven_central: + name: Wait for sync to Maven Central + needs: release_staging_repo + runs-on: ubuntu-latest + steps: + - name: Download local Maven repository + uses: actions/download-artifact@v4 + with: + name: local-maven-repository + path: build/repo + - name: Wait for sync to Maven Central + timeout-minutes: 30 + run: | + find build/repo -name '*.pom' -printf './.github/scripts/waitForMavenCentralSync.sh %P\n' | sh From d88001d41967570140cc262d02b0e45122957497 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 3 Jan 2025 14:31:17 +0100 Subject: [PATCH 453/611] Add job for updating samples after sync to Maven Central was successful --- .github/workflows/release.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 046f43b68153..1147e60fc306 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -176,3 +176,38 @@ jobs: timeout-minutes: 30 run: | find build/repo -name '*.pom' -printf './.github/scripts/waitForMavenCentralSync.sh %P\n' | sh + + update_samples: + name: Update samples + needs: wait_for_maven_central + runs-on: ubuntu-latest + steps: + - name: Check out samples repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + with: + repository: junit-team/junit5-samples + token: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 1 + - name: Set up JDK + uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4 + with: + java-version: 21 + distribution: temurin + - uses: sbt/setup-sbt@v1 + - name: Update JUnit dependencies in samples + run: java src/Updater.java ${{ github.event.inputs.releaseVersion }} + - name: Build samples + run: java src/Builder.java + - name: Create release branch + run: | + git config user.name "JUnit Team" + git config user.email "team@junit.org" + git switch -c "r${{ github.event.inputs.releaseVersion }}" + git commit -a -m "Use ${{ github.event.inputs.releaseVersion }}" + git push origin "r${{ github.event.inputs.releaseVersion }}" + - name: Update main branch (only for GA releases) + if: ${{ !contains(github.event.inputs.releaseVersion, '-') }} + run: | + git switch main + git merge --ff-only "r${{ github.event.inputs.releaseVersion }}" + git push origin main From 279d78fb0d1c4461e204f44a54d72872bdf49324 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 3 Jan 2025 14:31:27 +0100 Subject: [PATCH 454/611] Add job for creating a GitHub release --- .github/workflows/release.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1147e60fc306..f3dfb5f6ee09 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -211,3 +211,28 @@ jobs: git switch main git merge --ff-only "r${{ github.event.inputs.releaseVersion }}" git push origin main + + create_github_release: + name: Create GitHub release + needs: wait_for_maven_central + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Create GitHub release + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 + with: + script: | + const releaseVersion = "${{ github.event.inputs.releaseVersion }}"; + const jupiterVersion = releaseVersion; + const vintageVersion = releaseVersion; + const platformVersion = "1." + releaseVersion.substring(2); + await github.rest.repos.createRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + tag_name: `r${releaseVersion}`, + name: `JUnit ${releaseVersion}`, + generate_release_notes: true, + body: `JUnit ${jupiterVersion} = Platform ${platformVersion} + Jupiter ${jupiterVersion} + Vintage ${vintageVersion}\n\nSee [Release Notes](https://junit.org/junit5/docs/${releaseVersion}/release-notes/).`, + prerelease: releaseVersion.includes("-"), + }); From 8362ee878e8a8adbff706f8a71132afb2db35f33 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 3 Jan 2025 14:52:23 +0100 Subject: [PATCH 455/611] Check out release tag --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f3dfb5f6ee09..b760698b8d0f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,7 +29,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: fetch-depth: 1 - # TODO ref: "refs/tags/r${{ github.event.inputs.releaseVersion }}" + ref: "refs/tags/r${{ github.event.inputs.releaseVersion }}" - name: Download reference JAR from staging repository id: referenceJar run: | From 821c794e45bfefa076e197242ee1d3d535d4446f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 3 Jan 2025 16:14:08 +0000 Subject: [PATCH 456/611] Pin dependencies --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b760698b8d0f..e024e8f12b2e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -74,7 +74,7 @@ jobs: with: java-version: 21 distribution: temurin - - uses: sbt/setup-sbt@v1 + - uses: sbt/setup-sbt@96cf3f09dc501acdad7807fffe97dba9fa0709be # v1 - name: Update JUnit dependencies in samples run: java src/Updater.java ${{ github.event.inputs.releaseVersion }} - name: Inject staging repository URL @@ -168,7 +168,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Download local Maven repository - uses: actions/download-artifact@v4 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4 with: name: local-maven-repository path: build/repo @@ -193,7 +193,7 @@ jobs: with: java-version: 21 distribution: temurin - - uses: sbt/setup-sbt@v1 + - uses: sbt/setup-sbt@96cf3f09dc501acdad7807fffe97dba9fa0709be # v1 - name: Update JUnit dependencies in samples run: java src/Updater.java ${{ github.event.inputs.releaseVersion }} - name: Build samples From e4814594c0ad3c02b9eb67acc837b019320753c1 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sun, 5 Jan 2025 15:33:50 +0100 Subject: [PATCH 457/611] Update copyright template --- gradle/config/spotless/eclipse-public-license-2.0.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/config/spotless/eclipse-public-license-2.0.java b/gradle/config/spotless/eclipse-public-license-2.0.java index 010f99b9800a..14bbeb94e39a 100644 --- a/gradle/config/spotless/eclipse-public-license-2.0.java +++ b/gradle/config/spotless/eclipse-public-license-2.0.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which From ee52c64336ad3a079d598bd1c3884bafbc285047 Mon Sep 17 00:00:00 2001 From: JUnit Team Date: Sun, 5 Jan 2025 15:34:51 +0100 Subject: [PATCH 458/611] Update copyright headers --- documentation/src/main/java/example/domain/Person.java | 2 +- documentation/src/main/java/example/registration/WebClient.java | 2 +- .../src/main/java/example/registration/WebResponse.java | 2 +- .../src/main/java/example/registration/WebServerExtension.java | 2 +- documentation/src/main/java/example/util/Calculator.java | 2 +- documentation/src/main/java/example/util/ListWriter.java | 2 +- documentation/src/main/java/example/util/StringUtils.java | 2 +- documentation/src/test/java/example/AssertionsDemo.java | 2 +- documentation/src/test/java/example/AssumptionsDemo.java | 2 +- documentation/src/test/java/example/AutoCloseDemo.java | 2 +- .../src/test/java/example/BeforeAndAfterSuiteDemo.java | 2 +- .../src/test/java/example/ConditionalTestExecutionDemo.java | 2 +- .../src/test/java/example/CustomLauncherInterceptor.java | 2 +- documentation/src/test/java/example/CustomTestEngine.java | 2 +- documentation/src/test/java/example/DisabledClassDemo.java | 2 +- documentation/src/test/java/example/DisabledTestsDemo.java | 2 +- documentation/src/test/java/example/DisplayNameDemo.java | 2 +- .../src/test/java/example/DisplayNameGeneratorDemo.java | 2 +- documentation/src/test/java/example/DocumentationTestSuite.java | 2 +- documentation/src/test/java/example/DynamicTestsDemo.java | 2 +- documentation/src/test/java/example/ExampleTestCase.java | 2 +- .../src/test/java/example/ExternalCustomConditionDemo.java | 2 +- .../src/test/java/example/ExternalFieldSourceDemo.java | 2 +- .../src/test/java/example/ExternalMethodSourceDemo.java | 2 +- documentation/src/test/java/example/Fast.java | 2 +- documentation/src/test/java/example/FastTest.java | 2 +- documentation/src/test/java/example/HamcrestAssertionsDemo.java | 2 +- documentation/src/test/java/example/HttpServerDemo.java | 2 +- documentation/src/test/java/example/IgnoredTestsDemo.java | 2 +- documentation/src/test/java/example/JUnit4Tests.java | 2 +- documentation/src/test/java/example/JUnitPlatformClassDemo.java | 2 +- documentation/src/test/java/example/JUnitPlatformSuiteDemo.java | 2 +- .../test/java/example/MethodSourceParameterResolutionDemo.java | 2 +- .../src/test/java/example/MyFirstJUnitJupiterTests.java | 2 +- .../src/test/java/example/OrderedNestedTestClassesDemo.java | 2 +- documentation/src/test/java/example/OrderedTestsDemo.java | 2 +- documentation/src/test/java/example/ParameterizedTestDemo.java | 2 +- documentation/src/test/java/example/PollingTimeoutDemo.java | 2 +- documentation/src/test/java/example/RepeatedTestsDemo.java | 2 +- documentation/src/test/java/example/SlowTests.java | 2 +- documentation/src/test/java/example/StandardTests.java | 2 +- documentation/src/test/java/example/SuiteDemo.java | 2 +- documentation/src/test/java/example/TaggingDemo.java | 2 +- documentation/src/test/java/example/TempDirectoryDemo.java | 2 +- documentation/src/test/java/example/TestInfoDemo.java | 2 +- documentation/src/test/java/example/TestReporterDemo.java | 2 +- documentation/src/test/java/example/TestTemplateDemo.java | 2 +- documentation/src/test/java/example/TestingAStackDemo.java | 2 +- documentation/src/test/java/example/TimeoutDemo.java | 2 +- documentation/src/test/java/example/UsingTheLauncherDemo.java | 2 +- .../src/test/java/example/callbacks/AbstractDatabaseTests.java | 2 +- .../java/example/callbacks/BrokenLifecycleMethodConfigDemo.java | 2 +- .../src/test/java/example/callbacks/DatabaseTestsDemo.java | 2 +- documentation/src/test/java/example/callbacks/Extension1.java | 2 +- documentation/src/test/java/example/callbacks/Extension2.java | 2 +- documentation/src/test/java/example/callbacks/Logger.java | 2 +- .../test/java/example/defaultmethods/ComparableContract.java | 2 +- .../src/test/java/example/defaultmethods/EqualsContract.java | 2 +- .../src/test/java/example/defaultmethods/StringTests.java | 2 +- .../src/test/java/example/defaultmethods/Testable.java | 2 +- .../java/example/exception/AssertDoesNotThrowExceptionDemo.java | 2 +- .../src/test/java/example/exception/ExceptionAssertionDemo.java | 2 +- .../java/example/exception/ExceptionAssertionExactDemo.java | 2 +- .../src/test/java/example/exception/FailedAssertionDemo.java | 2 +- .../test/java/example/exception/IgnoreIOExceptionExtension.java | 2 +- .../src/test/java/example/exception/IgnoreIOExceptionTests.java | 2 +- .../test/java/example/exception/MultipleHandlersTestCase.java | 2 +- .../java/example/exception/RecordStateOnErrorExtension.java | 2 +- .../java/example/exception/UncaughtExceptionHandlingDemo.java | 2 +- .../src/test/java/example/extensions/HttpServerExtension.java | 2 +- .../src/test/java/example/extensions/HttpServerResource.java | 2 +- .../java/example/extensions/ParameterResolverConflictDemo.java | 2 +- .../extensions/ParameterResolverCustomAnnotationDemo.java | 2 +- .../example/extensions/ParameterResolverCustomTypeDemo.java | 2 +- .../example/extensions/ParameterResolverNoConflictDemo.java | 2 +- documentation/src/test/java/example/extensions/Random.java | 2 +- .../src/test/java/example/extensions/RandomNumberDemo.java | 2 +- .../src/test/java/example/extensions/RandomNumberExtension.java | 2 +- .../src/test/java/example/interceptor/SwingEdtInterceptor.java | 2 +- .../src/test/java/example/registration/DocumentationDemo.java | 2 +- .../src/test/java/example/registration/WebServerDemo.java | 2 +- .../test/java/example/session/GlobalSetupTeardownListener.java | 2 +- documentation/src/test/java/example/session/HttpTests.java | 2 +- .../example/sharedresources/ChildrenSharedResourcesDemo.java | 2 +- .../example/sharedresources/DynamicSharedResourcesDemo.java | 2 +- .../java/example/sharedresources/StaticSharedResourcesDemo.java | 2 +- .../src/test/java/example/testinterface/TestInterfaceDemo.java | 2 +- .../example/testinterface/TestInterfaceDynamicTestsDemo.java | 2 +- .../test/java/example/testinterface/TestLifecycleLogger.java | 2 +- .../test/java/example/testinterface/TimeExecutionLogger.java | 2 +- .../test/java/example/testkit/EngineTestKitAllEventsDemo.java | 2 +- .../java/example/testkit/EngineTestKitFailedMethodDemo.java | 2 +- .../java/example/testkit/EngineTestKitSkippedMethodDemo.java | 2 +- .../test/java/example/testkit/EngineTestKitStatisticsDemo.java | 2 +- documentation/src/test/java/example/timing/TimingExtension.java | 2 +- .../src/test/java/example/timing/TimingExtensionTests.java | 2 +- documentation/src/test/java/extensions/DisabledOnOpenJ9.java | 2 +- documentation/src/test/java/extensions/ExpectToFail.java | 2 +- .../src/test/java21/example/DynamicTestsNamedDemo.java | 2 +- .../src/test/java21/example/MyFirstJUnitJupiterRecordTests.java | 2 +- documentation/src/test/kotlin/example/FibonacciCalculator.kt | 2 +- documentation/src/test/kotlin/example/KotlinAssertionsDemo.kt | 2 +- .../src/test/kotlin/example/registration/KotlinWebServerDemo.kt | 2 +- .../tools/java/org/junit/api/tools/AbstractApiReportWriter.java | 2 +- documentation/src/tools/java/org/junit/api/tools/ApiReport.java | 2 +- .../src/tools/java/org/junit/api/tools/ApiReportGenerator.java | 2 +- .../src/tools/java/org/junit/api/tools/ApiReportWriter.java | 2 +- .../tools/java/org/junit/api/tools/AsciidocApiReportWriter.java | 2 +- .../src/tools/java/org/junit/api/tools/Declaration.java | 2 +- .../src/tools/java/org/junit/api/tools/HtmlApiReportWriter.java | 2 +- .../tools/java/org/junit/api/tools/MarkdownApiReportWriter.java | 2 +- .../src/main/java/org/junit/jupiter/api/AfterAll.java | 2 +- .../src/main/java/org/junit/jupiter/api/AfterEach.java | 2 +- .../src/main/java/org/junit/jupiter/api/AssertAll.java | 2 +- .../src/main/java/org/junit/jupiter/api/AssertArrayEquals.java | 2 +- .../src/main/java/org/junit/jupiter/api/AssertDoesNotThrow.java | 2 +- .../src/main/java/org/junit/jupiter/api/AssertEquals.java | 2 +- .../src/main/java/org/junit/jupiter/api/AssertFalse.java | 2 +- .../src/main/java/org/junit/jupiter/api/AssertInstanceOf.java | 2 +- .../main/java/org/junit/jupiter/api/AssertIterableEquals.java | 2 +- .../src/main/java/org/junit/jupiter/api/AssertLinesMatch.java | 2 +- .../src/main/java/org/junit/jupiter/api/AssertNotEquals.java | 2 +- .../src/main/java/org/junit/jupiter/api/AssertNotNull.java | 2 +- .../src/main/java/org/junit/jupiter/api/AssertNotSame.java | 2 +- .../src/main/java/org/junit/jupiter/api/AssertNull.java | 2 +- .../src/main/java/org/junit/jupiter/api/AssertSame.java | 2 +- .../src/main/java/org/junit/jupiter/api/AssertThrows.java | 2 +- .../main/java/org/junit/jupiter/api/AssertThrowsExactly.java | 2 +- .../src/main/java/org/junit/jupiter/api/AssertTimeout.java | 2 +- .../java/org/junit/jupiter/api/AssertTimeoutPreemptively.java | 2 +- .../src/main/java/org/junit/jupiter/api/AssertTrue.java | 2 +- .../java/org/junit/jupiter/api/AssertionFailureBuilder.java | 2 +- .../src/main/java/org/junit/jupiter/api/AssertionUtils.java | 2 +- .../src/main/java/org/junit/jupiter/api/Assertions.java | 2 +- .../src/main/java/org/junit/jupiter/api/Assumptions.java | 2 +- .../src/main/java/org/junit/jupiter/api/AutoClose.java | 2 +- .../src/main/java/org/junit/jupiter/api/BeforeAll.java | 2 +- .../src/main/java/org/junit/jupiter/api/BeforeEach.java | 2 +- .../src/main/java/org/junit/jupiter/api/ClassDescriptor.java | 2 +- .../src/main/java/org/junit/jupiter/api/ClassOrderer.java | 2 +- .../main/java/org/junit/jupiter/api/ClassOrdererContext.java | 2 +- .../src/main/java/org/junit/jupiter/api/Disabled.java | 2 +- .../src/main/java/org/junit/jupiter/api/DisplayName.java | 2 +- .../main/java/org/junit/jupiter/api/DisplayNameGeneration.java | 2 +- .../main/java/org/junit/jupiter/api/DisplayNameGenerator.java | 2 +- .../src/main/java/org/junit/jupiter/api/DynamicContainer.java | 2 +- .../src/main/java/org/junit/jupiter/api/DynamicNode.java | 2 +- .../src/main/java/org/junit/jupiter/api/DynamicTest.java | 2 +- .../org/junit/jupiter/api/IndicativeSentencesGeneration.java | 2 +- .../src/main/java/org/junit/jupiter/api/MethodDescriptor.java | 2 +- .../src/main/java/org/junit/jupiter/api/MethodOrderer.java | 2 +- .../main/java/org/junit/jupiter/api/MethodOrdererContext.java | 2 +- .../src/main/java/org/junit/jupiter/api/Named.java | 2 +- .../src/main/java/org/junit/jupiter/api/NamedExecutable.java | 2 +- .../src/main/java/org/junit/jupiter/api/Nested.java | 2 +- .../src/main/java/org/junit/jupiter/api/Order.java | 2 +- .../src/main/java/org/junit/jupiter/api/RandomOrdererUtils.java | 2 +- .../src/main/java/org/junit/jupiter/api/RepeatedTest.java | 2 +- .../src/main/java/org/junit/jupiter/api/RepetitionInfo.java | 2 +- junit-jupiter-api/src/main/java/org/junit/jupiter/api/Tag.java | 2 +- junit-jupiter-api/src/main/java/org/junit/jupiter/api/Tags.java | 2 +- junit-jupiter-api/src/main/java/org/junit/jupiter/api/Test.java | 2 +- .../src/main/java/org/junit/jupiter/api/TestClassOrder.java | 2 +- .../src/main/java/org/junit/jupiter/api/TestFactory.java | 2 +- .../src/main/java/org/junit/jupiter/api/TestInfo.java | 2 +- .../src/main/java/org/junit/jupiter/api/TestInstance.java | 2 +- .../src/main/java/org/junit/jupiter/api/TestMethodOrder.java | 2 +- .../src/main/java/org/junit/jupiter/api/TestReporter.java | 2 +- .../src/main/java/org/junit/jupiter/api/TestTemplate.java | 2 +- .../src/main/java/org/junit/jupiter/api/Timeout.java | 2 +- .../api/condition/AbstractOsBasedExecutionCondition.java | 2 +- .../api/condition/AbstractRepeatableAnnotationCondition.java | 2 +- .../junit/jupiter/api/condition/BooleanExecutionCondition.java | 2 +- .../org/junit/jupiter/api/condition/DisabledForJreRange.java | 2 +- .../jupiter/api/condition/DisabledForJreRangeCondition.java | 2 +- .../main/java/org/junit/jupiter/api/condition/DisabledIf.java | 2 +- .../org/junit/jupiter/api/condition/DisabledIfCondition.java | 2 +- .../jupiter/api/condition/DisabledIfEnvironmentVariable.java | 2 +- .../api/condition/DisabledIfEnvironmentVariableCondition.java | 2 +- .../jupiter/api/condition/DisabledIfEnvironmentVariables.java | 2 +- .../junit/jupiter/api/condition/DisabledIfSystemProperties.java | 2 +- .../junit/jupiter/api/condition/DisabledIfSystemProperty.java | 2 +- .../api/condition/DisabledIfSystemPropertyCondition.java | 2 +- .../org/junit/jupiter/api/condition/DisabledInNativeImage.java | 2 +- .../java/org/junit/jupiter/api/condition/DisabledOnJre.java | 2 +- .../org/junit/jupiter/api/condition/DisabledOnJreCondition.java | 2 +- .../main/java/org/junit/jupiter/api/condition/DisabledOnOs.java | 2 +- .../org/junit/jupiter/api/condition/DisabledOnOsCondition.java | 2 +- .../org/junit/jupiter/api/condition/EnabledForJreRange.java | 2 +- .../jupiter/api/condition/EnabledForJreRangeCondition.java | 2 +- .../main/java/org/junit/jupiter/api/condition/EnabledIf.java | 2 +- .../org/junit/jupiter/api/condition/EnabledIfCondition.java | 2 +- .../jupiter/api/condition/EnabledIfEnvironmentVariable.java | 2 +- .../api/condition/EnabledIfEnvironmentVariableCondition.java | 2 +- .../jupiter/api/condition/EnabledIfEnvironmentVariables.java | 2 +- .../junit/jupiter/api/condition/EnabledIfSystemProperties.java | 2 +- .../junit/jupiter/api/condition/EnabledIfSystemProperty.java | 2 +- .../jupiter/api/condition/EnabledIfSystemPropertyCondition.java | 2 +- .../org/junit/jupiter/api/condition/EnabledInNativeImage.java | 2 +- .../main/java/org/junit/jupiter/api/condition/EnabledOnJre.java | 2 +- .../org/junit/jupiter/api/condition/EnabledOnJreCondition.java | 2 +- .../main/java/org/junit/jupiter/api/condition/EnabledOnOs.java | 2 +- .../org/junit/jupiter/api/condition/EnabledOnOsCondition.java | 2 +- .../org/junit/jupiter/api/condition/MethodBasedCondition.java | 2 +- .../src/main/java/org/junit/jupiter/api/condition/OS.java | 2 +- .../java/org/junit/jupiter/api/extension/AfterAllCallback.java | 2 +- .../java/org/junit/jupiter/api/extension/AfterEachCallback.java | 2 +- .../junit/jupiter/api/extension/AfterTestExecutionCallback.java | 2 +- .../junit/jupiter/api/extension/AnnotatedElementContext.java | 2 +- .../java/org/junit/jupiter/api/extension/BeforeAllCallback.java | 2 +- .../org/junit/jupiter/api/extension/BeforeEachCallback.java | 2 +- .../jupiter/api/extension/BeforeTestExecutionCallback.java | 2 +- .../junit/jupiter/api/extension/ConditionEvaluationResult.java | 2 +- .../jupiter/api/extension/DynamicTestInvocationContext.java | 2 +- .../java/org/junit/jupiter/api/extension/ExecutableInvoker.java | 2 +- .../org/junit/jupiter/api/extension/ExecutionCondition.java | 2 +- .../main/java/org/junit/jupiter/api/extension/ExtendWith.java | 2 +- .../main/java/org/junit/jupiter/api/extension/Extension.java | 2 +- .../jupiter/api/extension/ExtensionConfigurationException.java | 2 +- .../java/org/junit/jupiter/api/extension/ExtensionContext.java | 2 +- .../junit/jupiter/api/extension/ExtensionContextException.java | 2 +- .../main/java/org/junit/jupiter/api/extension/Extensions.java | 2 +- .../org/junit/jupiter/api/extension/InvocationInterceptor.java | 2 +- .../api/extension/LifecycleMethodExecutionExceptionHandler.java | 2 +- .../main/java/org/junit/jupiter/api/extension/MediaType.java | 2 +- .../java/org/junit/jupiter/api/extension/ParameterContext.java | 2 +- .../jupiter/api/extension/ParameterResolutionException.java | 2 +- .../java/org/junit/jupiter/api/extension/ParameterResolver.java | 2 +- .../org/junit/jupiter/api/extension/PreInterruptCallback.java | 2 +- .../org/junit/jupiter/api/extension/PreInterruptContext.java | 2 +- .../jupiter/api/extension/ReflectiveInvocationContext.java | 2 +- .../java/org/junit/jupiter/api/extension/RegisterExtension.java | 2 +- .../jupiter/api/extension/TestExecutionExceptionHandler.java | 2 +- .../org/junit/jupiter/api/extension/TestInstanceFactory.java | 2 +- .../junit/jupiter/api/extension/TestInstanceFactoryContext.java | 2 +- .../junit/jupiter/api/extension/TestInstancePostProcessor.java | 2 +- .../jupiter/api/extension/TestInstancePreConstructCallback.java | 2 +- .../jupiter/api/extension/TestInstancePreDestroyCallback.java | 2 +- .../java/org/junit/jupiter/api/extension/TestInstances.java | 2 +- .../jupiter/api/extension/TestInstantiationAwareExtension.java | 2 +- .../junit/jupiter/api/extension/TestInstantiationException.java | 2 +- .../jupiter/api/extension/TestTemplateInvocationContext.java | 2 +- .../api/extension/TestTemplateInvocationContextProvider.java | 2 +- .../main/java/org/junit/jupiter/api/extension/TestWatcher.java | 2 +- .../api/extension/support/TypeBasedParameterResolver.java | 2 +- .../main/java/org/junit/jupiter/api/function/Executable.java | 2 +- .../java/org/junit/jupiter/api/function/ThrowingConsumer.java | 2 +- .../java/org/junit/jupiter/api/function/ThrowingSupplier.java | 2 +- .../src/main/java/org/junit/jupiter/api/io/CleanupMode.java | 2 +- .../src/main/java/org/junit/jupiter/api/io/TempDir.java | 2 +- .../src/main/java/org/junit/jupiter/api/io/TempDirFactory.java | 2 +- .../src/main/java/org/junit/jupiter/api/parallel/Execution.java | 2 +- .../main/java/org/junit/jupiter/api/parallel/ExecutionMode.java | 2 +- .../src/main/java/org/junit/jupiter/api/parallel/Isolated.java | 2 +- .../java/org/junit/jupiter/api/parallel/ResourceAccessMode.java | 2 +- .../main/java/org/junit/jupiter/api/parallel/ResourceLock.java | 2 +- .../java/org/junit/jupiter/api/parallel/ResourceLockTarget.java | 2 +- .../main/java/org/junit/jupiter/api/parallel/ResourceLocks.java | 2 +- .../org/junit/jupiter/api/parallel/ResourceLocksProvider.java | 2 +- .../src/main/java/org/junit/jupiter/api/parallel/Resources.java | 2 +- .../src/main/kotlin/org/junit/jupiter/api/Assertions.kt | 2 +- .../java/org/junit/jupiter/api/EqualsAndHashCodeAssertions.java | 2 +- .../java/org/junit/jupiter/api/extension/DisabledOnOpenJ9.java | 2 +- .../api/extension/ExtensionContextParameterResolver.java | 2 +- .../java/org/junit/jupiter/api/fixtures/TrackLogRecords.java | 2 +- .../src/main/java/org/junit/jupiter/engine/Constants.java | 2 +- .../main/java/org/junit/jupiter/engine/JupiterTestEngine.java | 2 +- .../jupiter/engine/config/CachingJupiterConfiguration.java | 2 +- .../jupiter/engine/config/DefaultJupiterConfiguration.java | 2 +- .../engine/config/EnumConfigurationParameterConverter.java | 2 +- .../config/InstantiatingConfigurationParameterConverter.java | 2 +- .../org/junit/jupiter/engine/config/JupiterConfiguration.java | 2 +- .../jupiter/engine/descriptor/AbstractExtensionContext.java | 2 +- .../jupiter/engine/descriptor/ClassBasedTestDescriptor.java | 2 +- .../junit/jupiter/engine/descriptor/ClassExtensionContext.java | 2 +- .../junit/jupiter/engine/descriptor/ClassTestDescriptor.java | 2 +- .../engine/descriptor/DefaultDynamicTestInvocationContext.java | 2 +- .../engine/descriptor/DefaultTestInstanceFactoryContext.java | 2 +- .../org/junit/jupiter/engine/descriptor/DisplayNameUtils.java | 2 +- .../engine/descriptor/DynamicContainerTestDescriptor.java | 2 +- .../jupiter/engine/descriptor/DynamicDescendantFilter.java | 2 +- .../jupiter/engine/descriptor/DynamicExtensionContext.java | 2 +- .../jupiter/engine/descriptor/DynamicNodeTestDescriptor.java | 2 +- .../jupiter/engine/descriptor/DynamicTestTestDescriptor.java | 2 +- .../jupiter/engine/descriptor/ExclusiveResourceCollector.java | 2 +- .../org/junit/jupiter/engine/descriptor/ExtensionUtils.java | 2 +- .../java/org/junit/jupiter/engine/descriptor/Filterable.java | 2 +- .../jupiter/engine/descriptor/JupiterEngineDescriptor.java | 2 +- .../engine/descriptor/JupiterEngineExtensionContext.java | 2 +- .../junit/jupiter/engine/descriptor/JupiterTestDescriptor.java | 2 +- .../junit/jupiter/engine/descriptor/LifecycleMethodUtils.java | 2 +- .../jupiter/engine/descriptor/MethodBasedTestDescriptor.java | 2 +- .../junit/jupiter/engine/descriptor/MethodExtensionContext.java | 2 +- .../junit/jupiter/engine/descriptor/MethodSourceSupport.java | 2 +- .../jupiter/engine/descriptor/NestedClassTestDescriptor.java | 2 +- .../org/junit/jupiter/engine/descriptor/ResourceLockAware.java | 2 +- .../jupiter/engine/descriptor/TestFactoryTestDescriptor.java | 2 +- .../jupiter/engine/descriptor/TestInstanceLifecycleUtils.java | 2 +- .../jupiter/engine/descriptor/TestMethodTestDescriptor.java | 2 +- .../jupiter/engine/descriptor/TestTemplateExtensionContext.java | 2 +- .../engine/descriptor/TestTemplateInvocationTestDescriptor.java | 2 +- .../jupiter/engine/descriptor/TestTemplateTestDescriptor.java | 2 +- .../engine/discovery/AbstractAnnotatedDescriptorWrapper.java | 2 +- .../junit/jupiter/engine/discovery/AbstractOrderingVisitor.java | 2 +- .../junit/jupiter/engine/discovery/ClassOrderingVisitor.java | 2 +- .../junit/jupiter/engine/discovery/ClassSelectorResolver.java | 2 +- .../junit/jupiter/engine/discovery/DefaultClassDescriptor.java | 2 +- .../jupiter/engine/discovery/DefaultClassOrdererContext.java | 2 +- .../junit/jupiter/engine/discovery/DefaultMethodDescriptor.java | 2 +- .../jupiter/engine/discovery/DefaultMethodOrdererContext.java | 2 +- .../jupiter/engine/discovery/DiscoverySelectorResolver.java | 2 +- .../java/org/junit/jupiter/engine/discovery/MethodFinder.java | 2 +- .../junit/jupiter/engine/discovery/MethodOrderingVisitor.java | 2 +- .../junit/jupiter/engine/discovery/MethodSelectorResolver.java | 2 +- .../junit/jupiter/engine/discovery/predicates/IsInnerClass.java | 2 +- .../jupiter/engine/discovery/predicates/IsNestedTestClass.java | 2 +- .../engine/discovery/predicates/IsPotentialTestContainer.java | 2 +- .../engine/discovery/predicates/IsTestClassWithTests.java | 2 +- .../engine/discovery/predicates/IsTestFactoryMethod.java | 2 +- .../junit/jupiter/engine/discovery/predicates/IsTestMethod.java | 2 +- .../engine/discovery/predicates/IsTestTemplateMethod.java | 2 +- .../jupiter/engine/discovery/predicates/IsTestableMethod.java | 2 +- .../junit/jupiter/engine/execution/AfterEachMethodAdapter.java | 2 +- .../junit/jupiter/engine/execution/BeforeEachMethodAdapter.java | 2 +- .../jupiter/engine/execution/ConditionEvaluationException.java | 2 +- .../org/junit/jupiter/engine/execution/ConditionEvaluator.java | 2 +- .../junit/jupiter/engine/execution/ConstructorInvocation.java | 2 +- .../jupiter/engine/execution/DefaultExecutableInvoker.java | 2 +- .../junit/jupiter/engine/execution/DefaultParameterContext.java | 2 +- .../junit/jupiter/engine/execution/DefaultTestInstances.java | 2 +- .../jupiter/engine/execution/ExtensionContextSupplier.java | 2 +- .../jupiter/engine/execution/InterceptingExecutableInvoker.java | 2 +- .../jupiter/engine/execution/InvocationInterceptorChain.java | 2 +- .../jupiter/engine/execution/JupiterEngineExecutionContext.java | 2 +- .../org/junit/jupiter/engine/execution/MethodInvocation.java | 2 +- .../org/junit/jupiter/engine/execution/NamespaceAwareStore.java | 2 +- .../jupiter/engine/execution/ParameterResolutionUtils.java | 2 +- .../junit/jupiter/engine/execution/TestInstancesProvider.java | 2 +- .../org/junit/jupiter/engine/extension/AutoCloseExtension.java | 2 +- .../jupiter/engine/extension/DefaultPreInterruptContext.java | 2 +- .../junit/jupiter/engine/extension/DefaultRepetitionInfo.java | 2 +- .../org/junit/jupiter/engine/extension/DefaultTestReporter.java | 2 +- .../org/junit/jupiter/engine/extension/DisabledCondition.java | 2 +- .../jupiter/engine/extension/ExtensionContextInternal.java | 2 +- .../org/junit/jupiter/engine/extension/ExtensionRegistrar.java | 2 +- .../org/junit/jupiter/engine/extension/ExtensionRegistry.java | 2 +- .../jupiter/engine/extension/MutableExtensionRegistry.java | 2 +- .../engine/extension/PreInterruptCallbackInvocation.java | 2 +- .../engine/extension/PreInterruptCallbackInvocationFactory.java | 2 +- .../jupiter/engine/extension/PreInterruptThreadDumpPrinter.java | 2 +- .../engine/extension/RepeatedTestDisplayNameFormatter.java | 2 +- .../junit/jupiter/engine/extension/RepeatedTestExtension.java | 2 +- .../jupiter/engine/extension/RepeatedTestInvocationContext.java | 2 +- .../org/junit/jupiter/engine/extension/RepetitionExtension.java | 2 +- .../jupiter/engine/extension/SameThreadTimeoutInvocation.java | 2 +- .../engine/extension/SeparateThreadTimeoutInvocation.java | 2 +- .../java/org/junit/jupiter/engine/extension/TempDirectory.java | 2 +- .../jupiter/engine/extension/TestInfoParameterResolver.java | 2 +- .../jupiter/engine/extension/TestReporterParameterResolver.java | 2 +- .../junit/jupiter/engine/extension/TimeoutConfiguration.java | 2 +- .../org/junit/jupiter/engine/extension/TimeoutDuration.java | 2 +- .../junit/jupiter/engine/extension/TimeoutDurationParser.java | 2 +- .../junit/jupiter/engine/extension/TimeoutExceptionFactory.java | 2 +- .../org/junit/jupiter/engine/extension/TimeoutExtension.java | 2 +- .../jupiter/engine/extension/TimeoutInvocationFactory.java | 2 +- .../engine/support/JupiterThrowableCollectorFactory.java | 2 +- .../support/OpenTest4JAndJUnit4AwareThrowableCollector.java | 2 +- .../junit/jupiter/engine/discovery/JupiterUniqueIdBuilder.java | 2 +- .../jupiter/migrationsupport/EnableJUnit4MigrationSupport.java | 2 +- .../jupiter/migrationsupport/conditions/IgnoreCondition.java | 2 +- .../migrationsupport/rules/EnableRuleMigrationSupport.java | 2 +- .../migrationsupport/rules/ExpectedExceptionSupport.java | 2 +- .../jupiter/migrationsupport/rules/ExternalResourceSupport.java | 2 +- .../junit/jupiter/migrationsupport/rules/TestRuleSupport.java | 2 +- .../junit/jupiter/migrationsupport/rules/VerifierSupport.java | 2 +- .../migrationsupport/rules/adapter/AbstractTestRuleAdapter.java | 2 +- .../rules/adapter/ExpectedExceptionAdapter.java | 2 +- .../migrationsupport/rules/adapter/ExternalResourceAdapter.java | 2 +- .../rules/adapter/GenericBeforeAndAfterAdvice.java | 2 +- .../jupiter/migrationsupport/rules/adapter/VerifierAdapter.java | 2 +- .../rules/member/AbstractTestRuleAnnotatedMember.java | 2 +- .../migrationsupport/rules/member/TestRuleAnnotatedField.java | 2 +- .../migrationsupport/rules/member/TestRuleAnnotatedMember.java | 2 +- .../migrationsupport/rules/member/TestRuleAnnotatedMethod.java | 2 +- .../params/ParameterizedTestNameFormatterBenchmarks.java | 2 +- .../org/junit/jupiter/params/ArgumentCountValidationMode.java | 2 +- .../java/org/junit/jupiter/params/ArgumentCountValidator.java | 2 +- .../main/java/org/junit/jupiter/params/ParameterizedTest.java | 2 +- .../org/junit/jupiter/params/ParameterizedTestExtension.java | 2 +- .../jupiter/params/ParameterizedTestInvocationContext.java | 2 +- .../junit/jupiter/params/ParameterizedTestMethodContext.java | 2 +- .../junit/jupiter/params/ParameterizedTestNameFormatter.java | 2 +- .../jupiter/params/ParameterizedTestParameterResolver.java | 2 +- .../junit/jupiter/params/ParameterizedTestSpiInstantiator.java | 2 +- .../java/org/junit/jupiter/params/aggregator/AggregateWith.java | 2 +- .../jupiter/params/aggregator/ArgumentAccessException.java | 2 +- .../org/junit/jupiter/params/aggregator/ArgumentsAccessor.java | 2 +- .../params/aggregator/ArgumentsAggregationException.java | 2 +- .../junit/jupiter/params/aggregator/ArgumentsAggregator.java | 2 +- .../jupiter/params/aggregator/DefaultArgumentsAccessor.java | 2 +- .../params/converter/AnnotationBasedArgumentConverter.java | 2 +- .../jupiter/params/converter/ArgumentConversionException.java | 2 +- .../org/junit/jupiter/params/converter/ArgumentConverter.java | 2 +- .../java/org/junit/jupiter/params/converter/ConvertWith.java | 2 +- .../jupiter/params/converter/DefaultArgumentConverter.java | 2 +- .../jupiter/params/converter/JavaTimeArgumentConverter.java | 2 +- .../jupiter/params/converter/JavaTimeConversionPattern.java | 2 +- .../junit/jupiter/params/converter/SimpleArgumentConverter.java | 2 +- .../junit/jupiter/params/converter/TypedArgumentConverter.java | 2 +- .../params/provider/AnnotationBasedArgumentsProvider.java | 2 +- .../main/java/org/junit/jupiter/params/provider/Arguments.java | 2 +- .../org/junit/jupiter/params/provider/ArgumentsProvider.java | 2 +- .../java/org/junit/jupiter/params/provider/ArgumentsSource.java | 2 +- .../org/junit/jupiter/params/provider/ArgumentsSources.java | 2 +- .../java/org/junit/jupiter/params/provider/ArgumentsUtils.java | 2 +- .../org/junit/jupiter/params/provider/CsvArgumentsProvider.java | 2 +- .../junit/jupiter/params/provider/CsvFileArgumentsProvider.java | 2 +- .../java/org/junit/jupiter/params/provider/CsvFileSource.java | 2 +- .../java/org/junit/jupiter/params/provider/CsvFileSources.java | 2 +- .../org/junit/jupiter/params/provider/CsvParserFactory.java | 2 +- .../org/junit/jupiter/params/provider/CsvParsingException.java | 2 +- .../main/java/org/junit/jupiter/params/provider/CsvSource.java | 2 +- .../main/java/org/junit/jupiter/params/provider/CsvSources.java | 2 +- .../junit/jupiter/params/provider/EmptyArgumentsProvider.java | 2 +- .../java/org/junit/jupiter/params/provider/EmptySource.java | 2 +- .../junit/jupiter/params/provider/EnumArgumentsProvider.java | 2 +- .../main/java/org/junit/jupiter/params/provider/EnumSource.java | 2 +- .../java/org/junit/jupiter/params/provider/EnumSources.java | 2 +- .../junit/jupiter/params/provider/FieldArgumentsProvider.java | 2 +- .../java/org/junit/jupiter/params/provider/FieldSource.java | 2 +- .../java/org/junit/jupiter/params/provider/FieldSources.java | 2 +- .../junit/jupiter/params/provider/MethodArgumentsProvider.java | 2 +- .../java/org/junit/jupiter/params/provider/MethodSource.java | 2 +- .../java/org/junit/jupiter/params/provider/MethodSources.java | 2 +- .../org/junit/jupiter/params/provider/NullAndEmptySource.java | 2 +- .../junit/jupiter/params/provider/NullArgumentsProvider.java | 2 +- .../main/java/org/junit/jupiter/params/provider/NullEnum.java | 2 +- .../main/java/org/junit/jupiter/params/provider/NullSource.java | 2 +- .../junit/jupiter/params/provider/ValueArgumentsProvider.java | 2 +- .../java/org/junit/jupiter/params/provider/ValueSource.java | 2 +- .../java/org/junit/jupiter/params/provider/ValueSources.java | 2 +- .../org/junit/jupiter/params/support/AnnotationConsumer.java | 2 +- .../jupiter/params/support/AnnotationConsumerInitializer.java | 2 +- .../org/junit/jupiter/params/aggregator/ArgumentsAccessor.kt | 2 +- .../main/java/org/junit/platform/commons/JUnitException.java | 2 +- .../junit/platform/commons/PreconditionViolationException.java | 2 +- .../java/org/junit/platform/commons/annotation/Testable.java | 2 +- .../src/main/java/org/junit/platform/commons/function/Try.java | 2 +- .../org/junit/platform/commons/logging/LogRecordListener.java | 2 +- .../main/java/org/junit/platform/commons/logging/Logger.java | 2 +- .../java/org/junit/platform/commons/logging/LoggerFactory.java | 2 +- .../org/junit/platform/commons/support/AnnotationSupport.java | 2 +- .../java/org/junit/platform/commons/support/ClassSupport.java | 2 +- .../org/junit/platform/commons/support/DefaultResource.java | 2 +- .../junit/platform/commons/support/HierarchyTraversalMode.java | 2 +- .../org/junit/platform/commons/support/ModifierSupport.java | 2 +- .../org/junit/platform/commons/support/ReflectionSupport.java | 2 +- .../main/java/org/junit/platform/commons/support/Resource.java | 2 +- .../java/org/junit/platform/commons/support/SearchOption.java | 2 +- .../commons/support/conversion/ConversionException.java | 2 +- .../platform/commons/support/conversion/ConversionSupport.java | 2 +- .../support/conversion/FallbackStringToObjectConverter.java | 2 +- .../commons/support/conversion/StringToBooleanConverter.java | 2 +- .../commons/support/conversion/StringToCharacterConverter.java | 2 +- .../commons/support/conversion/StringToClassConverter.java | 2 +- .../support/conversion/StringToCommonJavaTypesConverter.java | 2 +- .../commons/support/conversion/StringToEnumConverter.java | 2 +- .../commons/support/conversion/StringToJavaTimeConverter.java | 2 +- .../commons/support/conversion/StringToNumberConverter.java | 2 +- .../commons/support/conversion/StringToObjectConverter.java | 2 +- .../junit/platform/commons/support/scanning/ClassFilter.java | 2 +- .../platform/commons/support/scanning/ClasspathFileVisitor.java | 2 +- .../platform/commons/support/scanning/ClasspathFilters.java | 2 +- .../platform/commons/support/scanning/ClasspathScanner.java | 2 +- .../junit/platform/commons/support/scanning/CloseablePath.java | 2 +- .../commons/support/scanning/DefaultClasspathScanner.java | 2 +- .../java/org/junit/platform/commons/util/AnnotationUtils.java | 2 +- .../org/junit/platform/commons/util/BlacklistedExceptions.java | 2 +- .../java/org/junit/platform/commons/util/ClassLoaderUtils.java | 2 +- .../platform/commons/util/ClassNamePatternFilterUtils.java | 2 +- .../main/java/org/junit/platform/commons/util/ClassUtils.java | 2 +- .../org/junit/platform/commons/util/ClasspathScannerLoader.java | 2 +- .../java/org/junit/platform/commons/util/CollectionUtils.java | 2 +- .../java/org/junit/platform/commons/util/ExceptionUtils.java | 2 +- .../java/org/junit/platform/commons/util/FunctionUtils.java | 2 +- .../src/main/java/org/junit/platform/commons/util/LruCache.java | 2 +- .../main/java/org/junit/platform/commons/util/ModuleUtils.java | 2 +- .../java/org/junit/platform/commons/util/PackageNameUtils.java | 2 +- .../main/java/org/junit/platform/commons/util/PackageUtils.java | 2 +- .../platform/commons/util/PreconditionViolationException.java | 2 +- .../java/org/junit/platform/commons/util/Preconditions.java | 2 +- .../java/org/junit/platform/commons/util/ReflectionUtils.java | 2 +- .../java/org/junit/platform/commons/util/ResourceUtils.java | 2 +- .../main/java/org/junit/platform/commons/util/RuntimeUtils.java | 2 +- .../org/junit/platform/commons/util/ServiceLoaderUtils.java | 2 +- .../main/java/org/junit/platform/commons/util/StringUtils.java | 2 +- .../java/org/junit/platform/commons/util/ToStringBuilder.java | 2 +- .../junit/platform/commons/util/UnrecoverableExceptions.java | 2 +- .../main/java9/org/junit/platform/commons/util/ModuleUtils.java | 2 +- .../java9/org/junit/platform/commons/util/PackageNameUtils.java | 2 +- .../org/junit/platform/commons/util/ServiceLoaderUtils.java | 2 +- .../junit/platform/commons/test/ConcurrencyTestingUtils.java | 2 +- .../java/org/junit/platform/commons/test/TestClassLoader.java | 2 +- .../main/java/org/junit/platform/console/ConsoleLauncher.java | 2 +- .../junit/platform/console/options/AnsiColorOptionMixin.java | 2 +- .../org/junit/platform/console/options/BannerOptionMixin.java | 2 +- .../java/org/junit/platform/console/options/BaseCommand.java | 2 +- .../platform/console/options/ClasspathEntriesConverter.java | 2 +- .../java/org/junit/platform/console/options/CommandFacade.java | 2 +- .../java/org/junit/platform/console/options/CommandResult.java | 2 +- .../java/org/junit/platform/console/options/ConsoleUtils.java | 2 +- .../main/java/org/junit/platform/console/options/Details.java | 2 +- .../junit/platform/console/options/DiscoverTestsCommand.java | 2 +- .../org/junit/platform/console/options/ExecuteTestsCommand.java | 2 +- .../junit/platform/console/options/ListTestEnginesCommand.java | 2 +- .../java/org/junit/platform/console/options/MainCommand.java | 2 +- .../junit/platform/console/options/ManifestVersionProvider.java | 2 +- .../org/junit/platform/console/options/OutputStreamConfig.java | 2 +- .../org/junit/platform/console/options/SelectorConverter.java | 2 +- .../platform/console/options/TestConsoleOutputOptions.java | 2 +- .../platform/console/options/TestConsoleOutputOptionsMixin.java | 2 +- .../junit/platform/console/options/TestDiscoveryOptions.java | 2 +- .../platform/console/options/TestDiscoveryOptionsMixin.java | 2 +- .../src/main/java/org/junit/platform/console/options/Theme.java | 2 +- .../java/org/junit/platform/console/tasks/ColorPalette.java | 2 +- .../org/junit/platform/console/tasks/ConsoleTestExecutor.java | 2 +- .../console/tasks/CustomContextClassLoaderExecutor.java | 2 +- .../junit/platform/console/tasks/DetailsPrintingListener.java | 2 +- .../junit/platform/console/tasks/DiscoveryRequestCreator.java | 2 +- .../org/junit/platform/console/tasks/FlatPrintingListener.java | 2 +- .../src/main/java/org/junit/platform/console/tasks/Style.java | 2 +- .../junit/platform/console/tasks/TestFeedPrintingListener.java | 2 +- .../main/java/org/junit/platform/console/tasks/TreeNode.java | 2 +- .../main/java/org/junit/platform/console/tasks/TreePrinter.java | 2 +- .../org/junit/platform/console/tasks/TreePrintingListener.java | 2 +- .../platform/console/tasks/VerboseTreePrintingListener.java | 2 +- .../java17/org/junit/platform/console/options/ConsoleUtils.java | 2 +- .../org/junit/platform/console/ConsoleLauncherToolProvider.java | 2 +- .../main/java/org/junit/platform/engine/CompositeFilter.java | 2 +- .../java/org/junit/platform/engine/ConfigurationParameters.java | 2 +- .../main/java/org/junit/platform/engine/DiscoveryFilter.java | 2 +- .../main/java/org/junit/platform/engine/DiscoverySelector.java | 2 +- .../org/junit/platform/engine/DiscoverySelectorIdentifier.java | 2 +- .../java/org/junit/platform/engine/EngineDiscoveryListener.java | 2 +- .../java/org/junit/platform/engine/EngineDiscoveryRequest.java | 2 +- .../java/org/junit/platform/engine/EngineExecutionListener.java | 2 +- .../main/java/org/junit/platform/engine/ExecutionRequest.java | 2 +- .../src/main/java/org/junit/platform/engine/Filter.java | 2 +- .../src/main/java/org/junit/platform/engine/FilterResult.java | 2 +- .../org/junit/platform/engine/SelectorResolutionResult.java | 2 +- .../src/main/java/org/junit/platform/engine/TestDescriptor.java | 2 +- .../src/main/java/org/junit/platform/engine/TestEngine.java | 2 +- .../java/org/junit/platform/engine/TestExecutionResult.java | 2 +- .../src/main/java/org/junit/platform/engine/TestSource.java | 2 +- .../src/main/java/org/junit/platform/engine/TestTag.java | 2 +- .../src/main/java/org/junit/platform/engine/UniqueId.java | 2 +- .../src/main/java/org/junit/platform/engine/UniqueIdFormat.java | 2 +- .../platform/engine/discovery/AbstractClassNameFilter.java | 2 +- .../org/junit/platform/engine/discovery/ClassNameFilter.java | 2 +- .../java/org/junit/platform/engine/discovery/ClassSelector.java | 2 +- .../platform/engine/discovery/ClasspathResourceSelector.java | 2 +- .../junit/platform/engine/discovery/ClasspathRootSelector.java | 2 +- .../org/junit/platform/engine/discovery/DirectorySelector.java | 2 +- .../engine/discovery/DiscoverySelectorIdentifierParser.java | 2 +- .../engine/discovery/DiscoverySelectorIdentifierParsers.java | 2 +- .../org/junit/platform/engine/discovery/DiscoverySelectors.java | 2 +- .../junit/platform/engine/discovery/ExcludeClassNameFilter.java | 2 +- .../platform/engine/discovery/ExcludePackageNameFilter.java | 2 +- .../java/org/junit/platform/engine/discovery/FilePosition.java | 2 +- .../java/org/junit/platform/engine/discovery/FileSelector.java | 2 +- .../junit/platform/engine/discovery/IncludeClassNameFilter.java | 2 +- .../platform/engine/discovery/IncludePackageNameFilter.java | 2 +- .../org/junit/platform/engine/discovery/IterationSelector.java | 2 +- .../org/junit/platform/engine/discovery/MethodSelector.java | 2 +- .../org/junit/platform/engine/discovery/ModuleSelector.java | 2 +- .../junit/platform/engine/discovery/NestedClassSelector.java | 2 +- .../junit/platform/engine/discovery/NestedMethodSelector.java | 2 +- .../org/junit/platform/engine/discovery/PackageNameFilter.java | 2 +- .../org/junit/platform/engine/discovery/PackageSelector.java | 2 +- .../org/junit/platform/engine/discovery/UniqueIdSelector.java | 2 +- .../java/org/junit/platform/engine/discovery/UriSelector.java | 2 +- .../java/org/junit/platform/engine/reporting/FileEntry.java | 2 +- .../platform/engine/reporting/OutputDirectoryProvider.java | 2 +- .../java/org/junit/platform/engine/reporting/ReportEntry.java | 2 +- .../engine/support/config/PrefixedConfigurationParameters.java | 2 +- .../engine/support/descriptor/AbstractTestDescriptor.java | 2 +- .../junit/platform/engine/support/descriptor/ClassSource.java | 2 +- .../engine/support/descriptor/ClasspathResourceSource.java | 2 +- .../platform/engine/support/descriptor/CompositeTestSource.java | 2 +- .../platform/engine/support/descriptor/DefaultUriSource.java | 2 +- .../platform/engine/support/descriptor/DirectorySource.java | 2 +- .../platform/engine/support/descriptor/EngineDescriptor.java | 2 +- .../junit/platform/engine/support/descriptor/FilePosition.java | 2 +- .../junit/platform/engine/support/descriptor/FileSource.java | 2 +- .../platform/engine/support/descriptor/FileSystemSource.java | 2 +- .../junit/platform/engine/support/descriptor/MethodSource.java | 2 +- .../junit/platform/engine/support/descriptor/PackageSource.java | 2 +- .../org/junit/platform/engine/support/descriptor/UriSource.java | 2 +- .../support/discovery/ClassContainerSelectorResolver.java | 2 +- .../support/discovery/EngineDiscoveryRequestResolution.java | 2 +- .../support/discovery/EngineDiscoveryRequestResolver.java | 2 +- .../support/discovery/ResourceContainerSelectorResolver.java | 2 +- .../junit/platform/engine/support/discovery/ResourceUtils.java | 2 +- .../platform/engine/support/discovery/SelectorResolver.java | 2 +- .../engine/support/filter/ClasspathScanningSupport.java | 2 +- .../platform/engine/support/hierarchical/CompositeLock.java | 2 +- .../hierarchical/DefaultParallelExecutionConfiguration.java | 2 +- .../DefaultParallelExecutionConfigurationStrategy.java | 2 +- .../engine/support/hierarchical/EngineExecutionContext.java | 2 +- .../platform/engine/support/hierarchical/ExclusiveResource.java | 2 +- .../ForkJoinPoolHierarchicalTestExecutorService.java | 2 +- .../engine/support/hierarchical/HierarchicalTestEngine.java | 2 +- .../engine/support/hierarchical/HierarchicalTestExecutor.java | 2 +- .../support/hierarchical/HierarchicalTestExecutorService.java | 2 +- .../junit/platform/engine/support/hierarchical/LockManager.java | 2 +- .../org/junit/platform/engine/support/hierarchical/Node.java | 2 +- .../engine/support/hierarchical/NodeExecutionAdvisor.java | 2 +- .../platform/engine/support/hierarchical/NodeTestTask.java | 2 +- .../engine/support/hierarchical/NodeTestTaskContext.java | 2 +- .../platform/engine/support/hierarchical/NodeTreeWalker.java | 2 +- .../junit/platform/engine/support/hierarchical/NodeUtils.java | 2 +- .../org/junit/platform/engine/support/hierarchical/NopLock.java | 2 +- .../support/hierarchical/OpenTest4JAwareThrowableCollector.java | 2 +- .../support/hierarchical/ParallelExecutionConfiguration.java | 2 +- .../hierarchical/ParallelExecutionConfigurationStrategy.java | 2 +- .../platform/engine/support/hierarchical/ResourceLock.java | 2 +- .../hierarchical/SameThreadHierarchicalTestExecutorService.java | 2 +- .../junit/platform/engine/support/hierarchical/SingleLock.java | 2 +- .../engine/support/hierarchical/SingleTestExecutor.java | 2 +- .../engine/support/hierarchical/ThrowableCollector.java | 2 +- .../engine/support/store/NamespacedHierarchicalStore.java | 2 +- .../support/store/NamespacedHierarchicalStoreException.java | 2 +- .../engine/support/hierarchical/DemoEngineExecutionContext.java | 2 +- .../hierarchical/DemoHierarchicalContainerDescriptor.java | 2 +- .../support/hierarchical/DemoHierarchicalEngineDescriptor.java | 2 +- .../support/hierarchical/DemoHierarchicalTestDescriptor.java | 2 +- .../engine/support/hierarchical/DemoHierarchicalTestEngine.java | 2 +- .../java/org/junit/platform/fakes/TestDescriptorStub.java | 2 +- .../java/org/junit/platform/fakes/TestEngineSpy.java | 2 +- .../java/org/junit/platform/fakes/TestEngineStub.java | 2 +- .../junit/platform/jfr/FlightRecordingDiscoveryListener.java | 2 +- .../junit/platform/jfr/FlightRecordingExecutionListener.java | 2 +- .../src/main/java/org/junit/platform/jfr/UniqueId.java | 2 +- .../java/org/junit/platform/launcher/AbstractMethodFilter.java | 2 +- .../java/org/junit/platform/launcher/EngineDiscoveryResult.java | 2 +- .../src/main/java/org/junit/platform/launcher/EngineFilter.java | 2 +- .../java/org/junit/platform/launcher/ExcludeMethodFilter.java | 2 +- .../java/org/junit/platform/launcher/IncludeMethodFilter.java | 2 +- .../src/main/java/org/junit/platform/launcher/Launcher.java | 2 +- .../java/org/junit/platform/launcher/LauncherConstants.java | 2 +- .../org/junit/platform/launcher/LauncherDiscoveryListener.java | 2 +- .../org/junit/platform/launcher/LauncherDiscoveryRequest.java | 2 +- .../java/org/junit/platform/launcher/LauncherInterceptor.java | 2 +- .../main/java/org/junit/platform/launcher/LauncherSession.java | 2 +- .../org/junit/platform/launcher/LauncherSessionListener.java | 2 +- .../src/main/java/org/junit/platform/launcher/MethodFilter.java | 2 +- .../java/org/junit/platform/launcher/PostDiscoveryFilter.java | 2 +- .../src/main/java/org/junit/platform/launcher/TagFilter.java | 2 +- .../java/org/junit/platform/launcher/TestExecutionListener.java | 2 +- .../main/java/org/junit/platform/launcher/TestIdentifier.java | 2 +- .../src/main/java/org/junit/platform/launcher/TestPlan.java | 2 +- .../launcher/core/CompositeEngineExecutionListener.java | 2 +- .../platform/launcher/core/CompositeTestExecutionListener.java | 2 +- .../junit/platform/launcher/core/DefaultDiscoveryRequest.java | 2 +- .../java/org/junit/platform/launcher/core/DefaultLauncher.java | 2 +- .../org/junit/platform/launcher/core/DefaultLauncherConfig.java | 2 +- .../junit/platform/launcher/core/DefaultLauncherSession.java | 2 +- .../launcher/core/DelegatingEngineExecutionListener.java | 2 +- .../org/junit/platform/launcher/core/DelegatingLauncher.java | 2 +- .../platform/launcher/core/EngineDiscoveryErrorDescriptor.java | 2 +- .../platform/launcher/core/EngineDiscoveryOrchestrator.java | 2 +- .../platform/launcher/core/EngineDiscoveryResultValidator.java | 2 +- .../platform/launcher/core/EngineExecutionOrchestrator.java | 2 +- .../java/org/junit/platform/launcher/core/EngineFilterer.java | 2 +- .../org/junit/platform/launcher/core/EngineIdValidator.java | 2 +- .../junit/platform/launcher/core/ExecutionListenerAdapter.java | 2 +- .../launcher/core/HierarchicalOutputDirectoryProvider.java | 2 +- .../org/junit/platform/launcher/core/InterceptingLauncher.java | 2 +- .../java/org/junit/platform/launcher/core/InternalTestPlan.java | 2 +- .../java/org/junit/platform/launcher/core/IterationOrder.java | 2 +- .../java/org/junit/platform/launcher/core/LauncherConfig.java | 2 +- .../platform/launcher/core/LauncherConfigurationParameters.java | 2 +- .../platform/launcher/core/LauncherDiscoveryRequestBuilder.java | 2 +- .../junit/platform/launcher/core/LauncherDiscoveryResult.java | 2 +- .../java/org/junit/platform/launcher/core/LauncherFactory.java | 2 +- .../junit/platform/launcher/core/LauncherListenerRegistry.java | 2 +- .../java/org/junit/platform/launcher/core/ListenerRegistry.java | 2 +- .../launcher/core/OutcomeDelayingEngineExecutionListener.java | 2 +- .../org/junit/platform/launcher/core/ServiceLoaderRegistry.java | 2 +- .../platform/launcher/core/ServiceLoaderTestEngineRegistry.java | 2 +- .../junit/platform/launcher/core/SessionPerRequestLauncher.java | 2 +- .../launcher/core/StackTracePruningEngineExecutionListener.java | 2 +- .../launcher/core/StreamInterceptingTestExecutionListener.java | 2 +- .../org/junit/platform/launcher/core/StreamInterceptor.java | 2 +- .../org/junit/platform/launcher/core/TestEngineFormatter.java | 2 +- .../junit/platform/launcher/listeners/LegacyReportingUtils.java | 2 +- .../org/junit/platform/launcher/listeners/LoggingListener.java | 2 +- .../launcher/listeners/MutableTestExecutionSummary.java | 2 +- .../java/org/junit/platform/launcher/listeners/OutputDir.java | 2 +- .../platform/launcher/listeners/SummaryGeneratingListener.java | 2 +- .../junit/platform/launcher/listeners/TestExecutionSummary.java | 2 +- .../platform/launcher/listeners/UniqueIdTrackingListener.java | 2 +- .../discovery/AbortOnFailureLauncherDiscoveryListener.java | 2 +- .../listeners/discovery/CompositeLauncherDiscoveryListener.java | 2 +- .../listeners/discovery/LauncherDiscoveryListeners.java | 2 +- .../listeners/discovery/LoggingLauncherDiscoveryListener.java | 2 +- .../listeners/session/CompositeLauncherSessionListener.java | 2 +- .../launcher/listeners/session/LauncherSessionListeners.java | 2 +- .../org/junit/platform/launcher/tagexpression/DequeStack.java | 2 +- .../org/junit/platform/launcher/tagexpression/Operator.java | 2 +- .../org/junit/platform/launcher/tagexpression/Operators.java | 2 +- .../org/junit/platform/launcher/tagexpression/ParseResult.java | 2 +- .../org/junit/platform/launcher/tagexpression/ParseResults.java | 2 +- .../org/junit/platform/launcher/tagexpression/ParseStatus.java | 2 +- .../java/org/junit/platform/launcher/tagexpression/Parser.java | 2 +- .../org/junit/platform/launcher/tagexpression/ShuntingYard.java | 2 +- .../java/org/junit/platform/launcher/tagexpression/Stack.java | 2 +- .../junit/platform/launcher/tagexpression/TagExpression.java | 2 +- .../junit/platform/launcher/tagexpression/TagExpressions.java | 2 +- .../java/org/junit/platform/launcher/tagexpression/Token.java | 2 +- .../org/junit/platform/launcher/tagexpression/TokenWith.java | 2 +- .../org/junit/platform/launcher/tagexpression/Tokenizer.java | 2 +- .../launcher/core/ConfigurationParametersFactoryForTests.java | 2 +- .../launcher/core/LauncherFactoryForTestingPurposesOnly.java | 2 +- .../junit/platform/launcher/core/OutputDirectoryProviders.java | 2 +- .../junit/platform/reporting/legacy/LegacyReportingUtils.java | 2 +- .../reporting/legacy/xml/LegacyXmlReportGeneratingListener.java | 2 +- .../org/junit/platform/reporting/legacy/xml/XmlReportData.java | 2 +- .../junit/platform/reporting/legacy/xml/XmlReportWriter.java | 2 +- .../org/junit/platform/reporting/open/xml/JUnitContributor.java | 2 +- .../org/junit/platform/reporting/open/xml/JUnitFactory.java | 2 +- .../junit/platform/reporting/open/xml/LegacyReportingName.java | 2 +- .../reporting/open/xml/OpenTestReportGeneratingListener.java | 2 +- .../main/java/org/junit/platform/reporting/open/xml/Type.java | 2 +- .../java/org/junit/platform/reporting/open/xml/UniqueId.java | 2 +- .../xml/OpenTestReportGenerationSystemPropertyOverride.java | 2 +- .../java/org/junit/platform/reporting/testutil/FileUtils.java | 2 +- .../src/main/java/org/junit/platform/runner/JUnitPlatform.java | 2 +- .../org/junit/platform/runner/JUnitPlatformRunnerListener.java | 2 +- .../java/org/junit/platform/runner/JUnitPlatformTestTree.java | 2 +- .../src/main/java/org/junit/platform/suite/api/AfterSuite.java | 2 +- .../src/main/java/org/junit/platform/suite/api/BeforeSuite.java | 2 +- .../org/junit/platform/suite/api/ConfigurationParameter.java | 2 +- .../org/junit/platform/suite/api/ConfigurationParameters.java | 2 +- .../platform/suite/api/ConfigurationParametersResource.java | 2 +- .../platform/suite/api/ConfigurationParametersResources.java | 2 +- .../suite/api/DisableParentConfigurationParameters.java | 2 +- .../org/junit/platform/suite/api/ExcludeClassNamePatterns.java | 2 +- .../main/java/org/junit/platform/suite/api/ExcludeEngines.java | 2 +- .../main/java/org/junit/platform/suite/api/ExcludePackages.java | 2 +- .../src/main/java/org/junit/platform/suite/api/ExcludeTags.java | 2 +- .../org/junit/platform/suite/api/IncludeClassNamePatterns.java | 2 +- .../main/java/org/junit/platform/suite/api/IncludeEngines.java | 2 +- .../main/java/org/junit/platform/suite/api/IncludePackages.java | 2 +- .../src/main/java/org/junit/platform/suite/api/IncludeTags.java | 2 +- .../src/main/java/org/junit/platform/suite/api/Select.java | 2 +- .../main/java/org/junit/platform/suite/api/SelectClasses.java | 2 +- .../org/junit/platform/suite/api/SelectClasspathResource.java | 2 +- .../org/junit/platform/suite/api/SelectClasspathResources.java | 2 +- .../java/org/junit/platform/suite/api/SelectDirectories.java | 2 +- .../src/main/java/org/junit/platform/suite/api/SelectFile.java | 2 +- .../src/main/java/org/junit/platform/suite/api/SelectFiles.java | 2 +- .../main/java/org/junit/platform/suite/api/SelectMethod.java | 2 +- .../main/java/org/junit/platform/suite/api/SelectMethods.java | 2 +- .../main/java/org/junit/platform/suite/api/SelectModules.java | 2 +- .../main/java/org/junit/platform/suite/api/SelectPackages.java | 2 +- .../src/main/java/org/junit/platform/suite/api/SelectUris.java | 2 +- .../src/main/java/org/junit/platform/suite/api/Selects.java | 2 +- .../src/main/java/org/junit/platform/suite/api/Suite.java | 2 +- .../java/org/junit/platform/suite/api/SuiteDisplayName.java | 2 +- .../java/org/junit/platform/suite/api/UseTechnicalNames.java | 2 +- .../platform/suite/commons/AdditionalDiscoverySelectors.java | 2 +- .../suite/commons/SuiteLauncherDiscoveryRequestBuilder.java | 2 +- .../org/junit/platform/suite/engine/ClassSelectorResolver.java | 2 +- .../junit/platform/suite/engine/DiscoverySelectorResolver.java | 2 +- .../junit/platform/suite/engine/IsPotentialTestContainer.java | 2 +- .../main/java/org/junit/platform/suite/engine/IsSuiteClass.java | 2 +- .../org/junit/platform/suite/engine/LifecycleMethodUtils.java | 2 +- .../junit/platform/suite/engine/NoTestsDiscoveredException.java | 2 +- .../org/junit/platform/suite/engine/SuiteEngineDescriptor.java | 2 +- .../java/org/junit/platform/suite/engine/SuiteLauncher.java | 2 +- .../org/junit/platform/suite/engine/SuiteTestDescriptor.java | 2 +- .../java/org/junit/platform/suite/engine/SuiteTestEngine.java | 2 +- .../main/java/org/junit/platform/testkit/engine/Assertions.java | 2 +- .../junit/platform/testkit/engine/EngineExecutionResults.java | 2 +- .../java/org/junit/platform/testkit/engine/EngineTestKit.java | 2 +- .../src/main/java/org/junit/platform/testkit/engine/Event.java | 2 +- .../java/org/junit/platform/testkit/engine/EventConditions.java | 2 +- .../java/org/junit/platform/testkit/engine/EventStatistics.java | 2 +- .../main/java/org/junit/platform/testkit/engine/EventType.java | 2 +- .../src/main/java/org/junit/platform/testkit/engine/Events.java | 2 +- .../main/java/org/junit/platform/testkit/engine/Execution.java | 2 +- .../org/junit/platform/testkit/engine/ExecutionRecorder.java | 2 +- .../main/java/org/junit/platform/testkit/engine/Executions.java | 2 +- .../java/org/junit/platform/testkit/engine/TerminationInfo.java | 2 +- .../platform/testkit/engine/TestExecutionResultConditions.java | 2 +- .../main/java/org/junit/vintage/engine/JUnit4VersionCheck.java | 2 +- .../main/java/org/junit/vintage/engine/VintageTestEngine.java | 2 +- .../org/junit/vintage/engine/descriptor/DescriptionUtils.java | 2 +- .../main/java/org/junit/vintage/engine/descriptor/OrFilter.java | 2 +- .../org/junit/vintage/engine/descriptor/RunnerDecorator.java | 2 +- .../java/org/junit/vintage/engine/descriptor/RunnerRequest.java | 2 +- .../junit/vintage/engine/descriptor/RunnerTestDescriptor.java | 2 +- .../org/junit/vintage/engine/descriptor/TestSourceProvider.java | 2 +- .../vintage/engine/descriptor/VintageEngineDescriptor.java | 2 +- .../junit/vintage/engine/descriptor/VintageTestDescriptor.java | 2 +- .../junit/vintage/engine/discovery/ClassSelectorResolver.java | 2 +- .../discovery/DefensiveAllDefaultPossibilitiesBuilder.java | 2 +- .../engine/discovery/FilterableIgnoringRunnerDecorator.java | 2 +- .../junit/vintage/engine/discovery/IgnoringRunnerDecorator.java | 2 +- .../vintage/engine/discovery/IsPotentialJUnit4TestClass.java | 2 +- .../vintage/engine/discovery/IsPotentialJUnit4TestMethod.java | 2 +- .../junit/vintage/engine/discovery/MethodSelectorResolver.java | 2 +- .../engine/discovery/RunnerTestDescriptorPostProcessor.java | 2 +- .../java/org/junit/vintage/engine/discovery/UniqueIdFilter.java | 2 +- .../org/junit/vintage/engine/discovery/VintageDiscoverer.java | 2 +- .../main/java/org/junit/vintage/engine/execution/EventType.java | 2 +- .../org/junit/vintage/engine/execution/RunListenerAdapter.java | 2 +- .../java/org/junit/vintage/engine/execution/RunnerExecutor.java | 2 +- .../main/java/org/junit/vintage/engine/execution/TestRun.java | 2 +- .../java/org/junit/vintage/engine/support/UniqueIdReader.java | 2 +- .../org/junit/vintage/engine/support/UniqueIdStringifier.java | 2 +- .../java/org/junit/vintage/engine/JUnit4ParameterizedTests.java | 2 +- .../java/org/junit/vintage/engine/JUnit4VersionCheckTests.java | 2 +- .../junit/vintage/engine/VintageLauncherIntegrationTests.java | 2 +- .../org/junit/vintage/engine/VintageTestEngineBasicTests.java | 2 +- .../junit/vintage/engine/VintageTestEngineDiscoveryTests.java | 2 +- .../junit/vintage/engine/VintageTestEngineExecutionTests.java | 2 +- .../org/junit/vintage/engine/VintageTestEngineTestSuite.java | 2 +- .../java/org/junit/vintage/engine/VintageUniqueIdBuilder.java | 2 +- .../junit/vintage/engine/descriptor/DescriptionUtilsTests.java | 2 +- .../java/org/junit/vintage/engine/descriptor/OrFilterTests.java | 2 +- .../vintage/engine/descriptor/TestSourceProviderTests.java | 2 +- .../vintage/engine/descriptor/VintageTestDescriptorTests.java | 2 +- .../engine/discovery/IsPotentialJUnit4TestClassTests.java | 2 +- .../discovery/RunnerTestDescriptorPostProcessorTests.java | 2 +- .../junit/vintage/engine/discovery/VintageDiscovererTests.java | 2 +- .../java/org/junit/vintage/engine/execution/TestRunTests.java | 2 +- .../org/junit/vintage/engine/support/UniqueIdReaderTests.java | 2 +- .../junit/vintage/engine/support/UniqueIdStringifierTests.java | 2 +- .../samples/PlainOldJavaClassWithoutAnyTestsTestCase.java | 2 +- .../vintage/engine/samples/junit3/AbstractJUnit3TestCase.java | 2 +- .../vintage/engine/samples/junit3/IgnoredJUnit3TestCase.java | 2 +- .../engine/samples/junit3/JUnit3ParallelSuiteWithSubsuites.java | 2 +- .../JUnit3SuiteWithSingleTestCaseWithSingleTestWhichFails.java | 2 +- .../vintage/engine/samples/junit3/JUnit3SuiteWithSubsuites.java | 2 +- .../samples/junit3/JUnit4SuiteWithIgnoredJUnit3TestCase.java | 2 +- .../junit3/PlainJUnit3TestCaseWithSingleTestWhichFails.java | 2 +- .../vintage/engine/samples/junit4/AbstractJUnit4TestCase.java | 2 +- .../junit4/AbstractJunit4TestCaseWithConstructorParameter.java | 2 +- .../org/junit/vintage/engine/samples/junit4/Categories.java | 2 +- .../engine/samples/junit4/CompletelyDynamicTestCase.java | 2 +- .../vintage/engine/samples/junit4/ConcreteJUnit4TestCase.java | 2 +- .../junit/vintage/engine/samples/junit4/ConfigurableRunner.java | 2 +- .../org/junit/vintage/engine/samples/junit4/DynamicRunner.java | 2 +- .../vintage/engine/samples/junit4/EmptyIgnoredTestCase.java | 2 +- .../vintage/engine/samples/junit4/EnclosedJUnit4TestCase.java | 2 +- .../junit4/EnclosedWithParameterizedChildrenJUnit4TestCase.java | 2 +- .../vintage/engine/samples/junit4/ExceptionThrowingRunner.java | 2 +- .../vintage/engine/samples/junit4/IgnoredJUnit4TestCase.java | 2 +- .../junit4/IgnoredJUnit4TestCaseWithNotFilterableRunner.java | 2 +- .../engine/samples/junit4/IgnoredParameterizedTestCase.java | 2 +- .../engine/samples/junit4/JUnit4ParameterizedTestCase.java | 2 +- .../junit4/JUnit4SuiteOfSuiteWithFilterableChildRunner.java | 2 +- .../junit4/JUnit4SuiteOfSuiteWithIgnoredJUnit4TestCase.java | 2 +- ...iteWithJUnit4TestCaseWithAssumptionFailureInBeforeClass.java | 2 +- ...it4SuiteOfSuiteWithJUnit4TestCaseWithErrorInBeforeClass.java | 2 +- .../samples/junit4/JUnit4SuiteWithExceptionThrowingRunner.java | 2 +- .../samples/junit4/JUnit4SuiteWithIgnoredJUnit4TestCase.java | 2 +- .../junit4/JUnit4SuiteWithJUnit3SuiteWithSingleTestCase.java | 2 +- ...iteWithJUnit4TestCaseWithAssumptionFailureInBeforeClass.java | 2 +- .../JUnit4SuiteWithJUnit4TestCaseWithErrorInBeforeClass.java | 2 +- ...stCaseWithFailingDescriptionThatIsNotReportedAsFinished.java | 2 +- ...it4TestCaseWithRunnerWithCustomUniqueIdsAndDisplayNames.java | 2 +- ...uiteWithPlainJUnit4TestCaseWithSingleTestWhichIsIgnored.java | 2 +- .../engine/samples/junit4/JUnit4SuiteWithTwoTestCases.java | 2 +- .../JUnit4TestCaseWithAssumptionFailureInBeforeClass.java | 2 +- .../JUnit4TestCaseWithDistinguishableOverloadedMethod.java | 2 +- ...JUnit4TestCaseWithErrorCollectorStoringMultipleFailures.java | 2 +- .../samples/junit4/JUnit4TestCaseWithErrorInAfterClass.java | 2 +- .../samples/junit4/JUnit4TestCaseWithErrorInBeforeClass.java | 2 +- .../junit4/JUnit4TestCaseWithExceptionThrowingRunner.java | 2 +- ...stCaseWithFailingDescriptionThatIsNotReportedAsFinished.java | 2 +- .../JUnit4TestCaseWithIndistinguishableOverloadedMethod.java | 2 +- .../samples/junit4/JUnit4TestCaseWithNotFilterableRunner.java | 2 +- ...it4TestCaseWithRunnerWithCustomUniqueIdsAndDisplayNames.java | 2 +- ...estCaseWithRunnerWithDuplicateChangingChildDescriptions.java | 2 +- .../vintage/engine/samples/junit4/MalformedJUnit4TestCase.java | 2 +- .../vintage/engine/samples/junit4/NotFilterableRunner.java | 2 +- .../vintage/engine/samples/junit4/ParameterizedTestCase.java | 2 +- .../engine/samples/junit4/ParameterizedTimingTestCase.java | 2 +- .../junit4/ParameterizedWithAfterParamFailureTestCase.java | 2 +- .../junit4/ParameterizedWithBeforeParamFailureTestCase.java | 2 +- .../samples/junit4/PlainJUnit4TestCaseWithFiveTestMethods.java | 2 +- .../samples/junit4/PlainJUnit4TestCaseWithLifecycleMethods.java | 2 +- .../PlainJUnit4TestCaseWithSingleInheritedTestWhichFails.java | 2 +- .../junit4/PlainJUnit4TestCaseWithSingleTestWhichFails.java | 2 +- .../junit4/PlainJUnit4TestCaseWithSingleTestWhichIsIgnored.java | 2 +- .../samples/junit4/PlainJUnit4TestCaseWithTwoTestMethods.java | 2 +- .../engine/samples/junit4/RunnerThatOnlyReportsFailures.java | 2 +- .../junit4/RunnerWithCustomUniqueIdsAndDisplayNames.java | 2 +- .../engine/samples/junit4/SingleFailingTheoryTestCase.java | 2 +- .../samples/junit4/TestCaseRunWithJUnitPlatformRunner.java | 2 +- jupiter-tests/src/test/java/DefaultPackageTestCase.java | 2 +- jupiter-tests/src/test/java/example/B_TestCase.java | 2 +- .../src/test/java/org/junit/jupiter/JupiterTestSuite.java | 2 +- .../java/org/junit/jupiter/api/AssertAllAssertionsTests.java | 2 +- .../org/junit/jupiter/api/AssertArrayEqualsAssertionsTests.java | 2 +- .../junit/jupiter/api/AssertDoesNotThrowAssertionsTests.java | 2 +- .../java/org/junit/jupiter/api/AssertEqualsAssertionsTests.java | 2 +- .../java/org/junit/jupiter/api/AssertFalseAssertionsTests.java | 2 +- .../org/junit/jupiter/api/AssertInstanceOfAssertionsTests.java | 2 +- .../junit/jupiter/api/AssertIterableEqualsAssertionsTests.java | 2 +- .../org/junit/jupiter/api/AssertLinesMatchAssertionsTests.java | 2 +- .../org/junit/jupiter/api/AssertNotEqualsAssertionsTests.java | 2 +- .../org/junit/jupiter/api/AssertNotNullAssertionsTests.java | 2 +- .../org/junit/jupiter/api/AssertNotSameAssertionsTests.java | 2 +- .../java/org/junit/jupiter/api/AssertNullAssertionsTests.java | 2 +- .../java/org/junit/jupiter/api/AssertSameAssertionsTests.java | 2 +- .../java/org/junit/jupiter/api/AssertThrowsAssertionsTests.java | 2 +- .../junit/jupiter/api/AssertThrowsExactlyAssertionsTests.java | 2 +- .../org/junit/jupiter/api/AssertTimeoutAssertionsTests.java | 2 +- .../jupiter/api/AssertTimeoutPreemptivelyAssertionsTests.java | 2 +- .../java/org/junit/jupiter/api/AssertTrueAssertionsTests.java | 2 +- .../src/test/java/org/junit/jupiter/api/AssertionTestUtils.java | 2 +- .../src/test/java/org/junit/jupiter/api/AssumptionsTests.java | 2 +- .../jupiter/api/DisplayNameGenerationInheritanceTestCase.java | 2 +- .../java/org/junit/jupiter/api/DisplayNameGenerationTests.java | 2 +- .../src/test/java/org/junit/jupiter/api/DynamicTestTests.java | 2 +- .../src/test/java/org/junit/jupiter/api/EnigmaThrowable.java | 2 +- .../test/java/org/junit/jupiter/api/FailAssertionsTests.java | 2 +- .../api/IndicativeSentencesGenerationInheritanceTestCase.java | 2 +- .../junit/jupiter/api/IndicativeSentencesNestedTestCase.java | 2 +- .../junit/jupiter/api/IndicativeSentencesTopLevelTestCase.java | 2 +- .../src/test/java/org/junit/jupiter/api/IterableFactory.java | 2 +- .../test/java/org/junit/jupiter/api/RandomlyOrderedTests.java | 2 +- .../jupiter/api/condition/AbstractExecutionConditionTests.java | 2 +- .../api/condition/DisabledForJreRangeConditionTests.java | 2 +- .../api/condition/DisabledForJreRangeIntegrationTests.java | 2 +- .../api/condition/DisabledIfConditionClassLoaderTests.java | 2 +- .../junit/jupiter/api/condition/DisabledIfConditionTests.java | 2 +- .../condition/DisabledIfEnvironmentVariableConditionTests.java | 2 +- .../DisabledIfEnvironmentVariableIntegrationTests.java | 2 +- .../junit/jupiter/api/condition/DisabledIfIntegrationTests.java | 2 +- .../api/condition/DisabledIfSystemPropertyConditionTests.java | 2 +- .../api/condition/DisabledIfSystemPropertyIntegrationTests.java | 2 +- .../junit/jupiter/api/condition/DisabledOnOsConditionTests.java | 2 +- .../jupiter/api/condition/DisabledOnOsIntegrationTests.java | 2 +- .../jupiter/api/condition/EnabledForJreRangeConditionTests.java | 2 +- .../api/condition/EnabledForJreRangeIntegrationTests.java | 2 +- .../api/condition/EnabledIfConditionClassLoaderTests.java | 2 +- .../junit/jupiter/api/condition/EnabledIfConditionTests.java | 2 +- .../condition/EnabledIfEnvironmentVariableConditionTests.java | 2 +- .../condition/EnabledIfEnvironmentVariableIntegrationTests.java | 2 +- .../junit/jupiter/api/condition/EnabledIfIntegrationTests.java | 2 +- .../api/condition/EnabledIfSystemPropertyConditionTests.java | 2 +- .../api/condition/EnabledIfSystemPropertyIntegrationTests.java | 2 +- .../junit/jupiter/api/condition/EnabledOnOsConditionTests.java | 2 +- .../jupiter/api/condition/EnabledOnOsIntegrationTests.java | 2 +- .../src/test/java/org/junit/jupiter/api/condition/JRETests.java | 2 +- .../org/junit/jupiter/api/condition/StaticConditionMethods.java | 2 +- .../api/extension/CloseableResourceIntegrationTests.java | 2 +- .../api/extension/ExecutableInvokerIntegrationTests.java | 2 +- .../jupiter/api/extension/ExtensionComposabilityTests.java | 2 +- .../org/junit/jupiter/api/extension/KitchenSinkExtension.java | 2 +- .../java/org/junit/jupiter/api/extension/MediaTypeTests.java | 2 +- .../api/extension/support/TypeBasedParameterResolverTests.java | 2 +- .../src/test/java/org/junit/jupiter/api/parallel/LockTests.java | 2 +- .../junit/jupiter/api/parallel/ResourceLockAnnotationTests.java | 2 +- .../junit/jupiter/api/parallel/ResourceLocksProviderTests.java | 2 +- .../junit/jupiter/api/subpackage/SubclassedAssertionsTests.java | 2 +- .../jupiter/api/subpackage/SubclassedAssumptionsTests.java | 2 +- .../junit/jupiter/engine/AbstractJupiterTestEngineTests.java | 2 +- .../org/junit/jupiter/engine/AtypicalJvmMethodNameTests.java | 2 +- .../engine/BeforeAllAndAfterAllComposedAnnotationTests.java | 2 +- .../engine/BeforeEachAndAfterEachComposedAnnotationTests.java | 2 +- .../org/junit/jupiter/engine/DefaultExecutionModeTests.java | 2 +- .../test/java/org/junit/jupiter/engine/DefaultMethodTests.java | 2 +- .../src/test/java/org/junit/jupiter/engine/DisabledTests.java | 2 +- .../org/junit/jupiter/engine/DynamicNodeGenerationTests.java | 2 +- .../java/org/junit/jupiter/engine/ExceptionHandlingTests.java | 2 +- .../java/org/junit/jupiter/engine/FailedAssumptionsTests.java | 2 +- .../engine/InvalidLifecycleMethodConfigurationTests.java | 2 +- .../org/junit/jupiter/engine/JupiterTestEngineBasicTests.java | 2 +- .../junit/jupiter/engine/LifecycleMethodOverridingTests.java | 2 +- .../junit/jupiter/engine/MultipleTestableAnnotationsTests.java | 2 +- .../java/org/junit/jupiter/engine/NestedTestClassesTests.java | 2 +- .../org/junit/jupiter/engine/NestedWithInheritanceTests.java | 2 +- .../jupiter/engine/NestedWithSeparateInheritanceTests.java | 2 +- .../jupiter/engine/NonVoidTestableMethodIntegrationTests.java | 2 +- .../org/junit/jupiter/engine/OverloadedTestMethodTests.java | 2 +- .../src/test/java/org/junit/jupiter/engine/RecordTests.java | 2 +- .../src/test/java/org/junit/jupiter/engine/ReportingTests.java | 2 +- .../test/java/org/junit/jupiter/engine/SealedClassTests.java | 2 +- .../java/org/junit/jupiter/engine/StandardTestClassTests.java | 2 +- .../engine/StaticNestedBeforeAllAndAfterAllMethodsTests.java | 2 +- .../org/junit/jupiter/engine/TestClassInheritanceTests.java | 2 +- .../jupiter/engine/TestInstanceLifecycleConfigurationTests.java | 2 +- .../junit/jupiter/engine/TestInstanceLifecycleKotlinTests.java | 2 +- .../org/junit/jupiter/engine/TestInstanceLifecycleTests.java | 2 +- .../org/junit/jupiter/engine/TestTemplateInvocationTests.java | 2 +- .../junit/jupiter/engine/bridge/AbstractNonGenericTests.java | 2 +- .../org/junit/jupiter/engine/bridge/AbstractNumberTests.java | 2 +- .../java/org/junit/jupiter/engine/bridge/BridgeMethodTests.java | 2 +- .../org/junit/jupiter/engine/bridge/ChildWithBridgeMethods.java | 2 +- .../junit/jupiter/engine/bridge/ChildWithoutBridgeMethods.java | 2 +- .../java/org/junit/jupiter/engine/bridge/NumberResolver.java | 2 +- .../java/org/junit/jupiter/engine/bridge/NumberTestGroup.java | 2 +- .../org/junit/jupiter/engine/bridge/PackagePrivateParent.java | 2 +- .../jupiter/engine/config/CachingJupiterConfigurationTests.java | 2 +- .../jupiter/engine/config/DefaultJupiterConfigurationTests.java | 2 +- .../InstantiatingConfigurationParameterConverterTests.java | 2 +- .../jupiter/engine/descriptor/CustomDisplayNameGenerator.java | 2 +- .../junit/jupiter/engine/descriptor/DisplayNameUtilsTests.java | 2 +- .../junit/jupiter/engine/descriptor/ExtensionContextTests.java | 2 +- .../junit/jupiter/engine/descriptor/ExtensionsUtilsTests.java | 2 +- .../jupiter/engine/descriptor/JupiterTestDescriptorTests.java | 2 +- .../jupiter/engine/descriptor/LifecycleMethodUtilsTests.java | 2 +- .../org/junit/jupiter/engine/descriptor/NamespaceTests.java | 2 +- .../engine/descriptor/TestFactoryTestDescriptorTests.java | 2 +- .../engine/descriptor/TestInstanceLifecycleUtilsTests.java | 2 +- .../descriptor/TestTemplateInvocationTestDescriptorTests.java | 2 +- .../engine/descriptor/TestTemplateTestDescriptorTests.java | 2 +- .../engine/descriptor/subpackage/Class1WithTestCases.java | 2 +- .../engine/descriptor/subpackage/Class2WithTestCases.java | 2 +- .../descriptor/subpackage/ClassWithStaticInnerTestCases.java | 2 +- .../engine/descriptor/subpackage/ClassWithoutTestCases.java | 2 +- .../engine/discovery/DiscoverySelectorResolverTests.java | 2 +- .../java/org/junit/jupiter/engine/discovery/DiscoveryTests.java | 2 +- .../jupiter/engine/discovery/predicates/IsInnerClassTests.java | 2 +- .../engine/discovery/predicates/IsNestedTestClassTests.java | 2 +- .../discovery/predicates/IsPotentialTestContainerTests.java | 2 +- .../engine/discovery/predicates/IsTestClassWithTestsTests.java | 2 +- .../engine/discovery/predicates/IsTestFactoryMethodTests.java | 2 +- .../jupiter/engine/discovery/predicates/IsTestMethodTests.java | 2 +- .../engine/discovery/predicates/IsTestTemplateMethodTests.java | 2 +- .../engine/execution/AbstractExecutableInvokerTests.java | 2 +- .../jupiter/engine/execution/DefaultExecutableInvokerTests.java | 2 +- .../jupiter/engine/execution/DefaultTestInstancesTests.java | 2 +- .../jupiter/engine/execution/DynamicTestIntegrationTests.java | 2 +- .../engine/execution/ExtensionContextStoreConcurrencyTests.java | 2 +- .../jupiter/engine/execution/ExtensionContextStoreTests.java | 2 +- .../engine/execution/InterceptingExecutableInvokerTests.java | 2 +- .../engine/execution/JupiterEngineExecutionContextTests.java | 2 +- .../jupiter/engine/execution/ParameterResolutionUtilsTests.java | 2 +- .../UniqueIdParsingForArrayParameterIntegrationTests.java | 2 +- .../engine/execution/injection/sample/CustomAnnotation.java | 2 +- .../injection/sample/CustomAnnotationParameterResolver.java | 2 +- .../jupiter/engine/execution/injection/sample/CustomType.java | 2 +- .../execution/injection/sample/CustomTypeParameterResolver.java | 2 +- .../execution/injection/sample/DoubleParameterResolver.java | 2 +- .../execution/injection/sample/LongParameterResolver.java | 2 +- .../injection/sample/MapOfListsTypeBasedParameterResolver.java | 2 +- .../injection/sample/MapOfStringsParameterResolver.java | 2 +- .../injection/sample/NullIntegerParameterResolver.java | 2 +- .../execution/injection/sample/NumberParameterResolver.java | 2 +- .../injection/sample/PrimitiveArrayParameterResolver.java | 2 +- .../injection/sample/PrimitiveIntegerParameterResolver.java | 2 +- .../java/org/junit/jupiter/engine/extension/AutoCloseTests.java | 2 +- .../junit/jupiter/engine/extension/BeforeAndAfterAllTests.java | 2 +- .../junit/jupiter/engine/extension/BeforeAndAfterEachTests.java | 2 +- .../extension/BeforeAndAfterTestExecutionCallbackTests.java | 2 +- .../org/junit/jupiter/engine/extension/CloseablePathTests.java | 2 +- .../junit/jupiter/engine/extension/ConfigLoaderExtension.java | 2 +- .../jupiter/engine/extension/DefaultTestReporterTests.java | 2 +- .../org/junit/jupiter/engine/extension/EnigmaException.java | 2 +- .../engine/extension/EventuallyInterruptibleInvocation.java | 2 +- .../junit/jupiter/engine/extension/ExecutionConditionTests.java | 2 +- .../engine/extension/ExtensionContextExecutionTests.java | 2 +- .../ExtensionRegistrationViaParametersAndFieldsTests.java | 2 +- .../junit/jupiter/engine/extension/ExtensionRegistryTests.java | 2 +- .../jupiter/engine/extension/InvocationInterceptorTests.java | 2 +- .../LifecycleMethodExecutionExceptionHandlerTests.java | 2 +- .../org/junit/jupiter/engine/extension/OrderedClassTests.java | 2 +- .../org/junit/jupiter/engine/extension/OrderedMethodTests.java | 2 +- .../OrderedProgrammaticExtensionRegistrationTests.java | 2 +- .../junit/jupiter/engine/extension/ParameterResolverTests.java | 2 +- .../jupiter/engine/extension/PreInterruptCallbackTests.java | 2 +- .../extension/ProgrammaticExtensionRegistrationTests.java | 2 +- .../org/junit/jupiter/engine/extension/RepeatedTestTests.java | 2 +- .../engine/extension/SameThreadTimeoutInvocationTests.java | 2 +- .../engine/extension/SeparateThreadTimeoutInvocationTests.java | 2 +- .../junit/jupiter/engine/extension/ServiceLoaderExtension.java | 2 +- .../jupiter/engine/extension/TempDirectoryCleanupTests.java | 2 +- .../engine/extension/TempDirectoryMetaAnnotationTests.java | 2 +- .../jupiter/engine/extension/TempDirectoryPerContextTests.java | 2 +- .../engine/extension/TempDirectoryPerDeclarationTests.java | 2 +- .../engine/extension/TempDirectoryPreconditionTests.java | 2 +- .../engine/extension/TestExecutionExceptionHandlerTests.java | 2 +- .../engine/extension/TestInfoParameterResolverTests.java | 2 +- .../jupiter/engine/extension/TestInstanceFactoryTests.java | 2 +- .../TestInstancePostProcessorAndPreDestroyCallbackTests.java | 2 +- .../engine/extension/TestInstancePostProcessorTests.java | 2 +- .../engine/extension/TestInstancePreConstructCallbackTests.java | 2 +- .../engine/extension/TestInstancePreDestroyCallbackTests.java | 2 +- .../TestInstancePreDestroyCallbackUtilityMethodTests.java | 2 +- .../engine/extension/TestReporterParameterResolverTests.java | 2 +- .../org/junit/jupiter/engine/extension/TestWatcherTests.java | 2 +- .../jupiter/engine/extension/TimeoutConfigurationTests.java | 2 +- .../jupiter/engine/extension/TimeoutDurationParserTests.java | 2 +- .../junit/jupiter/engine/extension/TimeoutDurationTests.java | 2 +- .../jupiter/engine/extension/TimeoutExceptionFactoryTests.java | 2 +- .../junit/jupiter/engine/extension/TimeoutExtensionTests.java | 2 +- .../jupiter/engine/extension/TimeoutInvocationFactoryTests.java | 2 +- .../jupiter/engine/extension/sub/AlwaysDisabledCondition.java | 2 +- .../engine/extension/sub/AnotherAlwaysDisabledCondition.java | 2 +- .../jupiter/engine/extension/sub/SystemPropertyCondition.java | 2 +- ...PackagePrivateLifecycleMethodInDifferentPackageTestCase.java | 2 +- .../OpenTest4JAndJUnit4AwareThrowableCollectorTests.java | 2 +- .../migrationsupport/JupiterMigrationSupportTestSuite.java | 2 +- .../conditions/IgnoreAnnotationIntegrationTests.java | 2 +- .../migrationsupport/conditions/IgnoreConditionTests.java | 2 +- .../migrationsupport/rules/AbstractTestRuleAdapterTests.java | 2 +- .../rules/EnableRuleMigrationSupportWithBothRuleTypesTests.java | 2 +- .../migrationsupport/rules/ExpectedExceptionSupportTests.java | 2 +- ...esourceSupportForDifferentDeclaredReturnTypesRulesTests.java | 2 +- ...ExternalResourceSupportForMixedMethodAndFieldRulesTests.java | 2 +- .../ExternalResourceSupportForMultipleFieldRulesTests.java | 2 +- .../ExternalResourceSupportForMultipleMethodRulesTests.java | 2 +- .../ExternalResourceSupportForTemporaryFolderFieldTests.java | 2 +- .../rules/ExternalResourceSupportWithInheritanceTests.java | 2 +- .../rules/ExternalResourceWithoutAdapterTests.java | 2 +- .../jupiter/migrationsupport/rules/FailAfterAllHelper.java | 2 +- .../rules/LauncherBasedEnableRuleMigrationSupportTests.java | 2 +- .../rules/VerifierSupportForMixedMethodAndFieldRulesTests.java | 2 +- .../rules/WrongExtendWithForVerifierFieldTests.java | 2 +- .../rules/WrongExtendWithForVerifierMethodTests.java | 2 +- .../junit/jupiter/params/ParameterizedTestExtensionTests.java | 2 +- .../junit/jupiter/params/ParameterizedTestIntegrationTests.java | 2 +- .../jupiter/params/ParameterizedTestMethodContextTests.java | 2 +- .../jupiter/params/ParameterizedTestNameFormatterTests.java | 2 +- .../java/org/junit/jupiter/params/ParameterizedTestSuite.java | 2 +- .../jupiter/params/aggregator/AggregatorIntegrationTests.java | 2 +- .../params/aggregator/DefaultArgumentsAccessorTests.java | 2 +- .../jupiter/params/converter/DefaultArgumentConverterTests.java | 2 +- .../params/converter/JavaTimeArgumentConverterTests.java | 2 +- .../jupiter/params/converter/TypedArgumentConverterTests.java | 2 +- .../params/provider/AnnotationBasedArgumentsProviderTests.java | 2 +- .../java/org/junit/jupiter/params/provider/ArgumentsTests.java | 2 +- .../jupiter/params/provider/CsvArgumentsProviderTests.java | 2 +- .../jupiter/params/provider/CsvFileArgumentsProviderTests.java | 2 +- .../jupiter/params/provider/EnumArgumentsProviderTests.java | 2 +- .../java/org/junit/jupiter/params/provider/EnumSourceTests.java | 2 +- .../jupiter/params/provider/FieldArgumentsProviderTests.java | 2 +- .../jupiter/params/provider/MethodArgumentsProviderTests.java | 2 +- .../junit/jupiter/params/provider/MockCsvAnnotationBuilder.java | 2 +- .../jupiter/params/provider/ValueArgumentsProviderTests.java | 2 +- .../params/support/AnnotationConsumerInitializerTests.java | 2 +- .../org/junit/jupiter/api/KotlinAssertTimeoutAssertionsTests.kt | 2 +- .../test/kotlin/org/junit/jupiter/api/KotlinAssertionsTests.kt | 2 +- .../kotlin/org/junit/jupiter/api/KotlinFailAssertionsTests.kt | 2 +- .../jupiter/engine/kotlin/ArbitraryNamingKotlinTestCase.kt | 2 +- .../jupiter/engine/kotlin/InstancePerClassKotlinTestCase.kt | 2 +- .../jupiter/engine/kotlin/InstancePerMethodKotlinTestCase.kt | 2 +- .../params/ParameterizedTestNameFormatterIntegrationTests.kt | 2 +- .../jupiter/params/aggregator/ArgumentsAccessorKotlinTests.kt | 2 +- .../org/junit/jupiter/params/aggregator/DisplayNameTests.kt | 2 +- .../src/jmh/java/org/junit/jupiter/jmh/AssertionBenchmarks.java | 2 +- .../java/org/junit/platform/tests/process/OutputFiles.java | 2 +- .../java/org/junit/platform/tests/process/ProcessResult.java | 2 +- .../java/org/junit/platform/tests/process/ProcessStarter.java | 2 +- .../java/org/junit/platform/tests/process/WatchedOutput.java | 2 +- .../java/org/junit/platform/tests/process/WatchedProcess.java | 2 +- platform-tests/src/test/java/DefaultPackageTestCase.java | 2 +- .../src/test/java/org/junit/jupiter/api/condition/OSTests.java | 2 +- .../src/test/java/org/junit/jupiter/extensions/Heavyweight.java | 2 +- .../java/org/junit/jupiter/extensions/HeavyweightTests.java | 2 +- .../test/java/org/junit/platform/JUnitPlatformTestSuite.java | 2 +- .../test/java/org/junit/platform/StackTracePruningTests.java | 2 +- .../src/test/java/org/junit/platform/TestEngineTests.java | 2 +- .../platform/commons/annotation/TestableAnnotationTests.java | 2 +- .../test/java/org/junit/platform/commons/function/TryTests.java | 2 +- .../junit/platform/commons/support/AnnotationSupportTests.java | 2 +- .../org/junit/platform/commons/support/ClassSupportTests.java | 2 +- .../junit/platform/commons/support/ModifierSupportTests.java | 2 +- .../junit/platform/commons/support/PreconditionAssertions.java | 2 +- .../junit/platform/commons/support/ReflectionSupportTests.java | 2 +- .../conversion/FallbackStringToObjectConverterTests.java | 2 +- .../platform/commons/support/scanning/CloseablePathTests.java | 2 +- .../commons/support/scanning/DefaultClasspathScannerTests.java | 2 +- .../org/junit/platform/commons/util/AnnotationUtilsTests.java | 2 +- .../org/junit/platform/commons/util/ClassLoaderUtilsTests.java | 2 +- .../platform/commons/util/ClassNamePatternFilterUtilsTests.java | 2 +- .../java/org/junit/platform/commons/util/ClassUtilsTests.java | 2 +- .../org/junit/platform/commons/util/CollectionUtilsTests.java | 2 +- .../org/junit/platform/commons/util/ExceptionUtilsTests.java | 2 +- .../org/junit/platform/commons/util/FunctionUtilsTests.java | 2 +- .../java/org/junit/platform/commons/util/LruCacheTests.java | 2 +- .../java/org/junit/platform/commons/util/ModuleUtilsTests.java | 2 +- .../java/org/junit/platform/commons/util/PackageUtilsTests.java | 2 +- .../org/junit/platform/commons/util/PreconditionsTests.java | 2 +- .../org/junit/platform/commons/util/ReflectionUtilsTests.java | 2 +- .../util/ReflectionUtilsWithGenericTypeHierarchiesTests.java | 2 +- .../java/org/junit/platform/commons/util/RuntimeUtilsTests.java | 2 +- .../org/junit/platform/commons/util/SerializationUtils.java | 2 +- .../java/org/junit/platform/commons/util/StringUtilsTests.java | 2 +- .../org/junit/platform/commons/util/ToStringBuilderTests.java | 2 +- .../platform/commons/util/classes/AExecutionConditionClass.java | 2 +- .../commons/util/classes/ATestExecutionListenerClass.java | 2 +- .../org/junit/platform/commons/util/classes/AVanillaEmpty.java | 2 +- .../platform/commons/util/classes/BExecutionConditionClass.java | 2 +- .../commons/util/classes/BTestExecutionListenerClass.java | 2 +- .../org/junit/platform/commons/util/classes/BVanillaEmpty.java | 2 +- .../org/junit/platform/commons/util/classes/CustomType.java | 2 +- .../org/junit/platform/commons/util/pkg1/ClassLevelDir.java | 2 +- .../org/junit/platform/commons/util/pkg1/InstanceLevelDir.java | 2 +- .../pkg1/SuperclassWithStaticPackagePrivateBeforeMethod.java | 2 +- .../pkg1/SuperclassWithStaticPackagePrivateTempDirField.java | 2 +- .../subpkg/SubclassWithNonStaticPackagePrivateBeforeMethod.java | 2 +- .../subpkg/SubclassWithNonStaticPackagePrivateTempDirField.java | 2 +- .../java/org/junit/platform/console/ConsoleDetailsTests.java | 2 +- .../junit/platform/console/ConsoleLauncherIntegrationTests.java | 2 +- .../java/org/junit/platform/console/ConsoleLauncherTests.java | 2 +- .../java/org/junit/platform/console/ConsoleLauncherWrapper.java | 2 +- .../junit/platform/console/ConsoleLauncherWrapperResult.java | 2 +- .../console/options/CommandLineOptionsParsingTests.java | 2 +- .../org/junit/platform/console/options/ConsoleUtilsTests.java | 2 +- .../platform/console/options/ExecuteTestsCommandTests.java | 2 +- .../java/org/junit/platform/console/options/ThemeTests.java | 2 +- .../platform/console/subpackage/ContainerForInnerTest.java | 2 +- .../platform/console/subpackage/ContainerForInnerTests.java | 2 +- .../console/subpackage/ContainerForStaticNestedTest.java | 2 +- .../console/subpackage/ContainerForStaticNestedTests.java | 2 +- .../java/org/junit/platform/console/subpackage/SecondTest.java | 2 +- .../test/java/org/junit/platform/console/subpackage/Test.java | 2 +- .../test/java/org/junit/platform/console/subpackage/Test1.java | 2 +- .../test/java/org/junit/platform/console/subpackage/Tests.java | 2 +- .../java/org/junit/platform/console/subpackage/ThirdTests.java | 2 +- .../org/junit/platform/console/tasks/ColorPaletteTests.java | 2 +- .../junit/platform/console/tasks/ConsoleTestExecutorTests.java | 2 +- .../console/tasks/CustomContextClassLoaderExecutorTests.java | 2 +- .../platform/console/tasks/DiscoveryRequestCreatorTests.java | 2 +- .../junit/platform/console/tasks/FlatPrintingListenerTests.java | 2 +- .../platform/console/tasks/TestFeedPrintingListenerTests.java | 2 +- .../java/org/junit/platform/console/tasks/TreeNodeTests.java | 2 +- .../java/org/junit/platform/console/tasks/TreePrinterTests.java | 2 +- .../console/tasks/VerboseTreePrintingListenerTests.java | 2 +- .../java/org/junit/platform/engine/FilterCompositionTests.java | 2 +- .../java/org/junit/platform/engine/TestDescriptorTests.java | 2 +- .../src/test/java/org/junit/platform/engine/TestTagTests.java | 2 +- .../java/org/junit/platform/engine/UniqueIdFormatTests.java | 2 +- .../src/test/java/org/junit/platform/engine/UniqueIdTests.java | 2 +- .../junit/platform/engine/discovery/ClassNameFilterTests.java | 2 +- .../org/junit/platform/engine/discovery/ClassSelectorTests.java | 2 +- .../engine/discovery/ClasspathResourceSelectorTests.java | 2 +- .../platform/engine/discovery/ClasspathRootSelectorTests.java | 2 +- .../junit/platform/engine/discovery/DirectorySelectorTests.java | 2 +- .../platform/engine/discovery/DiscoverySelectorsTests.java | 2 +- .../org/junit/platform/engine/discovery/FilePositionTests.java | 2 +- .../org/junit/platform/engine/discovery/FileSelectorTests.java | 2 +- .../junit/platform/engine/discovery/IterationSelectorTests.java | 2 +- .../junit/platform/engine/discovery/MethodSelectorTests.java | 2 +- .../junit/platform/engine/discovery/ModuleSelectorTests.java | 2 +- .../platform/engine/discovery/NestedClassSelectorTests.java | 2 +- .../platform/engine/discovery/NestedMethodSelectorTests.java | 2 +- .../junit/platform/engine/discovery/PackageNameFilterTests.java | 2 +- .../junit/platform/engine/discovery/PackageSelectorTests.java | 2 +- .../junit/platform/engine/discovery/UniqueIdSelectorTests.java | 2 +- .../org/junit/platform/engine/discovery/UriSelectorTests.java | 2 +- .../support/config/PrefixedConfigurationParametersTests.java | 2 +- .../engine/support/descriptor/AbstractTestDescriptorTests.java | 2 +- .../engine/support/descriptor/AbstractTestSourceTests.java | 2 +- .../platform/engine/support/descriptor/ClassSourceTests.java | 2 +- .../engine/support/descriptor/ClasspathResourceSourceTests.java | 2 +- .../engine/support/descriptor/CompositeTestSourceTests.java | 2 +- .../engine/support/descriptor/DefaultUriSourceTests.java | 2 +- .../engine/support/descriptor/DemoClassTestDescriptor.java | 2 +- .../engine/support/descriptor/DemoMethodTestDescriptor.java | 2 +- .../platform/engine/support/descriptor/FilePositionTests.java | 2 +- .../engine/support/descriptor/FileSystemSourceTests.java | 2 +- .../platform/engine/support/descriptor/MethodSourceTests.java | 2 +- .../platform/engine/support/descriptor/PackageSourceTests.java | 2 +- .../discovery/ResourceContainerSelectorResolverTest.java | 2 +- .../engine/support/hierarchical/CompositeLockTests.java | 2 +- .../DefaultParallelExecutionConfigurationStrategyTests.java | 2 +- .../engine/support/hierarchical/ForkJoinDeadLockTests.java | 2 +- .../ForkJoinPoolHierarchicalTestExecutorServiceTests.java | 2 +- .../support/hierarchical/HierarchicalTestExecutorTests.java | 2 +- .../platform/engine/support/hierarchical/LockManagerTests.java | 2 +- .../platform/engine/support/hierarchical/MemoryLeakTests.java | 2 +- .../support/hierarchical/NodeTreeWalkerIntegrationTests.java | 2 +- .../support/hierarchical/ParallelExecutionIntegrationTests.java | 2 +- .../engine/support/hierarchical/ResourceLockSupport.java | 2 +- .../platform/engine/support/hierarchical/ResourceLockTests.java | 2 +- .../hierarchical/SameThreadExecutionIntegrationTests.java | 2 +- .../platform/engine/support/hierarchical/SingleLockTests.java | 2 +- .../engine/support/hierarchical/SingleTestExecutorTests.java | 2 +- .../engine/support/hierarchical/ThrowableCollectorTests.java | 2 +- .../engine/support/store/NamespacedHierarchicalStoreTests.java | 2 +- .../jfr/FlightRecordingDiscoveryListenerIntegrationTests.java | 2 +- .../jfr/FlightRecordingExecutionListenerIntegrationTests.java | 2 +- .../java/org/junit/platform/launcher/DiscoveryFilterStub.java | 2 +- .../src/test/java/org/junit/platform/launcher/FilterStub.java | 2 +- .../java/org/junit/platform/launcher/InterceptedTestEngine.java | 2 +- .../launcher/InterceptorInjectedLauncherSessionListener.java | 2 +- .../java/org/junit/platform/launcher/MethodFilterTests.java | 2 +- .../org/junit/platform/launcher/PostDiscoveryFilterStub.java | 2 +- .../test/java/org/junit/platform/launcher/TagFilterTests.java | 2 +- .../java/org/junit/platform/launcher/TagIntegrationTests.java | 2 +- .../java/org/junit/platform/launcher/TestIdentifierTests.java | 2 +- .../junit/platform/launcher/TestLauncherDiscoveryListener.java | 2 +- .../org/junit/platform/launcher/TestLauncherInterceptor1.java | 2 +- .../org/junit/platform/launcher/TestLauncherInterceptor2.java | 2 +- .../junit/platform/launcher/TestLauncherSessionListener.java | 2 +- .../test/java/org/junit/platform/launcher/TestPlanTests.java | 2 +- .../org/junit/platform/launcher/TestPostDiscoveryTagFilter.java | 2 +- .../launcher/core/CompositeEngineExecutionListenerTests.java | 2 +- .../launcher/core/CompositeTestExecutionListenerTests.java | 2 +- .../launcher/core/DefaultLauncherEngineFilterTests.java | 2 +- .../org/junit/platform/launcher/core/DefaultLauncherTests.java | 2 +- .../launcher/core/EngineDiscoveryResultValidatorTests.java | 2 +- .../platform/launcher/core/ExecutionListenerAdapterTests.java | 2 +- .../launcher/core/HierarchicalOutputDirectoryProviderTests.java | 2 +- .../org/junit/platform/launcher/core/LauncherConfigTests.java | 2 +- .../launcher/core/LauncherConfigurationParametersTests.java | 2 +- .../launcher/core/LauncherDiscoveryRequestBuilderTests.java | 2 +- .../org/junit/platform/launcher/core/LauncherFactoryTests.java | 2 +- .../org/junit/platform/launcher/core/LauncherSessionTests.java | 2 +- .../org/junit/platform/launcher/core/ListenerRegistryTests.java | 2 +- ...StreamInterceptingTestExecutionListenerIntegrationTests.java | 2 +- .../junit/platform/launcher/core/StreamInterceptorTests.java | 2 +- .../launcher/listeners/AnotherUnusedTestExecutionListener.java | 2 +- .../junit/platform/launcher/listeners/LoggingListenerTests.java | 2 +- .../platform/launcher/listeners/NoopTestExecutionListener.java | 2 +- .../org/junit/platform/launcher/listeners/OutputDirTests.java | 2 +- .../platform/launcher/listeners/SummaryGenerationTests.java | 2 +- .../listeners/UniqueIdTrackingListenerIntegrationTests.java | 2 +- .../launcher/listeners/UnusedTestExecutionListener.java | 2 +- .../discovery/AbortOnFailureLauncherDiscoveryListenerTests.java | 2 +- .../discovery/AbstractLauncherDiscoveryListenerTests.java | 2 +- .../discovery/CompositeLauncherDiscoveryListenerTests.java | 2 +- .../discovery/LoggingLauncherDiscoveryListenerTests.java | 2 +- .../session/CompositeLauncherSessionListenerTests.java | 2 +- .../junit/platform/launcher/tagexpression/ParserErrorTests.java | 2 +- .../org/junit/platform/launcher/tagexpression/ParserTests.java | 2 +- .../platform/launcher/tagexpression/TagExpressionsTests.java | 2 +- .../org/junit/platform/launcher/tagexpression/TokenTests.java | 2 +- .../junit/platform/launcher/tagexpression/TokenizerTests.java | 2 +- .../platform/reporting/legacy/LegacyReportingUtilsTests.java | 2 +- .../junit/platform/reporting/legacy/xml/IncrementingClock.java | 2 +- .../legacy/xml/LegacyXmlReportGeneratingListenerTests.java | 2 +- .../platform/reporting/legacy/xml/XmlReportAssertions.java | 2 +- .../junit/platform/reporting/legacy/xml/XmlReportDataTests.java | 2 +- .../platform/reporting/legacy/xml/XmlReportWriterTests.java | 2 +- .../platform/reporting/open/xml/JUnitContributorTests.java | 2 +- .../open/xml/OpenTestReportGeneratingListenerTests.java | 2 +- .../org/junit/platform/runner/JUnitPlatformRunnerTests.java | 2 +- .../commons/SuiteLauncherDiscoveryRequestBuilderTests.java | 2 +- .../junit/platform/suite/engine/BeforeAndAfterSuiteTests.java | 2 +- .../java/org/junit/platform/suite/engine/SuiteEngineTests.java | 2 +- .../junit/platform/suite/engine/SuiteTestDescriptorTests.java | 2 +- .../suite/engine/testcases/ConfigurationSensitiveTestCase.java | 2 +- .../platform/suite/engine/testcases/DynamicTestsTestCase.java | 2 +- .../suite/engine/testcases/EmptyDynamicTestsTestCase.java | 2 +- .../platform/suite/engine/testcases/EmptyTestTestCase.java | 2 +- .../platform/suite/engine/testcases/JUnit4TestsTestCase.java | 2 +- .../platform/suite/engine/testcases/MultipleTestsTestCase.java | 2 +- .../platform/suite/engine/testcases/SingleTestTestCase.java | 2 +- .../junit/platform/suite/engine/testcases/StatefulTestCase.java | 2 +- .../platform/suite/engine/testcases/TaggedTestTestCase.java | 2 +- .../junit/platform/suite/engine/testsuites/AbstractSuite.java | 2 +- .../platform/suite/engine/testsuites/ConfigurationSuite.java | 2 +- .../org/junit/platform/suite/engine/testsuites/CyclicSuite.java | 2 +- .../junit/platform/suite/engine/testsuites/DynamicSuite.java | 2 +- .../platform/suite/engine/testsuites/EmptyCyclicSuite.java | 2 +- .../platform/suite/engine/testsuites/EmptyDynamicTestSuite.java | 2 +- .../testsuites/EmptyDynamicTestWithFailIfNoTestFalseSuite.java | 2 +- .../platform/suite/engine/testsuites/EmptyTestCaseSuite.java | 2 +- .../testsuites/EmptyTestCaseWithFailIfNoTestFalseSuite.java | 2 +- .../suite/engine/testsuites/LifecycleMethodsSuites.java | 2 +- .../platform/suite/engine/testsuites/MultiEngineSuite.java | 2 +- .../junit/platform/suite/engine/testsuites/MultipleSuite.java | 2 +- .../org/junit/platform/suite/engine/testsuites/NestedSuite.java | 2 +- .../suite/engine/testsuites/SelectByIdentifierSuite.java | 2 +- .../platform/suite/engine/testsuites/SelectClassesSuite.java | 2 +- .../platform/suite/engine/testsuites/SelectMethodsSuite.java | 2 +- .../platform/suite/engine/testsuites/SuiteDisplayNameSuite.java | 2 +- .../org/junit/platform/suite/engine/testsuites/SuiteSuite.java | 2 +- .../platform/suite/engine/testsuites/ThreePartCyclicSuite.java | 2 +- .../org/junit/platform/testkit/engine/EngineTestKitTests.java | 2 +- .../java/org/junit/platform/testkit/engine/EventsTests.java | 2 +- .../platform/testkit/engine/ExecutionsIntegrationTests.java | 2 +- .../testkit/engine/NestedContainerEventConditionTests.java | 2 +- .../testkit/engine/TestExecutionResultConditionsTests.java | 2 +- .../src/main/java/com/example/project/Calculator.java | 2 +- .../src/test/java/com/example/project/CalculatorTests.java | 2 +- .../src/main/java/com/example/project/Calculator.java | 2 +- .../src/test/java/com/example/project/CalculatorTests.java | 2 +- .../java/com/example/project/ClassLevelAnnotationTests.java | 2 +- .../src/test/java/com/example/project/GraalvmSuite.java | 2 +- .../src/test/java/com/example/project/VintageTests.java | 2 +- .../test/kotlin/com/example/project/ExtensionFunctionsTests.kt | 2 +- .../projects/gradle-missing-engine/src/test/java/FooTests.java | 2 +- .../src/main/java/com/example/project/Calculator.java | 2 +- .../src/test/java/com/example/project/CalculatorTests.java | 2 +- .../java-versions/src/test/java/JUnitPlatformCommonsTests.java | 2 +- .../src/main/java/com/example/project/Calculator.java | 2 +- .../src/test/java/com/example/project/CalculatorTests.java | 2 +- .../src/test/java/com/example/project/DummyTests.java | 2 +- .../java/integration/integration/JupiterIntegrationTests.java | 2 +- .../src/test/java/integration/integration/ModuleUtilsTests.java | 2 +- .../reflection-tests/src/test/java/ReflectionTestCase.java | 2 +- .../projects/standalone/src/standalone/JupiterIntegration.java | 2 +- .../standalone/src/standalone/JupiterParamsIntegration.java | 2 +- .../projects/standalone/src/standalone/SuiteIntegration.java | 2 +- .../projects/standalone/src/standalone/VintageIntegration.java | 2 +- .../projects/vintage/src/test/java/DefaultPackageTest.java | 2 +- .../vintage/src/test/java/com/example/vintage/VintageTest.java | 2 +- .../src/main/java/platform/tooling/support/Helper.java | 2 +- .../src/main/java/platform/tooling/support/MavenRepo.java | 2 +- .../src/main/java/platform/tooling/support/ProcessStarters.java | 2 +- .../src/main/java/platform/tooling/support/ThirdPartyJars.java | 2 +- .../src/test/java/platform/tooling/support/HelperTests.java | 2 +- .../java/platform/tooling/support/tests/AntStarterTests.java | 2 +- .../test/java/platform/tooling/support/tests/ArchUnitTests.java | 2 +- .../test/java/platform/tooling/support/tests/FilePrefix.java | 2 +- .../java/platform/tooling/support/tests/GlobalResource.java | 2 +- .../platform/tooling/support/tests/GraalVmStarterTests.java | 2 +- .../tooling/support/tests/GradleKotlinExtensionsTests.java | 2 +- .../tooling/support/tests/GradleMissingEngineTests.java | 2 +- .../platform/tooling/support/tests/GradleModuleFileTests.java | 2 +- .../java/platform/tooling/support/tests/GradleStarterTests.java | 2 +- .../tooling/support/tests/JarContainsManifestFirstTests.java | 2 +- .../platform/tooling/support/tests/JarDescribeModuleTests.java | 2 +- .../java/platform/tooling/support/tests/JavaVersionsTests.java | 2 +- .../java/platform/tooling/support/tests/LocalMavenRepo.java | 2 +- .../test/java/platform/tooling/support/tests/ManifestTests.java | 2 +- .../test/java/platform/tooling/support/tests/MavenEnvVars.java | 2 +- .../java/platform/tooling/support/tests/MavenPomFileTests.java | 2 +- .../java/platform/tooling/support/tests/MavenRepoProxy.java | 2 +- .../java/platform/tooling/support/tests/MavenStarterTests.java | 2 +- .../tooling/support/tests/MavenSurefireCompatibilityTests.java | 2 +- .../platform/tooling/support/tests/ModularUserGuideTests.java | 2 +- .../platform/tooling/support/tests/MultiReleaseJarTests.java | 2 +- .../tooling/support/tests/OutputAttachingExtension.java | 2 +- .../src/test/java/platform/tooling/support/tests/Projects.java | 2 +- .../tooling/support/tests/ReflectionCompatibilityTests.java | 2 +- .../java/platform/tooling/support/tests/StandaloneTests.java | 2 +- .../java/platform/tooling/support/tests/ToolProviderTests.java | 2 +- .../tooling/support/tests/VintageGradleIntegrationTests.java | 2 +- .../tooling/support/tests/VintageMavenIntegrationTests.java | 2 +- .../test/java/platform/tooling/support/tests/XmlAssertions.java | 2 +- 1442 files changed, 1442 insertions(+), 1442 deletions(-) diff --git a/documentation/src/main/java/example/domain/Person.java b/documentation/src/main/java/example/domain/Person.java index 00e376dabef8..5da8625c722e 100644 --- a/documentation/src/main/java/example/domain/Person.java +++ b/documentation/src/main/java/example/domain/Person.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/main/java/example/registration/WebClient.java b/documentation/src/main/java/example/registration/WebClient.java index 857259d85895..eceb7a528f7a 100644 --- a/documentation/src/main/java/example/registration/WebClient.java +++ b/documentation/src/main/java/example/registration/WebClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/main/java/example/registration/WebResponse.java b/documentation/src/main/java/example/registration/WebResponse.java index 329cd7445d6b..e6fb139cde19 100644 --- a/documentation/src/main/java/example/registration/WebResponse.java +++ b/documentation/src/main/java/example/registration/WebResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/main/java/example/registration/WebServerExtension.java b/documentation/src/main/java/example/registration/WebServerExtension.java index 0fded5e34735..fd552069a27b 100644 --- a/documentation/src/main/java/example/registration/WebServerExtension.java +++ b/documentation/src/main/java/example/registration/WebServerExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/main/java/example/util/Calculator.java b/documentation/src/main/java/example/util/Calculator.java index 37cffa666ef6..06ea606439a8 100644 --- a/documentation/src/main/java/example/util/Calculator.java +++ b/documentation/src/main/java/example/util/Calculator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/main/java/example/util/ListWriter.java b/documentation/src/main/java/example/util/ListWriter.java index 84af14834e79..c2e822c3ac4c 100644 --- a/documentation/src/main/java/example/util/ListWriter.java +++ b/documentation/src/main/java/example/util/ListWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/main/java/example/util/StringUtils.java b/documentation/src/main/java/example/util/StringUtils.java index dba77b1c48ae..a48d72e3d3ad 100644 --- a/documentation/src/main/java/example/util/StringUtils.java +++ b/documentation/src/main/java/example/util/StringUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/AssertionsDemo.java b/documentation/src/test/java/example/AssertionsDemo.java index c1b1c47873d9..ef72db10079c 100644 --- a/documentation/src/test/java/example/AssertionsDemo.java +++ b/documentation/src/test/java/example/AssertionsDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/AssumptionsDemo.java b/documentation/src/test/java/example/AssumptionsDemo.java index e9b106fc993e..91320b117913 100644 --- a/documentation/src/test/java/example/AssumptionsDemo.java +++ b/documentation/src/test/java/example/AssumptionsDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/AutoCloseDemo.java b/documentation/src/test/java/example/AutoCloseDemo.java index 054b1b1bcf0c..11e9c4778c04 100644 --- a/documentation/src/test/java/example/AutoCloseDemo.java +++ b/documentation/src/test/java/example/AutoCloseDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/BeforeAndAfterSuiteDemo.java b/documentation/src/test/java/example/BeforeAndAfterSuiteDemo.java index c461417361bc..ee51c0d39577 100644 --- a/documentation/src/test/java/example/BeforeAndAfterSuiteDemo.java +++ b/documentation/src/test/java/example/BeforeAndAfterSuiteDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/ConditionalTestExecutionDemo.java b/documentation/src/test/java/example/ConditionalTestExecutionDemo.java index c2011653287a..5d9e68eaa5a4 100644 --- a/documentation/src/test/java/example/ConditionalTestExecutionDemo.java +++ b/documentation/src/test/java/example/ConditionalTestExecutionDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/CustomLauncherInterceptor.java b/documentation/src/test/java/example/CustomLauncherInterceptor.java index a18653087f20..727fc15c9b93 100644 --- a/documentation/src/test/java/example/CustomLauncherInterceptor.java +++ b/documentation/src/test/java/example/CustomLauncherInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/CustomTestEngine.java b/documentation/src/test/java/example/CustomTestEngine.java index 7809d4c3ad3e..2a7a21c87f42 100644 --- a/documentation/src/test/java/example/CustomTestEngine.java +++ b/documentation/src/test/java/example/CustomTestEngine.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/DisabledClassDemo.java b/documentation/src/test/java/example/DisabledClassDemo.java index 545dd5b4e152..12695bb07a6f 100644 --- a/documentation/src/test/java/example/DisabledClassDemo.java +++ b/documentation/src/test/java/example/DisabledClassDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/DisabledTestsDemo.java b/documentation/src/test/java/example/DisabledTestsDemo.java index 7f8c87f565e2..35c404e28997 100644 --- a/documentation/src/test/java/example/DisabledTestsDemo.java +++ b/documentation/src/test/java/example/DisabledTestsDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/DisplayNameDemo.java b/documentation/src/test/java/example/DisplayNameDemo.java index 41ba41622ac0..8598c0fac040 100644 --- a/documentation/src/test/java/example/DisplayNameDemo.java +++ b/documentation/src/test/java/example/DisplayNameDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/DisplayNameGeneratorDemo.java b/documentation/src/test/java/example/DisplayNameGeneratorDemo.java index 79f2ab985038..db76b7a8e55f 100644 --- a/documentation/src/test/java/example/DisplayNameGeneratorDemo.java +++ b/documentation/src/test/java/example/DisplayNameGeneratorDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/DocumentationTestSuite.java b/documentation/src/test/java/example/DocumentationTestSuite.java index 6bd7ef87b81f..68a61f938af8 100644 --- a/documentation/src/test/java/example/DocumentationTestSuite.java +++ b/documentation/src/test/java/example/DocumentationTestSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/DynamicTestsDemo.java b/documentation/src/test/java/example/DynamicTestsDemo.java index 0bb2a5149cdc..32388f62ed7b 100644 --- a/documentation/src/test/java/example/DynamicTestsDemo.java +++ b/documentation/src/test/java/example/DynamicTestsDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/ExampleTestCase.java b/documentation/src/test/java/example/ExampleTestCase.java index fd9b7cf07ac8..afad21430bb6 100644 --- a/documentation/src/test/java/example/ExampleTestCase.java +++ b/documentation/src/test/java/example/ExampleTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/ExternalCustomConditionDemo.java b/documentation/src/test/java/example/ExternalCustomConditionDemo.java index 1f83a26d3b30..800ec253c998 100644 --- a/documentation/src/test/java/example/ExternalCustomConditionDemo.java +++ b/documentation/src/test/java/example/ExternalCustomConditionDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/ExternalFieldSourceDemo.java b/documentation/src/test/java/example/ExternalFieldSourceDemo.java index 7918e5e5db02..b6bdc67d5364 100644 --- a/documentation/src/test/java/example/ExternalFieldSourceDemo.java +++ b/documentation/src/test/java/example/ExternalFieldSourceDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/ExternalMethodSourceDemo.java b/documentation/src/test/java/example/ExternalMethodSourceDemo.java index 9cc1a15ff7bf..6627180408b5 100644 --- a/documentation/src/test/java/example/ExternalMethodSourceDemo.java +++ b/documentation/src/test/java/example/ExternalMethodSourceDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/Fast.java b/documentation/src/test/java/example/Fast.java index 226d76949828..67cf49ad6c99 100644 --- a/documentation/src/test/java/example/Fast.java +++ b/documentation/src/test/java/example/Fast.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/FastTest.java b/documentation/src/test/java/example/FastTest.java index 00b5b28459c1..cccbc328d994 100644 --- a/documentation/src/test/java/example/FastTest.java +++ b/documentation/src/test/java/example/FastTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/HamcrestAssertionsDemo.java b/documentation/src/test/java/example/HamcrestAssertionsDemo.java index 4bfa2a05c9a1..bb678e06a1d3 100644 --- a/documentation/src/test/java/example/HamcrestAssertionsDemo.java +++ b/documentation/src/test/java/example/HamcrestAssertionsDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/HttpServerDemo.java b/documentation/src/test/java/example/HttpServerDemo.java index d961793db5a0..6411ec5d19c4 100644 --- a/documentation/src/test/java/example/HttpServerDemo.java +++ b/documentation/src/test/java/example/HttpServerDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/IgnoredTestsDemo.java b/documentation/src/test/java/example/IgnoredTestsDemo.java index 4e559ea1b9e5..4718c922ca9f 100644 --- a/documentation/src/test/java/example/IgnoredTestsDemo.java +++ b/documentation/src/test/java/example/IgnoredTestsDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/JUnit4Tests.java b/documentation/src/test/java/example/JUnit4Tests.java index e9ed6ed9581a..d915ef6e46e1 100644 --- a/documentation/src/test/java/example/JUnit4Tests.java +++ b/documentation/src/test/java/example/JUnit4Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/JUnitPlatformClassDemo.java b/documentation/src/test/java/example/JUnitPlatformClassDemo.java index 82e945d6c04b..bf776d627f6c 100644 --- a/documentation/src/test/java/example/JUnitPlatformClassDemo.java +++ b/documentation/src/test/java/example/JUnitPlatformClassDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/JUnitPlatformSuiteDemo.java b/documentation/src/test/java/example/JUnitPlatformSuiteDemo.java index 4e09c0fba9a5..259486cee3f8 100644 --- a/documentation/src/test/java/example/JUnitPlatformSuiteDemo.java +++ b/documentation/src/test/java/example/JUnitPlatformSuiteDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/MethodSourceParameterResolutionDemo.java b/documentation/src/test/java/example/MethodSourceParameterResolutionDemo.java index 98b555230b75..12bf6db6dc37 100644 --- a/documentation/src/test/java/example/MethodSourceParameterResolutionDemo.java +++ b/documentation/src/test/java/example/MethodSourceParameterResolutionDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/MyFirstJUnitJupiterTests.java b/documentation/src/test/java/example/MyFirstJUnitJupiterTests.java index 6566d55acc83..d40557dd30ac 100644 --- a/documentation/src/test/java/example/MyFirstJUnitJupiterTests.java +++ b/documentation/src/test/java/example/MyFirstJUnitJupiterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/OrderedNestedTestClassesDemo.java b/documentation/src/test/java/example/OrderedNestedTestClassesDemo.java index b7a98414ae49..79717d4f159b 100644 --- a/documentation/src/test/java/example/OrderedNestedTestClassesDemo.java +++ b/documentation/src/test/java/example/OrderedNestedTestClassesDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/OrderedTestsDemo.java b/documentation/src/test/java/example/OrderedTestsDemo.java index db90b9c6da80..4f677639e4dd 100644 --- a/documentation/src/test/java/example/OrderedTestsDemo.java +++ b/documentation/src/test/java/example/OrderedTestsDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/ParameterizedTestDemo.java b/documentation/src/test/java/example/ParameterizedTestDemo.java index 894b7617761d..c57a6ae3e0ad 100644 --- a/documentation/src/test/java/example/ParameterizedTestDemo.java +++ b/documentation/src/test/java/example/ParameterizedTestDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/PollingTimeoutDemo.java b/documentation/src/test/java/example/PollingTimeoutDemo.java index 3f0b825369c9..58147b83c238 100644 --- a/documentation/src/test/java/example/PollingTimeoutDemo.java +++ b/documentation/src/test/java/example/PollingTimeoutDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/RepeatedTestsDemo.java b/documentation/src/test/java/example/RepeatedTestsDemo.java index f11f7a5521b0..dd23f1f39158 100644 --- a/documentation/src/test/java/example/RepeatedTestsDemo.java +++ b/documentation/src/test/java/example/RepeatedTestsDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/SlowTests.java b/documentation/src/test/java/example/SlowTests.java index 0c3b6a22c4cf..93f341cf4545 100644 --- a/documentation/src/test/java/example/SlowTests.java +++ b/documentation/src/test/java/example/SlowTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/StandardTests.java b/documentation/src/test/java/example/StandardTests.java index 98e6a9cf35cf..d5ebbdc7ab5f 100644 --- a/documentation/src/test/java/example/StandardTests.java +++ b/documentation/src/test/java/example/StandardTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/SuiteDemo.java b/documentation/src/test/java/example/SuiteDemo.java index af7a1d386047..238c705d044a 100644 --- a/documentation/src/test/java/example/SuiteDemo.java +++ b/documentation/src/test/java/example/SuiteDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/TaggingDemo.java b/documentation/src/test/java/example/TaggingDemo.java index 5517bc2910e6..43e95e3d52c6 100644 --- a/documentation/src/test/java/example/TaggingDemo.java +++ b/documentation/src/test/java/example/TaggingDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/TempDirectoryDemo.java b/documentation/src/test/java/example/TempDirectoryDemo.java index 451d8281816f..e662f695698a 100644 --- a/documentation/src/test/java/example/TempDirectoryDemo.java +++ b/documentation/src/test/java/example/TempDirectoryDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/TestInfoDemo.java b/documentation/src/test/java/example/TestInfoDemo.java index a77cfb48b52a..d6b55e0bffff 100644 --- a/documentation/src/test/java/example/TestInfoDemo.java +++ b/documentation/src/test/java/example/TestInfoDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/TestReporterDemo.java b/documentation/src/test/java/example/TestReporterDemo.java index a6fddc53eb45..8c24a8c0a111 100644 --- a/documentation/src/test/java/example/TestReporterDemo.java +++ b/documentation/src/test/java/example/TestReporterDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/TestTemplateDemo.java b/documentation/src/test/java/example/TestTemplateDemo.java index 35c3a9a8d6cf..1dda57c462e5 100644 --- a/documentation/src/test/java/example/TestTemplateDemo.java +++ b/documentation/src/test/java/example/TestTemplateDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/TestingAStackDemo.java b/documentation/src/test/java/example/TestingAStackDemo.java index d4f4a381eac6..80b1ec495d83 100644 --- a/documentation/src/test/java/example/TestingAStackDemo.java +++ b/documentation/src/test/java/example/TestingAStackDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/TimeoutDemo.java b/documentation/src/test/java/example/TimeoutDemo.java index 7be021c0982a..1311c477a5f4 100644 --- a/documentation/src/test/java/example/TimeoutDemo.java +++ b/documentation/src/test/java/example/TimeoutDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/UsingTheLauncherDemo.java b/documentation/src/test/java/example/UsingTheLauncherDemo.java index 3d0b06bb7995..6b0a2d508237 100644 --- a/documentation/src/test/java/example/UsingTheLauncherDemo.java +++ b/documentation/src/test/java/example/UsingTheLauncherDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/callbacks/AbstractDatabaseTests.java b/documentation/src/test/java/example/callbacks/AbstractDatabaseTests.java index cae7cc799975..14248fbca2f1 100644 --- a/documentation/src/test/java/example/callbacks/AbstractDatabaseTests.java +++ b/documentation/src/test/java/example/callbacks/AbstractDatabaseTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/callbacks/BrokenLifecycleMethodConfigDemo.java b/documentation/src/test/java/example/callbacks/BrokenLifecycleMethodConfigDemo.java index ad4a13076536..c179021d3e71 100644 --- a/documentation/src/test/java/example/callbacks/BrokenLifecycleMethodConfigDemo.java +++ b/documentation/src/test/java/example/callbacks/BrokenLifecycleMethodConfigDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/callbacks/DatabaseTestsDemo.java b/documentation/src/test/java/example/callbacks/DatabaseTestsDemo.java index 6cf730d1d2e1..5e2c1e89da2e 100644 --- a/documentation/src/test/java/example/callbacks/DatabaseTestsDemo.java +++ b/documentation/src/test/java/example/callbacks/DatabaseTestsDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/callbacks/Extension1.java b/documentation/src/test/java/example/callbacks/Extension1.java index e258e6cde952..e1ee2e7fd7aa 100644 --- a/documentation/src/test/java/example/callbacks/Extension1.java +++ b/documentation/src/test/java/example/callbacks/Extension1.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/callbacks/Extension2.java b/documentation/src/test/java/example/callbacks/Extension2.java index 132234139389..45eb532d78e2 100644 --- a/documentation/src/test/java/example/callbacks/Extension2.java +++ b/documentation/src/test/java/example/callbacks/Extension2.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/callbacks/Logger.java b/documentation/src/test/java/example/callbacks/Logger.java index a77224d68ea0..e921ae11d025 100644 --- a/documentation/src/test/java/example/callbacks/Logger.java +++ b/documentation/src/test/java/example/callbacks/Logger.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/defaultmethods/ComparableContract.java b/documentation/src/test/java/example/defaultmethods/ComparableContract.java index 7e0a0435b1fc..18cff47a02ab 100644 --- a/documentation/src/test/java/example/defaultmethods/ComparableContract.java +++ b/documentation/src/test/java/example/defaultmethods/ComparableContract.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/defaultmethods/EqualsContract.java b/documentation/src/test/java/example/defaultmethods/EqualsContract.java index c6c64ec8a9a6..ea1ddf3758a9 100644 --- a/documentation/src/test/java/example/defaultmethods/EqualsContract.java +++ b/documentation/src/test/java/example/defaultmethods/EqualsContract.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/defaultmethods/StringTests.java b/documentation/src/test/java/example/defaultmethods/StringTests.java index 128683a33ec0..219196703792 100644 --- a/documentation/src/test/java/example/defaultmethods/StringTests.java +++ b/documentation/src/test/java/example/defaultmethods/StringTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/defaultmethods/Testable.java b/documentation/src/test/java/example/defaultmethods/Testable.java index cf0a6a308fc5..6b864d6ad1ca 100644 --- a/documentation/src/test/java/example/defaultmethods/Testable.java +++ b/documentation/src/test/java/example/defaultmethods/Testable.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/exception/AssertDoesNotThrowExceptionDemo.java b/documentation/src/test/java/example/exception/AssertDoesNotThrowExceptionDemo.java index 0c14624cc62f..29b2849c3b85 100644 --- a/documentation/src/test/java/example/exception/AssertDoesNotThrowExceptionDemo.java +++ b/documentation/src/test/java/example/exception/AssertDoesNotThrowExceptionDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/exception/ExceptionAssertionDemo.java b/documentation/src/test/java/example/exception/ExceptionAssertionDemo.java index c99776ea53a0..4e211b17c110 100644 --- a/documentation/src/test/java/example/exception/ExceptionAssertionDemo.java +++ b/documentation/src/test/java/example/exception/ExceptionAssertionDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/exception/ExceptionAssertionExactDemo.java b/documentation/src/test/java/example/exception/ExceptionAssertionExactDemo.java index 8ef8dfe7c404..51b62ec36e41 100644 --- a/documentation/src/test/java/example/exception/ExceptionAssertionExactDemo.java +++ b/documentation/src/test/java/example/exception/ExceptionAssertionExactDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/exception/FailedAssertionDemo.java b/documentation/src/test/java/example/exception/FailedAssertionDemo.java index f12bba305e19..bf07cb706078 100644 --- a/documentation/src/test/java/example/exception/FailedAssertionDemo.java +++ b/documentation/src/test/java/example/exception/FailedAssertionDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/exception/IgnoreIOExceptionExtension.java b/documentation/src/test/java/example/exception/IgnoreIOExceptionExtension.java index 3546702086e6..428ba73c078e 100644 --- a/documentation/src/test/java/example/exception/IgnoreIOExceptionExtension.java +++ b/documentation/src/test/java/example/exception/IgnoreIOExceptionExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/exception/IgnoreIOExceptionTests.java b/documentation/src/test/java/example/exception/IgnoreIOExceptionTests.java index 55ae4d88b9b5..840727c2b509 100644 --- a/documentation/src/test/java/example/exception/IgnoreIOExceptionTests.java +++ b/documentation/src/test/java/example/exception/IgnoreIOExceptionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/exception/MultipleHandlersTestCase.java b/documentation/src/test/java/example/exception/MultipleHandlersTestCase.java index 81b7ed2b12db..beae17472f2d 100644 --- a/documentation/src/test/java/example/exception/MultipleHandlersTestCase.java +++ b/documentation/src/test/java/example/exception/MultipleHandlersTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/exception/RecordStateOnErrorExtension.java b/documentation/src/test/java/example/exception/RecordStateOnErrorExtension.java index 8e13f000a491..70a925a91494 100644 --- a/documentation/src/test/java/example/exception/RecordStateOnErrorExtension.java +++ b/documentation/src/test/java/example/exception/RecordStateOnErrorExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/exception/UncaughtExceptionHandlingDemo.java b/documentation/src/test/java/example/exception/UncaughtExceptionHandlingDemo.java index ccc23d012c4d..f27ccba6a3b7 100644 --- a/documentation/src/test/java/example/exception/UncaughtExceptionHandlingDemo.java +++ b/documentation/src/test/java/example/exception/UncaughtExceptionHandlingDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/extensions/HttpServerExtension.java b/documentation/src/test/java/example/extensions/HttpServerExtension.java index 29318152228f..5ba23509d964 100644 --- a/documentation/src/test/java/example/extensions/HttpServerExtension.java +++ b/documentation/src/test/java/example/extensions/HttpServerExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/extensions/HttpServerResource.java b/documentation/src/test/java/example/extensions/HttpServerResource.java index 2f4e2e52afc3..845e88773fdc 100644 --- a/documentation/src/test/java/example/extensions/HttpServerResource.java +++ b/documentation/src/test/java/example/extensions/HttpServerResource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/extensions/ParameterResolverConflictDemo.java b/documentation/src/test/java/example/extensions/ParameterResolverConflictDemo.java index c20c17ce9d86..7ed2942742c1 100644 --- a/documentation/src/test/java/example/extensions/ParameterResolverConflictDemo.java +++ b/documentation/src/test/java/example/extensions/ParameterResolverConflictDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/extensions/ParameterResolverCustomAnnotationDemo.java b/documentation/src/test/java/example/extensions/ParameterResolverCustomAnnotationDemo.java index 8e68516ce659..44e3d60cb4f1 100644 --- a/documentation/src/test/java/example/extensions/ParameterResolverCustomAnnotationDemo.java +++ b/documentation/src/test/java/example/extensions/ParameterResolverCustomAnnotationDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/extensions/ParameterResolverCustomTypeDemo.java b/documentation/src/test/java/example/extensions/ParameterResolverCustomTypeDemo.java index c0b5b374c45d..7cf2963985e2 100644 --- a/documentation/src/test/java/example/extensions/ParameterResolverCustomTypeDemo.java +++ b/documentation/src/test/java/example/extensions/ParameterResolverCustomTypeDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/extensions/ParameterResolverNoConflictDemo.java b/documentation/src/test/java/example/extensions/ParameterResolverNoConflictDemo.java index 8f306a728632..7062d42c7ba1 100644 --- a/documentation/src/test/java/example/extensions/ParameterResolverNoConflictDemo.java +++ b/documentation/src/test/java/example/extensions/ParameterResolverNoConflictDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/extensions/Random.java b/documentation/src/test/java/example/extensions/Random.java index ee4e32322630..c134fe50af91 100644 --- a/documentation/src/test/java/example/extensions/Random.java +++ b/documentation/src/test/java/example/extensions/Random.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/extensions/RandomNumberDemo.java b/documentation/src/test/java/example/extensions/RandomNumberDemo.java index 8ace575739c3..e11b87ce5b52 100644 --- a/documentation/src/test/java/example/extensions/RandomNumberDemo.java +++ b/documentation/src/test/java/example/extensions/RandomNumberDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/extensions/RandomNumberExtension.java b/documentation/src/test/java/example/extensions/RandomNumberExtension.java index 2317997eb8c3..666e6ffe9ae5 100644 --- a/documentation/src/test/java/example/extensions/RandomNumberExtension.java +++ b/documentation/src/test/java/example/extensions/RandomNumberExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/interceptor/SwingEdtInterceptor.java b/documentation/src/test/java/example/interceptor/SwingEdtInterceptor.java index 326d3e02fdc4..348fd3607c1a 100644 --- a/documentation/src/test/java/example/interceptor/SwingEdtInterceptor.java +++ b/documentation/src/test/java/example/interceptor/SwingEdtInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/registration/DocumentationDemo.java b/documentation/src/test/java/example/registration/DocumentationDemo.java index 15971c249f1f..59571061d7de 100644 --- a/documentation/src/test/java/example/registration/DocumentationDemo.java +++ b/documentation/src/test/java/example/registration/DocumentationDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/registration/WebServerDemo.java b/documentation/src/test/java/example/registration/WebServerDemo.java index bd0f32587fdc..7064bad5cc7e 100644 --- a/documentation/src/test/java/example/registration/WebServerDemo.java +++ b/documentation/src/test/java/example/registration/WebServerDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/session/GlobalSetupTeardownListener.java b/documentation/src/test/java/example/session/GlobalSetupTeardownListener.java index bbf367cee897..8db5232d5bcb 100644 --- a/documentation/src/test/java/example/session/GlobalSetupTeardownListener.java +++ b/documentation/src/test/java/example/session/GlobalSetupTeardownListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/session/HttpTests.java b/documentation/src/test/java/example/session/HttpTests.java index 564834f8260a..fdb560b66fa6 100644 --- a/documentation/src/test/java/example/session/HttpTests.java +++ b/documentation/src/test/java/example/session/HttpTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/sharedresources/ChildrenSharedResourcesDemo.java b/documentation/src/test/java/example/sharedresources/ChildrenSharedResourcesDemo.java index 5350b9ff02a0..dd0fa9a5bcb4 100644 --- a/documentation/src/test/java/example/sharedresources/ChildrenSharedResourcesDemo.java +++ b/documentation/src/test/java/example/sharedresources/ChildrenSharedResourcesDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/sharedresources/DynamicSharedResourcesDemo.java b/documentation/src/test/java/example/sharedresources/DynamicSharedResourcesDemo.java index 8c80d511a353..31f4c37e6bb3 100644 --- a/documentation/src/test/java/example/sharedresources/DynamicSharedResourcesDemo.java +++ b/documentation/src/test/java/example/sharedresources/DynamicSharedResourcesDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/sharedresources/StaticSharedResourcesDemo.java b/documentation/src/test/java/example/sharedresources/StaticSharedResourcesDemo.java index 869f9eb7925d..efacccdf2094 100644 --- a/documentation/src/test/java/example/sharedresources/StaticSharedResourcesDemo.java +++ b/documentation/src/test/java/example/sharedresources/StaticSharedResourcesDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/testinterface/TestInterfaceDemo.java b/documentation/src/test/java/example/testinterface/TestInterfaceDemo.java index bfb8b9938fcb..5e059796b92e 100644 --- a/documentation/src/test/java/example/testinterface/TestInterfaceDemo.java +++ b/documentation/src/test/java/example/testinterface/TestInterfaceDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/testinterface/TestInterfaceDynamicTestsDemo.java b/documentation/src/test/java/example/testinterface/TestInterfaceDynamicTestsDemo.java index 0b78dabc2660..77781ab34581 100644 --- a/documentation/src/test/java/example/testinterface/TestInterfaceDynamicTestsDemo.java +++ b/documentation/src/test/java/example/testinterface/TestInterfaceDynamicTestsDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/testinterface/TestLifecycleLogger.java b/documentation/src/test/java/example/testinterface/TestLifecycleLogger.java index c7741aad38d6..ae54cd61c3cf 100644 --- a/documentation/src/test/java/example/testinterface/TestLifecycleLogger.java +++ b/documentation/src/test/java/example/testinterface/TestLifecycleLogger.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/testinterface/TimeExecutionLogger.java b/documentation/src/test/java/example/testinterface/TimeExecutionLogger.java index 57bd61ec4651..d4bce388f2f0 100644 --- a/documentation/src/test/java/example/testinterface/TimeExecutionLogger.java +++ b/documentation/src/test/java/example/testinterface/TimeExecutionLogger.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/testkit/EngineTestKitAllEventsDemo.java b/documentation/src/test/java/example/testkit/EngineTestKitAllEventsDemo.java index d7d5a4896057..2d5e632e67ca 100644 --- a/documentation/src/test/java/example/testkit/EngineTestKitAllEventsDemo.java +++ b/documentation/src/test/java/example/testkit/EngineTestKitAllEventsDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/testkit/EngineTestKitFailedMethodDemo.java b/documentation/src/test/java/example/testkit/EngineTestKitFailedMethodDemo.java index 18b719fab536..fbbdae71c42c 100644 --- a/documentation/src/test/java/example/testkit/EngineTestKitFailedMethodDemo.java +++ b/documentation/src/test/java/example/testkit/EngineTestKitFailedMethodDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/testkit/EngineTestKitSkippedMethodDemo.java b/documentation/src/test/java/example/testkit/EngineTestKitSkippedMethodDemo.java index 009d591c7e78..888325f893e3 100644 --- a/documentation/src/test/java/example/testkit/EngineTestKitSkippedMethodDemo.java +++ b/documentation/src/test/java/example/testkit/EngineTestKitSkippedMethodDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/testkit/EngineTestKitStatisticsDemo.java b/documentation/src/test/java/example/testkit/EngineTestKitStatisticsDemo.java index 44d41feeb244..5928f0fd7c20 100644 --- a/documentation/src/test/java/example/testkit/EngineTestKitStatisticsDemo.java +++ b/documentation/src/test/java/example/testkit/EngineTestKitStatisticsDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/timing/TimingExtension.java b/documentation/src/test/java/example/timing/TimingExtension.java index ff1c9079abf9..4d12db567543 100644 --- a/documentation/src/test/java/example/timing/TimingExtension.java +++ b/documentation/src/test/java/example/timing/TimingExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/example/timing/TimingExtensionTests.java b/documentation/src/test/java/example/timing/TimingExtensionTests.java index fd04a5d60448..585284d877d9 100644 --- a/documentation/src/test/java/example/timing/TimingExtensionTests.java +++ b/documentation/src/test/java/example/timing/TimingExtensionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/extensions/DisabledOnOpenJ9.java b/documentation/src/test/java/extensions/DisabledOnOpenJ9.java index f0a2a6206bd4..188b346a5e33 100644 --- a/documentation/src/test/java/extensions/DisabledOnOpenJ9.java +++ b/documentation/src/test/java/extensions/DisabledOnOpenJ9.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java/extensions/ExpectToFail.java b/documentation/src/test/java/extensions/ExpectToFail.java index adea1dcaeffa..eb148be26658 100644 --- a/documentation/src/test/java/extensions/ExpectToFail.java +++ b/documentation/src/test/java/extensions/ExpectToFail.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java21/example/DynamicTestsNamedDemo.java b/documentation/src/test/java21/example/DynamicTestsNamedDemo.java index 5453294d451b..0d515a8b49bc 100644 --- a/documentation/src/test/java21/example/DynamicTestsNamedDemo.java +++ b/documentation/src/test/java21/example/DynamicTestsNamedDemo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/java21/example/MyFirstJUnitJupiterRecordTests.java b/documentation/src/test/java21/example/MyFirstJUnitJupiterRecordTests.java index d7f213b81451..651862b1a1e5 100644 --- a/documentation/src/test/java21/example/MyFirstJUnitJupiterRecordTests.java +++ b/documentation/src/test/java21/example/MyFirstJUnitJupiterRecordTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/kotlin/example/FibonacciCalculator.kt b/documentation/src/test/kotlin/example/FibonacciCalculator.kt index bcf2158f90de..224d7ed62f89 100644 --- a/documentation/src/test/kotlin/example/FibonacciCalculator.kt +++ b/documentation/src/test/kotlin/example/FibonacciCalculator.kt @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/kotlin/example/KotlinAssertionsDemo.kt b/documentation/src/test/kotlin/example/KotlinAssertionsDemo.kt index 7aa762856e69..2abdde87e459 100644 --- a/documentation/src/test/kotlin/example/KotlinAssertionsDemo.kt +++ b/documentation/src/test/kotlin/example/KotlinAssertionsDemo.kt @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/test/kotlin/example/registration/KotlinWebServerDemo.kt b/documentation/src/test/kotlin/example/registration/KotlinWebServerDemo.kt index 65b729d7b2dd..4cbecd2b0660 100644 --- a/documentation/src/test/kotlin/example/registration/KotlinWebServerDemo.kt +++ b/documentation/src/test/kotlin/example/registration/KotlinWebServerDemo.kt @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/tools/java/org/junit/api/tools/AbstractApiReportWriter.java b/documentation/src/tools/java/org/junit/api/tools/AbstractApiReportWriter.java index f822e6f8e935..4e08a529fbe1 100644 --- a/documentation/src/tools/java/org/junit/api/tools/AbstractApiReportWriter.java +++ b/documentation/src/tools/java/org/junit/api/tools/AbstractApiReportWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/tools/java/org/junit/api/tools/ApiReport.java b/documentation/src/tools/java/org/junit/api/tools/ApiReport.java index 6478b10ad25d..148d7ef2ccde 100644 --- a/documentation/src/tools/java/org/junit/api/tools/ApiReport.java +++ b/documentation/src/tools/java/org/junit/api/tools/ApiReport.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/tools/java/org/junit/api/tools/ApiReportGenerator.java b/documentation/src/tools/java/org/junit/api/tools/ApiReportGenerator.java index e8e0df28b74d..02b7baa3f47d 100644 --- a/documentation/src/tools/java/org/junit/api/tools/ApiReportGenerator.java +++ b/documentation/src/tools/java/org/junit/api/tools/ApiReportGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/tools/java/org/junit/api/tools/ApiReportWriter.java b/documentation/src/tools/java/org/junit/api/tools/ApiReportWriter.java index 65487727f694..c59a903d9551 100644 --- a/documentation/src/tools/java/org/junit/api/tools/ApiReportWriter.java +++ b/documentation/src/tools/java/org/junit/api/tools/ApiReportWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/tools/java/org/junit/api/tools/AsciidocApiReportWriter.java b/documentation/src/tools/java/org/junit/api/tools/AsciidocApiReportWriter.java index 3c4f35fc624b..24ff7b9eab1a 100644 --- a/documentation/src/tools/java/org/junit/api/tools/AsciidocApiReportWriter.java +++ b/documentation/src/tools/java/org/junit/api/tools/AsciidocApiReportWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/tools/java/org/junit/api/tools/Declaration.java b/documentation/src/tools/java/org/junit/api/tools/Declaration.java index 8cde00674801..a6921cce8862 100644 --- a/documentation/src/tools/java/org/junit/api/tools/Declaration.java +++ b/documentation/src/tools/java/org/junit/api/tools/Declaration.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/tools/java/org/junit/api/tools/HtmlApiReportWriter.java b/documentation/src/tools/java/org/junit/api/tools/HtmlApiReportWriter.java index dc042e183b78..56020962d54a 100644 --- a/documentation/src/tools/java/org/junit/api/tools/HtmlApiReportWriter.java +++ b/documentation/src/tools/java/org/junit/api/tools/HtmlApiReportWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/documentation/src/tools/java/org/junit/api/tools/MarkdownApiReportWriter.java b/documentation/src/tools/java/org/junit/api/tools/MarkdownApiReportWriter.java index 75798266fc3c..385d27d9ae07 100644 --- a/documentation/src/tools/java/org/junit/api/tools/MarkdownApiReportWriter.java +++ b/documentation/src/tools/java/org/junit/api/tools/MarkdownApiReportWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AfterAll.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AfterAll.java index 7cbbfd7b0f15..171f530fb324 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AfterAll.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AfterAll.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AfterEach.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AfterEach.java index bf1d90853f33..b46258fb5ad2 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AfterEach.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AfterEach.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertAll.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertAll.java index 29b1218ff060..ae5f2828c795 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertAll.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertAll.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertArrayEquals.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertArrayEquals.java index 7da0accd15b4..06be401319d6 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertArrayEquals.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertArrayEquals.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertDoesNotThrow.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertDoesNotThrow.java index e83f4508daaf..e2b9135dbd88 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertDoesNotThrow.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertDoesNotThrow.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertEquals.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertEquals.java index 558d9afc8147..94afc3fe49c7 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertEquals.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertEquals.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertFalse.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertFalse.java index 83dad97da5ce..f7582574166d 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertFalse.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertFalse.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertInstanceOf.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertInstanceOf.java index 60d9b278e5ee..4d3197ba46fe 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertInstanceOf.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertInstanceOf.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertIterableEquals.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertIterableEquals.java index 820b5365e2b3..c0dcf1dd5875 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertIterableEquals.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertIterableEquals.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertLinesMatch.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertLinesMatch.java index ef25f47e1dd3..7596aed881f0 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertLinesMatch.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertLinesMatch.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertNotEquals.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertNotEquals.java index 4bdd3376248c..1ccc41b7bb13 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertNotEquals.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertNotEquals.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertNotNull.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertNotNull.java index 8d63cd76bdd6..f5fb9b849230 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertNotNull.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertNotNull.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertNotSame.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertNotSame.java index 606934f317ca..860371937076 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertNotSame.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertNotSame.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertNull.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertNull.java index 9d674d8c59c0..a81e7925415f 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertNull.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertNull.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertSame.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertSame.java index 8e9278d19c84..f006dab823ff 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertSame.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertSame.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertThrows.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertThrows.java index 02947d1637af..70ee8b02fe4f 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertThrows.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertThrows.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertThrowsExactly.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertThrowsExactly.java index 830dca520260..4fa017318589 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertThrowsExactly.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertThrowsExactly.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertTimeout.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertTimeout.java index 64b625b6c7fa..3aadf60f88af 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertTimeout.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertTimeout.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertTimeoutPreemptively.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertTimeoutPreemptively.java index aa68efbbcab8..82b0148780a9 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertTimeoutPreemptively.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertTimeoutPreemptively.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertTrue.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertTrue.java index 0cb0bbc245bd..af43e0613263 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertTrue.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertTrue.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertionFailureBuilder.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertionFailureBuilder.java index 5f826a88cb8d..0b9b375b0469 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertionFailureBuilder.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertionFailureBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertionUtils.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertionUtils.java index 3ac27f22b1dd..9431e30b3940 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertionUtils.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AssertionUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Assertions.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Assertions.java index 3b0bf640ac47..86e0dfc3e962 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Assertions.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Assertions.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Assumptions.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Assumptions.java index 68b0b66ac62f..6545518b4d3e 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Assumptions.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Assumptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AutoClose.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AutoClose.java index 0a29faba7a95..f0bbc4646cc7 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AutoClose.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/AutoClose.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/BeforeAll.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/BeforeAll.java index 197556e7ad3b..e327653c46c3 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/BeforeAll.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/BeforeAll.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/BeforeEach.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/BeforeEach.java index 7aee562c0ac8..0f3058e8b12e 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/BeforeEach.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/BeforeEach.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/ClassDescriptor.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/ClassDescriptor.java index d6c53bee156c..1dc3f7105596 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/ClassDescriptor.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/ClassDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/ClassOrderer.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/ClassOrderer.java index e27c05abb926..2e4f8d465b66 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/ClassOrderer.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/ClassOrderer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/ClassOrdererContext.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/ClassOrdererContext.java index 9d9d0325cdb9..bcc7e7ce402e 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/ClassOrdererContext.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/ClassOrdererContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Disabled.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Disabled.java index 44ec76fca882..e02c23cf030e 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Disabled.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Disabled.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayName.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayName.java index abc398327f15..c8318e1bfb3b 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayName.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayName.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayNameGeneration.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayNameGeneration.java index 5345e4d7305e..3a23b9a8ea72 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayNameGeneration.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayNameGeneration.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayNameGenerator.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayNameGenerator.java index 11f8b1851da1..810d180e3da8 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayNameGenerator.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayNameGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DynamicContainer.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DynamicContainer.java index 5a37b8e156fd..da947b68c778 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DynamicContainer.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DynamicContainer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DynamicNode.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DynamicNode.java index be569469d852..43574ee853a7 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DynamicNode.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DynamicNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DynamicTest.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DynamicTest.java index b61ccb71a57a..d87ae1ab4f71 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DynamicTest.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DynamicTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/IndicativeSentencesGeneration.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/IndicativeSentencesGeneration.java index 9a24a7e4e1d6..722e91bf4d09 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/IndicativeSentencesGeneration.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/IndicativeSentencesGeneration.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/MethodDescriptor.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/MethodDescriptor.java index 7fbf3f569b32..5026d5a448c7 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/MethodDescriptor.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/MethodDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/MethodOrderer.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/MethodOrderer.java index 4a71d5944551..8a91cf597666 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/MethodOrderer.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/MethodOrderer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/MethodOrdererContext.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/MethodOrdererContext.java index bab5d3e10ec5..38f1d90b2467 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/MethodOrdererContext.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/MethodOrdererContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Named.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Named.java index e41b4be29ab3..dfeff26354e4 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Named.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Named.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/NamedExecutable.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/NamedExecutable.java index 16d5a72d2d18..c11a631885f3 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/NamedExecutable.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/NamedExecutable.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Nested.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Nested.java index 2e9c559e9390..4d96618238d0 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Nested.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Nested.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Order.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Order.java index 3055cdc2cd0d..7ea0fbadbca9 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Order.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Order.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/RandomOrdererUtils.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/RandomOrdererUtils.java index 35b5dc6208ae..de221d3d5d61 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/RandomOrdererUtils.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/RandomOrdererUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/RepeatedTest.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/RepeatedTest.java index 063228c97486..15c991357c4e 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/RepeatedTest.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/RepeatedTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/RepetitionInfo.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/RepetitionInfo.java index e7b84a024ac1..a24dce3e3d6c 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/RepetitionInfo.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/RepetitionInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Tag.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Tag.java index 87777564aaaf..ffc31b21ffcc 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Tag.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Tag.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Tags.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Tags.java index 5b681705a018..840adf79312e 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Tags.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Tags.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Test.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Test.java index f17d735904a4..052508f90a62 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Test.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestClassOrder.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestClassOrder.java index 86bc8c66a9da..860486e7a4c2 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestClassOrder.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestClassOrder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestFactory.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestFactory.java index dd17d2647186..42835ebd6888 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestFactory.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestInfo.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestInfo.java index 518a4ad69c15..b21130737d25 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestInfo.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestInstance.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestInstance.java index 8ff063d7927a..80f904a41987 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestInstance.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestInstance.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestMethodOrder.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestMethodOrder.java index 93790ca79305..f61820fa5cbf 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestMethodOrder.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestMethodOrder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestReporter.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestReporter.java index 79f3f721fbfa..2dd045358451 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestReporter.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestReporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestTemplate.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestTemplate.java index c9d337108405..9636a2d01679 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestTemplate.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/TestTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Timeout.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Timeout.java index 313e7f2ef87d..f7081d629cda 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Timeout.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/Timeout.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/AbstractOsBasedExecutionCondition.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/AbstractOsBasedExecutionCondition.java index 93ec01c659ea..c4ae691aee63 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/AbstractOsBasedExecutionCondition.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/AbstractOsBasedExecutionCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/AbstractRepeatableAnnotationCondition.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/AbstractRepeatableAnnotationCondition.java index fd15a61bf6be..66cc3d2e61c6 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/AbstractRepeatableAnnotationCondition.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/AbstractRepeatableAnnotationCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/BooleanExecutionCondition.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/BooleanExecutionCondition.java index 0793e795380b..2dfd7c3ca688 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/BooleanExecutionCondition.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/BooleanExecutionCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledForJreRange.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledForJreRange.java index 2ca116acfb9f..fc96d82118b0 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledForJreRange.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledForJreRange.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledForJreRangeCondition.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledForJreRangeCondition.java index fb8d45b0963e..b62e7053c4de 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledForJreRangeCondition.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledForJreRangeCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIf.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIf.java index 6e823856cc38..070279b9a461 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIf.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIf.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfCondition.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfCondition.java index 2d27cbeb8f8a..26ebe9bd3df1 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfCondition.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfEnvironmentVariable.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfEnvironmentVariable.java index 69c600576056..fb1a35ad1e61 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfEnvironmentVariable.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfEnvironmentVariable.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfEnvironmentVariableCondition.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfEnvironmentVariableCondition.java index 43dd839d544c..cac8fe5300c4 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfEnvironmentVariableCondition.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfEnvironmentVariableCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfEnvironmentVariables.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfEnvironmentVariables.java index b29e874949cf..8bedc3fd37ef 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfEnvironmentVariables.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfEnvironmentVariables.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfSystemProperties.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfSystemProperties.java index f103e3066b29..3e22c0f20ebd 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfSystemProperties.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfSystemProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfSystemProperty.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfSystemProperty.java index 43e856b6a9c6..5cb96077a9cb 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfSystemProperty.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfSystemProperty.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfSystemPropertyCondition.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfSystemPropertyCondition.java index d28a906c0150..45abb83f8cea 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfSystemPropertyCondition.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledIfSystemPropertyCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledInNativeImage.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledInNativeImage.java index e7505d328a00..330ddb6a8d9b 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledInNativeImage.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledInNativeImage.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledOnJre.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledOnJre.java index ed1c6e272511..6231f5246067 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledOnJre.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledOnJre.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledOnJreCondition.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledOnJreCondition.java index fd2b0996c5e2..aa74770bc3cd 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledOnJreCondition.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledOnJreCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledOnOs.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledOnOs.java index a8dd1dd0fe3e..53356e601f19 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledOnOs.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledOnOs.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledOnOsCondition.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledOnOsCondition.java index 714c74cb37bd..27328a81568a 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledOnOsCondition.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/DisabledOnOsCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledForJreRange.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledForJreRange.java index 1ccd390c08e8..79ef2aeb595e 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledForJreRange.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledForJreRange.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledForJreRangeCondition.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledForJreRangeCondition.java index 0c7c0187778e..abb5001a7ccf 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledForJreRangeCondition.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledForJreRangeCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIf.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIf.java index 56d72c8fce7d..79837a15e7f6 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIf.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIf.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfCondition.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfCondition.java index 2edcec77b7b9..fbbb228f4ae8 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfCondition.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfEnvironmentVariable.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfEnvironmentVariable.java index 85d455d98582..941b823ec44c 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfEnvironmentVariable.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfEnvironmentVariable.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfEnvironmentVariableCondition.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfEnvironmentVariableCondition.java index b336e6d78a64..050206f5559f 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfEnvironmentVariableCondition.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfEnvironmentVariableCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfEnvironmentVariables.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfEnvironmentVariables.java index 60d8b5de9cfb..32102bd4a95b 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfEnvironmentVariables.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfEnvironmentVariables.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfSystemProperties.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfSystemProperties.java index 1f26ceef55a5..640e6a6ea97c 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfSystemProperties.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfSystemProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfSystemProperty.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfSystemProperty.java index a2f8fb004d60..226211961470 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfSystemProperty.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfSystemProperty.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfSystemPropertyCondition.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfSystemPropertyCondition.java index f6d5ffb79ebf..00ce9a4c4c1f 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfSystemPropertyCondition.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledIfSystemPropertyCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledInNativeImage.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledInNativeImage.java index c2c7993adafe..daafe41ad897 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledInNativeImage.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledInNativeImage.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledOnJre.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledOnJre.java index b37776e31ee6..f768e439c18f 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledOnJre.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledOnJre.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledOnJreCondition.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledOnJreCondition.java index 70c0b3867a66..674d0687856c 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledOnJreCondition.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledOnJreCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledOnOs.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledOnOs.java index eff74e6ccb57..3fdece340e1a 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledOnOs.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledOnOs.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledOnOsCondition.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledOnOsCondition.java index 1853b9f09f8a..cf9e9d6682f9 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledOnOsCondition.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/EnabledOnOsCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/MethodBasedCondition.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/MethodBasedCondition.java index 24db23ec2ae0..48088225cf01 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/MethodBasedCondition.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/MethodBasedCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/OS.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/OS.java index 9e4094599fa2..49878580bd66 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/OS.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/condition/OS.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/AfterAllCallback.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/AfterAllCallback.java index b98600d85849..4c50c5f46c12 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/AfterAllCallback.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/AfterAllCallback.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/AfterEachCallback.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/AfterEachCallback.java index 2d8724e1974c..a1be4e60e374 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/AfterEachCallback.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/AfterEachCallback.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/AfterTestExecutionCallback.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/AfterTestExecutionCallback.java index 72ca8e31d8a1..367985a93914 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/AfterTestExecutionCallback.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/AfterTestExecutionCallback.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/AnnotatedElementContext.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/AnnotatedElementContext.java index 924e4a918d93..0c12f33c1765 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/AnnotatedElementContext.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/AnnotatedElementContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/BeforeAllCallback.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/BeforeAllCallback.java index 5533e1169904..d546e0da035f 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/BeforeAllCallback.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/BeforeAllCallback.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/BeforeEachCallback.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/BeforeEachCallback.java index 273a7de1f900..6b23ad51df73 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/BeforeEachCallback.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/BeforeEachCallback.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/BeforeTestExecutionCallback.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/BeforeTestExecutionCallback.java index 35b634c47473..56094d6a133f 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/BeforeTestExecutionCallback.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/BeforeTestExecutionCallback.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ConditionEvaluationResult.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ConditionEvaluationResult.java index 9b67863e51bb..316d5961813c 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ConditionEvaluationResult.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ConditionEvaluationResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/DynamicTestInvocationContext.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/DynamicTestInvocationContext.java index f92391570724..e835648b3cb8 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/DynamicTestInvocationContext.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/DynamicTestInvocationContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExecutableInvoker.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExecutableInvoker.java index 4e1b8e753d31..37645f08e1ee 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExecutableInvoker.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExecutableInvoker.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExecutionCondition.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExecutionCondition.java index d82687f4fd22..31af5c81a917 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExecutionCondition.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExecutionCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtendWith.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtendWith.java index 036e7eb90396..7bbab30aa8d3 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtendWith.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtendWith.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extension.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extension.java index 78c68ab96867..f5cee6257919 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extension.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extension.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtensionConfigurationException.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtensionConfigurationException.java index 49e6defb985d..91e5c7ee997d 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtensionConfigurationException.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtensionConfigurationException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtensionContext.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtensionContext.java index fddbbf6b638f..59fece5cd109 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtensionContext.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtensionContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtensionContextException.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtensionContextException.java index 56192607892c..c31797d17362 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtensionContextException.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ExtensionContextException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extensions.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extensions.java index 3607def6d0aa..a9817b4866ba 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extensions.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/Extensions.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java index ed4dfb37df57..dc02002508d0 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/InvocationInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/LifecycleMethodExecutionExceptionHandler.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/LifecycleMethodExecutionExceptionHandler.java index de752e28eb1b..c4078c9ef45f 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/LifecycleMethodExecutionExceptionHandler.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/LifecycleMethodExecutionExceptionHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/MediaType.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/MediaType.java index d45f808c84b1..00ad02dadfd2 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/MediaType.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/MediaType.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterContext.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterContext.java index d8ae7d8f18e0..844b7aed9592 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterContext.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolutionException.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolutionException.java index 53865320a86d..31c9730b6222 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolutionException.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolutionException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java index 8e405b32d16f..093fe276bcf5 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ParameterResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptCallback.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptCallback.java index d32d77e34406..03fd96f03800 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptCallback.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptCallback.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptContext.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptContext.java index 117ca0c9a457..77bb98e728ff 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptContext.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/PreInterruptContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ReflectiveInvocationContext.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ReflectiveInvocationContext.java index ad074b3e745f..9da713d38353 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ReflectiveInvocationContext.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/ReflectiveInvocationContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/RegisterExtension.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/RegisterExtension.java index eb84ab641a8f..89121342acb4 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/RegisterExtension.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/RegisterExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestExecutionExceptionHandler.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestExecutionExceptionHandler.java index 325ae97ad297..29cb10b53d67 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestExecutionExceptionHandler.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestExecutionExceptionHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java index 1ed3c7b8e63d..e06ca4d75c0c 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactoryContext.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactoryContext.java index 25b8b76755f9..ec2df219ea2e 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactoryContext.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstanceFactoryContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java index a136caf07a98..ad70edb7cf41 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java index a0a85eab4c2a..70a0035c826d 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreConstructCallback.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreDestroyCallback.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreDestroyCallback.java index a7d27fee7681..2cb6654cfeec 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreDestroyCallback.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstancePreDestroyCallback.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstances.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstances.java index e38d33b678d3..60b20b6825c2 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstances.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstances.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstantiationAwareExtension.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstantiationAwareExtension.java index 35565040f37a..81bae81f853c 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstantiationAwareExtension.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstantiationAwareExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstantiationException.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstantiationException.java index 1cccc49a20e1..66884bdba9db 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstantiationException.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestInstantiationException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContext.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContext.java index c75c34ae4f97..37a11b3b923d 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContext.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java index 191b98465084..a6a79b881513 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestWatcher.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestWatcher.java index 176d5fa2fa68..54c7c24da942 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestWatcher.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestWatcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/support/TypeBasedParameterResolver.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/support/TypeBasedParameterResolver.java index 1eb5d6c89f53..25608a4a1ae8 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/support/TypeBasedParameterResolver.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/support/TypeBasedParameterResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/function/Executable.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/function/Executable.java index c60bd15db337..e4ad90b7ae2f 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/function/Executable.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/function/Executable.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/function/ThrowingConsumer.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/function/ThrowingConsumer.java index 5041f2515777..ca32cf145b02 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/function/ThrowingConsumer.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/function/ThrowingConsumer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/function/ThrowingSupplier.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/function/ThrowingSupplier.java index 892fa15f91d1..42212221844a 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/function/ThrowingSupplier.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/function/ThrowingSupplier.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/io/CleanupMode.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/io/CleanupMode.java index 5a7a187278c0..4572b63d9422 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/io/CleanupMode.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/io/CleanupMode.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/io/TempDir.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/io/TempDir.java index 55d9bbfcf56b..6384f2145f84 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/io/TempDir.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/io/TempDir.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/io/TempDirFactory.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/io/TempDirFactory.java index d375482a759c..d5bbce4a4e2f 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/io/TempDirFactory.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/io/TempDirFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/Execution.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/Execution.java index c2500e84ac4c..d1c53ca87d96 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/Execution.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/Execution.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ExecutionMode.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ExecutionMode.java index 136a1a0054ec..119ac5278e99 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ExecutionMode.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ExecutionMode.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/Isolated.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/Isolated.java index 8683cd470969..41eb28dea117 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/Isolated.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/Isolated.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceAccessMode.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceAccessMode.java index cc973b0dd0dd..4bc04d6f6108 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceAccessMode.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceAccessMode.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLock.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLock.java index e78abdcb647d..e2d3af554630 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLock.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLock.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLockTarget.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLockTarget.java index 89aa97a67bf1..883869134d48 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLockTarget.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLockTarget.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocks.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocks.java index 80588aa9461b..790b4d231b31 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocks.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocks.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocksProvider.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocksProvider.java index 720224ed033d..6e531c478d4f 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocksProvider.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocksProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/Resources.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/Resources.java index d6c4be3056a7..d874d4b6d391 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/Resources.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/Resources.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/main/kotlin/org/junit/jupiter/api/Assertions.kt b/junit-jupiter-api/src/main/kotlin/org/junit/jupiter/api/Assertions.kt index c6ac07dd44a0..ce93a2fdd56b 100644 --- a/junit-jupiter-api/src/main/kotlin/org/junit/jupiter/api/Assertions.kt +++ b/junit-jupiter-api/src/main/kotlin/org/junit/jupiter/api/Assertions.kt @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/EqualsAndHashCodeAssertions.java b/junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/EqualsAndHashCodeAssertions.java index 735f2425cc84..ed33d21ebf3d 100644 --- a/junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/EqualsAndHashCodeAssertions.java +++ b/junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/EqualsAndHashCodeAssertions.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/extension/DisabledOnOpenJ9.java b/junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/extension/DisabledOnOpenJ9.java index 965de2b7d255..0cda6f2d5a1b 100644 --- a/junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/extension/DisabledOnOpenJ9.java +++ b/junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/extension/DisabledOnOpenJ9.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/extension/ExtensionContextParameterResolver.java b/junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/extension/ExtensionContextParameterResolver.java index a68e59f37d1d..b0028eadd9cb 100644 --- a/junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/extension/ExtensionContextParameterResolver.java +++ b/junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/extension/ExtensionContextParameterResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/fixtures/TrackLogRecords.java b/junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/fixtures/TrackLogRecords.java index 1abdd36632a8..0c675b07dbdd 100644 --- a/junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/fixtures/TrackLogRecords.java +++ b/junit-jupiter-api/src/testFixtures/java/org/junit/jupiter/api/fixtures/TrackLogRecords.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java index 204c57c350c2..51ca2c102ca2 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/Constants.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/JupiterTestEngine.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/JupiterTestEngine.java index a4f5ac7fa454..0de9bbb308ec 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/JupiterTestEngine.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/JupiterTestEngine.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/CachingJupiterConfiguration.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/CachingJupiterConfiguration.java index c0c61b2aeae7..170a8c2be817 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/CachingJupiterConfiguration.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/CachingJupiterConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/DefaultJupiterConfiguration.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/DefaultJupiterConfiguration.java index 2ba7caf837d0..7f24180acea7 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/DefaultJupiterConfiguration.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/DefaultJupiterConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/EnumConfigurationParameterConverter.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/EnumConfigurationParameterConverter.java index 16e13ed18a4a..19c8222c76ad 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/EnumConfigurationParameterConverter.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/EnumConfigurationParameterConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/InstantiatingConfigurationParameterConverter.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/InstantiatingConfigurationParameterConverter.java index 936dfe093520..c0df1064f0c3 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/InstantiatingConfigurationParameterConverter.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/InstantiatingConfigurationParameterConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java index 239c3d40bec3..c9b2781ea73e 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/config/JupiterConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/AbstractExtensionContext.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/AbstractExtensionContext.java index a44756df3e21..bf7cb5d9a059 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/AbstractExtensionContext.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/AbstractExtensionContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java index 2b6b93e79bc3..5c514362e8d9 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassBasedTestDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassExtensionContext.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassExtensionContext.java index cc4fd4bec672..aace0e86e16d 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassExtensionContext.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassExtensionContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassTestDescriptor.java index 3b4b1db2a1de..7c2a5571694c 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ClassTestDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DefaultDynamicTestInvocationContext.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DefaultDynamicTestInvocationContext.java index 1c3337224a6b..72ef0981b728 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DefaultDynamicTestInvocationContext.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DefaultDynamicTestInvocationContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DefaultTestInstanceFactoryContext.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DefaultTestInstanceFactoryContext.java index ad8bf3b33c55..8414ab8c834a 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DefaultTestInstanceFactoryContext.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DefaultTestInstanceFactoryContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DisplayNameUtils.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DisplayNameUtils.java index b4cf927b3f97..ebe3d127bf0c 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DisplayNameUtils.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DisplayNameUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicContainerTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicContainerTestDescriptor.java index 2ca4525dbf10..96b7d6e132ba 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicContainerTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicContainerTestDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicDescendantFilter.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicDescendantFilter.java index b94a1eda75e5..15b059ca47b4 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicDescendantFilter.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicDescendantFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicExtensionContext.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicExtensionContext.java index 2cc4e130a5b2..cd3c292709e2 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicExtensionContext.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicExtensionContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicNodeTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicNodeTestDescriptor.java index 4fc200a9e4a2..c5e83da28df1 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicNodeTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicNodeTestDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicTestTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicTestTestDescriptor.java index 9a1729a3aed2..e504b311a5df 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicTestTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DynamicTestTestDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExclusiveResourceCollector.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExclusiveResourceCollector.java index 53757a4be9e6..15e7d26b6db5 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExclusiveResourceCollector.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExclusiveResourceCollector.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExtensionUtils.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExtensionUtils.java index f9677ecfc9eb..976e7df23790 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExtensionUtils.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ExtensionUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/Filterable.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/Filterable.java index 61f24b9b070b..e75e69710ddf 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/Filterable.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/Filterable.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterEngineDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterEngineDescriptor.java index 50d694b46f5e..9491b89fc073 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterEngineDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterEngineDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterEngineExtensionContext.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterEngineExtensionContext.java index 88d94db6225d..6ecd845d6ded 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterEngineExtensionContext.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterEngineExtensionContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.java index 86fecaf73ddd..0101f9d2b5c6 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtils.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtils.java index 538ea853d7b7..7d76ba1a5a16 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtils.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodBasedTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodBasedTestDescriptor.java index 95d9ecbf6035..525b58293709 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodBasedTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodBasedTestDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodExtensionContext.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodExtensionContext.java index 2c51ad7e5862..a6d983e7196b 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodExtensionContext.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodExtensionContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodSourceSupport.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodSourceSupport.java index f5ebe602576f..19b17efb83e4 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodSourceSupport.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodSourceSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/NestedClassTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/NestedClassTestDescriptor.java index f8ddd867239a..6d4dc1e2d088 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/NestedClassTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/NestedClassTestDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ResourceLockAware.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ResourceLockAware.java index 8c50b188d0d2..e7aa88edea52 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ResourceLockAware.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/ResourceLockAware.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestFactoryTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestFactoryTestDescriptor.java index 1a86ba2e8d9a..e4643baa54de 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestFactoryTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestFactoryTestDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestInstanceLifecycleUtils.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestInstanceLifecycleUtils.java index 3620b735b55b..d7e653b82418 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestInstanceLifecycleUtils.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestInstanceLifecycleUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestMethodTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestMethodTestDescriptor.java index b2c7830da1a9..423f2e3b9013 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestMethodTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestMethodTestDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateExtensionContext.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateExtensionContext.java index 9d40ec8fa1bb..ea6df34d7436 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateExtensionContext.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateExtensionContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateInvocationTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateInvocationTestDescriptor.java index acc31605ebcb..cbb66f12d9b9 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateInvocationTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateInvocationTestDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java index 53206b685d07..f89c17b26a32 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/AbstractAnnotatedDescriptorWrapper.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/AbstractAnnotatedDescriptorWrapper.java index da665f1e9731..f782260432d9 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/AbstractAnnotatedDescriptorWrapper.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/AbstractAnnotatedDescriptorWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/AbstractOrderingVisitor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/AbstractOrderingVisitor.java index 4e014b166bb8..e2da60a53aba 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/AbstractOrderingVisitor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/AbstractOrderingVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassOrderingVisitor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassOrderingVisitor.java index fb60bd702019..545ee52d5072 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassOrderingVisitor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassOrderingVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassSelectorResolver.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassSelectorResolver.java index 77b6f69aa58c..46d97088c358 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassSelectorResolver.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassSelectorResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/DefaultClassDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/DefaultClassDescriptor.java index fd51f71b14a8..52bcb48d3e28 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/DefaultClassDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/DefaultClassDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/DefaultClassOrdererContext.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/DefaultClassOrdererContext.java index f9646db799c5..5868644b4d91 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/DefaultClassOrdererContext.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/DefaultClassOrdererContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/DefaultMethodDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/DefaultMethodDescriptor.java index 66931bebb06f..6ce195f046d0 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/DefaultMethodDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/DefaultMethodDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/DefaultMethodOrdererContext.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/DefaultMethodOrdererContext.java index de10c94a6ba7..3016f6940fd3 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/DefaultMethodOrdererContext.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/DefaultMethodOrdererContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolver.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolver.java index 2bf17487949b..a828889cc000 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolver.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodFinder.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodFinder.java index 09bfb9d50743..59fc6e356012 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodFinder.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodFinder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodOrderingVisitor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodOrderingVisitor.java index 44e056fedf36..30ee1342b6f5 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodOrderingVisitor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodOrderingVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodSelectorResolver.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodSelectorResolver.java index 57df96514da7..7f76e2d30fce 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodSelectorResolver.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodSelectorResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsInnerClass.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsInnerClass.java index 9417a9b3b4c3..1e30582d48ca 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsInnerClass.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsInnerClass.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsNestedTestClass.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsNestedTestClass.java index 5b8176fa6f0d..3474d8cf0240 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsNestedTestClass.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsNestedTestClass.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsPotentialTestContainer.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsPotentialTestContainer.java index 2dc5da128be8..0534cd2481c0 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsPotentialTestContainer.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsPotentialTestContainer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestClassWithTests.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestClassWithTests.java index 162ed3037919..764ef8356067 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestClassWithTests.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestClassWithTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestFactoryMethod.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestFactoryMethod.java index 7a7f5549e7aa..2932640add1a 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestFactoryMethod.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestFactoryMethod.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestMethod.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestMethod.java index 3f4add6be2f1..8cbc1b7b6cca 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestMethod.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestMethod.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestTemplateMethod.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestTemplateMethod.java index 576188582630..fded3a83eab9 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestTemplateMethod.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestTemplateMethod.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestableMethod.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestableMethod.java index c2ff12dcc633..7852d382c627 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestableMethod.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/predicates/IsTestableMethod.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/AfterEachMethodAdapter.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/AfterEachMethodAdapter.java index 32fa951c6330..79443ee7d4be 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/AfterEachMethodAdapter.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/AfterEachMethodAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/BeforeEachMethodAdapter.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/BeforeEachMethodAdapter.java index 2ab5db2695c2..2b4ea8658443 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/BeforeEachMethodAdapter.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/BeforeEachMethodAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ConditionEvaluationException.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ConditionEvaluationException.java index e44bf3f2322c..7b9a948205c2 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ConditionEvaluationException.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ConditionEvaluationException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ConditionEvaluator.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ConditionEvaluator.java index 9c200e0d4423..e1e0a4a89617 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ConditionEvaluator.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ConditionEvaluator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ConstructorInvocation.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ConstructorInvocation.java index e2230d139430..79cbd46c6895 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ConstructorInvocation.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ConstructorInvocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/DefaultExecutableInvoker.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/DefaultExecutableInvoker.java index 18b4c6fdf9fd..226db46cf82d 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/DefaultExecutableInvoker.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/DefaultExecutableInvoker.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/DefaultParameterContext.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/DefaultParameterContext.java index 30b6af17126e..23d2ada54331 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/DefaultParameterContext.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/DefaultParameterContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/DefaultTestInstances.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/DefaultTestInstances.java index 3fec299191f9..60e09379531c 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/DefaultTestInstances.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/DefaultTestInstances.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java index 84c172765b93..c813687bb8b4 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ExtensionContextSupplier.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvoker.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvoker.java index a070f2808c05..9454d5829302 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvoker.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvoker.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/InvocationInterceptorChain.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/InvocationInterceptorChain.java index 1c49b1f60ca3..3b73cbc982e7 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/InvocationInterceptorChain.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/InvocationInterceptorChain.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/JupiterEngineExecutionContext.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/JupiterEngineExecutionContext.java index ab4a41b69182..dc099bea9f44 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/JupiterEngineExecutionContext.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/JupiterEngineExecutionContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/MethodInvocation.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/MethodInvocation.java index 302e6dcc556f..fb3f2e0c2810 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/MethodInvocation.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/MethodInvocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/NamespaceAwareStore.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/NamespaceAwareStore.java index 10a6e2b96b64..a39b4a189474 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/NamespaceAwareStore.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/NamespaceAwareStore.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ParameterResolutionUtils.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ParameterResolutionUtils.java index a677e87c62a2..65a4ddc0d38d 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ParameterResolutionUtils.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/ParameterResolutionUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/TestInstancesProvider.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/TestInstancesProvider.java index e8a87b3d88e2..723af1b807a1 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/TestInstancesProvider.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/execution/TestInstancesProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/AutoCloseExtension.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/AutoCloseExtension.java index 453e637701b0..07f10d636e4b 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/AutoCloseExtension.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/AutoCloseExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultPreInterruptContext.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultPreInterruptContext.java index 5dfb552d9412..0e4be93b94e2 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultPreInterruptContext.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultPreInterruptContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultRepetitionInfo.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultRepetitionInfo.java index 0141ecf77431..d9ecb54a3a68 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultRepetitionInfo.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultRepetitionInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultTestReporter.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultTestReporter.java index 4d9d9b354ee5..966bb7ef6744 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultTestReporter.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DefaultTestReporter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DisabledCondition.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DisabledCondition.java index 519aa7617d94..5dedc43e9107 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DisabledCondition.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/DisabledCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/ExtensionContextInternal.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/ExtensionContextInternal.java index 26a1f3f316aa..449c4adad00a 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/ExtensionContextInternal.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/ExtensionContextInternal.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/ExtensionRegistrar.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/ExtensionRegistrar.java index 3c4e90ed4d13..2822fa51ef99 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/ExtensionRegistrar.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/ExtensionRegistrar.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/ExtensionRegistry.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/ExtensionRegistry.java index ccd58b879006..f18d74c894ad 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/ExtensionRegistry.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/ExtensionRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/MutableExtensionRegistry.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/MutableExtensionRegistry.java index a9c62ca7fa98..eac99fe980f7 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/MutableExtensionRegistry.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/MutableExtensionRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptCallbackInvocation.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptCallbackInvocation.java index 290c3464ca2a..0484c0f788c4 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptCallbackInvocation.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptCallbackInvocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptCallbackInvocationFactory.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptCallbackInvocationFactory.java index a265a2435a76..992a1b721640 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptCallbackInvocationFactory.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptCallbackInvocationFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptThreadDumpPrinter.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptThreadDumpPrinter.java index eded2b8cd4f5..40fa9e03e3bf 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptThreadDumpPrinter.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptThreadDumpPrinter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepeatedTestDisplayNameFormatter.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepeatedTestDisplayNameFormatter.java index b351721e4971..3ce393cb2f75 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepeatedTestDisplayNameFormatter.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepeatedTestDisplayNameFormatter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepeatedTestExtension.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepeatedTestExtension.java index bb9d5d3f2c2b..efdcfdc8d679 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepeatedTestExtension.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepeatedTestExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepeatedTestInvocationContext.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepeatedTestInvocationContext.java index b40c3699e53c..b4f3f74e17b6 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepeatedTestInvocationContext.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepeatedTestInvocationContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepetitionExtension.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepetitionExtension.java index 6e1682db8ec6..b22d07419534 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepetitionExtension.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/RepetitionExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/SameThreadTimeoutInvocation.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/SameThreadTimeoutInvocation.java index 38d7526a7875..7a5a78ab1544 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/SameThreadTimeoutInvocation.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/SameThreadTimeoutInvocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/SeparateThreadTimeoutInvocation.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/SeparateThreadTimeoutInvocation.java index df176021f96e..5500f773720e 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/SeparateThreadTimeoutInvocation.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/SeparateThreadTimeoutInvocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java index c72802b9de24..b35dc58c20d8 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TempDirectory.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TestInfoParameterResolver.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TestInfoParameterResolver.java index 96b7a617db4b..ad6c7f8f2143 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TestInfoParameterResolver.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TestInfoParameterResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TestReporterParameterResolver.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TestReporterParameterResolver.java index 5427d8029cf9..7418341e2729 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TestReporterParameterResolver.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TestReporterParameterResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutConfiguration.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutConfiguration.java index 6238c0c4e1d7..60a8734db382 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutConfiguration.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutDuration.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutDuration.java index 977b6ba8f383..ac99448af8a9 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutDuration.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutDuration.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutDurationParser.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutDurationParser.java index 28f28e8ce72c..e5be5afefc3c 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutDurationParser.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutDurationParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutExceptionFactory.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutExceptionFactory.java index b76269ac6d59..41174c609857 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutExceptionFactory.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutExceptionFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutExtension.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutExtension.java index 44d0a402c387..f7fd783d077a 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutExtension.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactory.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactory.java index a782c8e6bee8..5e9b04c18ef8 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactory.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/support/JupiterThrowableCollectorFactory.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/support/JupiterThrowableCollectorFactory.java index bb06d12759a2..6c9eabb3a25e 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/support/JupiterThrowableCollectorFactory.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/support/JupiterThrowableCollectorFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/support/OpenTest4JAndJUnit4AwareThrowableCollector.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/support/OpenTest4JAndJUnit4AwareThrowableCollector.java index 938ffca39d23..11359f67b732 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/support/OpenTest4JAndJUnit4AwareThrowableCollector.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/support/OpenTest4JAndJUnit4AwareThrowableCollector.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-engine/src/testFixtures/java/org/junit/jupiter/engine/discovery/JupiterUniqueIdBuilder.java b/junit-jupiter-engine/src/testFixtures/java/org/junit/jupiter/engine/discovery/JupiterUniqueIdBuilder.java index 8f2699706b80..063d0527103f 100644 --- a/junit-jupiter-engine/src/testFixtures/java/org/junit/jupiter/engine/discovery/JupiterUniqueIdBuilder.java +++ b/junit-jupiter-engine/src/testFixtures/java/org/junit/jupiter/engine/discovery/JupiterUniqueIdBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/EnableJUnit4MigrationSupport.java b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/EnableJUnit4MigrationSupport.java index ed34832b0fbd..0c9c04778493 100644 --- a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/EnableJUnit4MigrationSupport.java +++ b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/EnableJUnit4MigrationSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/conditions/IgnoreCondition.java b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/conditions/IgnoreCondition.java index ca3e97d348d5..59ab33098a59 100644 --- a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/conditions/IgnoreCondition.java +++ b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/conditions/IgnoreCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/EnableRuleMigrationSupport.java b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/EnableRuleMigrationSupport.java index 4bd82f1d6488..243874b8265e 100644 --- a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/EnableRuleMigrationSupport.java +++ b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/EnableRuleMigrationSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/ExpectedExceptionSupport.java b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/ExpectedExceptionSupport.java index 3b15203a9ffe..adecfda66993 100644 --- a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/ExpectedExceptionSupport.java +++ b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/ExpectedExceptionSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupport.java b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupport.java index 8d9bae138aa6..347317733d4e 100644 --- a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupport.java +++ b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/TestRuleSupport.java b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/TestRuleSupport.java index 7b6697e1f44f..f424126d6fdd 100644 --- a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/TestRuleSupport.java +++ b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/TestRuleSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/VerifierSupport.java b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/VerifierSupport.java index 420e817061c9..a5025818722d 100644 --- a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/VerifierSupport.java +++ b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/VerifierSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/AbstractTestRuleAdapter.java b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/AbstractTestRuleAdapter.java index 9f82e6637b55..5c60dcf5df24 100644 --- a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/AbstractTestRuleAdapter.java +++ b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/AbstractTestRuleAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/ExpectedExceptionAdapter.java b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/ExpectedExceptionAdapter.java index 15c114b9dc39..1d8b52a427d1 100644 --- a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/ExpectedExceptionAdapter.java +++ b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/ExpectedExceptionAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/ExternalResourceAdapter.java b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/ExternalResourceAdapter.java index f35a5de25d2b..8891f75da60c 100644 --- a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/ExternalResourceAdapter.java +++ b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/ExternalResourceAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/GenericBeforeAndAfterAdvice.java b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/GenericBeforeAndAfterAdvice.java index 329086883026..6b6b885f905e 100644 --- a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/GenericBeforeAndAfterAdvice.java +++ b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/GenericBeforeAndAfterAdvice.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/VerifierAdapter.java b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/VerifierAdapter.java index 986e6894a4f7..b04de522b9a4 100644 --- a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/VerifierAdapter.java +++ b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/adapter/VerifierAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/AbstractTestRuleAnnotatedMember.java b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/AbstractTestRuleAnnotatedMember.java index f93dc00a97a1..be6ea055b87d 100644 --- a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/AbstractTestRuleAnnotatedMember.java +++ b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/AbstractTestRuleAnnotatedMember.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/TestRuleAnnotatedField.java b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/TestRuleAnnotatedField.java index 339c9ed47df4..5c68934d3ac4 100644 --- a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/TestRuleAnnotatedField.java +++ b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/TestRuleAnnotatedField.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/TestRuleAnnotatedMember.java b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/TestRuleAnnotatedMember.java index 48bed90147d8..0b959f53bdaf 100644 --- a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/TestRuleAnnotatedMember.java +++ b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/TestRuleAnnotatedMember.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/TestRuleAnnotatedMethod.java b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/TestRuleAnnotatedMethod.java index 78eac29ca94f..66a327370850 100644 --- a/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/TestRuleAnnotatedMethod.java +++ b/junit-jupiter-migrationsupport/src/main/java/org/junit/jupiter/migrationsupport/rules/member/TestRuleAnnotatedMethod.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/jmh/java/org/junit/jupiter/params/ParameterizedTestNameFormatterBenchmarks.java b/junit-jupiter-params/src/jmh/java/org/junit/jupiter/params/ParameterizedTestNameFormatterBenchmarks.java index 8c6605490ab8..dad2ce3e2115 100644 --- a/junit-jupiter-params/src/jmh/java/org/junit/jupiter/params/ParameterizedTestNameFormatterBenchmarks.java +++ b/junit-jupiter-params/src/jmh/java/org/junit/jupiter/params/ParameterizedTestNameFormatterBenchmarks.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ArgumentCountValidationMode.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ArgumentCountValidationMode.java index 38c9beb8982a..fe50db276cdf 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ArgumentCountValidationMode.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ArgumentCountValidationMode.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ArgumentCountValidator.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ArgumentCountValidator.java index 220825d9817a..42a1f48ea54c 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ArgumentCountValidator.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ArgumentCountValidator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java index 5dc2c3a88ad9..ce16337b45d2 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java index 023dd6fea6d2..9390c1fd3827 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestInvocationContext.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestInvocationContext.java index ab26b362c362..a6adfd3e5c5f 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestInvocationContext.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestInvocationContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java index 4c07e01f81ca..074b32a1b9cb 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestMethodContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestNameFormatter.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestNameFormatter.java index ecbea24fd04c..12cd141ec38c 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestNameFormatter.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestNameFormatter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestParameterResolver.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestParameterResolver.java index a0216cf548a7..d49cdc29284e 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestParameterResolver.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestParameterResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestSpiInstantiator.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestSpiInstantiator.java index fa4661f88b69..1545d292a062 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestSpiInstantiator.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/ParameterizedTestSpiInstantiator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/AggregateWith.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/AggregateWith.java index 0510e4df844a..e7fcca21eb50 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/AggregateWith.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/AggregateWith.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentAccessException.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentAccessException.java index 07e8b1b8070a..dbdad3cf0d7f 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentAccessException.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentAccessException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentsAccessor.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentsAccessor.java index 59b1710550f7..5e31a35d288c 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentsAccessor.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentsAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentsAggregationException.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentsAggregationException.java index cb9db4512211..f2c80d0910b7 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentsAggregationException.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentsAggregationException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentsAggregator.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentsAggregator.java index c82d12cda961..90ce75ddd048 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentsAggregator.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/ArgumentsAggregator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/DefaultArgumentsAccessor.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/DefaultArgumentsAccessor.java index 39ad3c33ca29..79e1f37999c1 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/DefaultArgumentsAccessor.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/aggregator/DefaultArgumentsAccessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/AnnotationBasedArgumentConverter.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/AnnotationBasedArgumentConverter.java index da892c22818d..b100f3ad4854 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/AnnotationBasedArgumentConverter.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/AnnotationBasedArgumentConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/ArgumentConversionException.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/ArgumentConversionException.java index dbcd5b4c1b28..358d6e122c74 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/ArgumentConversionException.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/ArgumentConversionException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/ArgumentConverter.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/ArgumentConverter.java index b18d96887069..78e4cc55e4d6 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/ArgumentConverter.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/ArgumentConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/ConvertWith.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/ConvertWith.java index b42145b39fa3..d9e7e4fb907d 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/ConvertWith.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/ConvertWith.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/DefaultArgumentConverter.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/DefaultArgumentConverter.java index c02fd58dba41..df77d1f759ac 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/DefaultArgumentConverter.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/DefaultArgumentConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/JavaTimeArgumentConverter.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/JavaTimeArgumentConverter.java index eb688ae3fd6b..6684b472ff18 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/JavaTimeArgumentConverter.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/JavaTimeArgumentConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/JavaTimeConversionPattern.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/JavaTimeConversionPattern.java index 3c8d26526d44..d4ab3110e629 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/JavaTimeConversionPattern.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/JavaTimeConversionPattern.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/SimpleArgumentConverter.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/SimpleArgumentConverter.java index b24c267e5394..dcf714f5cb84 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/SimpleArgumentConverter.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/SimpleArgumentConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/TypedArgumentConverter.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/TypedArgumentConverter.java index bb3c65c009b5..f229572a2a75 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/TypedArgumentConverter.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/converter/TypedArgumentConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/AnnotationBasedArgumentsProvider.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/AnnotationBasedArgumentsProvider.java index f751b35e3c5c..b8ecb2f374dc 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/AnnotationBasedArgumentsProvider.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/AnnotationBasedArgumentsProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/Arguments.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/Arguments.java index 94b82972d1b4..bb525eb94648 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/Arguments.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/Arguments.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsProvider.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsProvider.java index c18d100ad3c5..253e99cbb149 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsProvider.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsSource.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsSource.java index d3996b704b78..7180cf80ea5a 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsSource.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsSources.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsSources.java index ea7dd0494da6..d40ff40ef6fc 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsSources.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsSources.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsUtils.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsUtils.java index 7d99a61cc738..105d85354079 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsUtils.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ArgumentsUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvArgumentsProvider.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvArgumentsProvider.java index a924cf637229..d248b2dd1cec 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvArgumentsProvider.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvArgumentsProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvFileArgumentsProvider.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvFileArgumentsProvider.java index 39d286408aa0..acc13160d544 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvFileArgumentsProvider.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvFileArgumentsProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvFileSource.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvFileSource.java index 77ad9245fc54..3c2c8c14a3f3 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvFileSource.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvFileSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvFileSources.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvFileSources.java index 92928d0ff715..c246d1000020 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvFileSources.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvFileSources.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvParserFactory.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvParserFactory.java index d7ffee880cbc..ba1b1c0c34ac 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvParserFactory.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvParserFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvParsingException.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvParsingException.java index e0d2275b15c4..b0db31d48b2f 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvParsingException.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvParsingException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvSource.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvSource.java index 6ee1c92e7c10..09732e2101f1 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvSource.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvSources.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvSources.java index 297a4a8ddda5..b5e48ab5de00 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvSources.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/CsvSources.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EmptyArgumentsProvider.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EmptyArgumentsProvider.java index 101e5bfc6916..18e9d7d6c7b1 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EmptyArgumentsProvider.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EmptyArgumentsProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EmptySource.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EmptySource.java index 780a91dee02a..fef989fc810d 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EmptySource.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EmptySource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumArgumentsProvider.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumArgumentsProvider.java index 0a525289e566..d339c59073d4 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumArgumentsProvider.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumArgumentsProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumSource.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumSource.java index 3bf7e9b88e5e..ddb790750dc6 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumSource.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumSources.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumSources.java index 6b1a30a68ed5..610589378783 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumSources.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumSources.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/FieldArgumentsProvider.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/FieldArgumentsProvider.java index 7116bda70dfa..8d02863a9e34 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/FieldArgumentsProvider.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/FieldArgumentsProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/FieldSource.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/FieldSource.java index 77680a00b7d1..8c2db1a90fb1 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/FieldSource.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/FieldSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/FieldSources.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/FieldSources.java index 36e9cd57d604..f0ca8ad87940 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/FieldSources.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/FieldSources.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/MethodArgumentsProvider.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/MethodArgumentsProvider.java index 9a7f1b8ca10e..3bfced72e817 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/MethodArgumentsProvider.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/MethodArgumentsProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/MethodSource.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/MethodSource.java index 977e7555a5d2..2ea6da4da72f 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/MethodSource.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/MethodSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/MethodSources.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/MethodSources.java index 33fa077567ee..605702827d2f 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/MethodSources.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/MethodSources.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/NullAndEmptySource.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/NullAndEmptySource.java index c5571d3e52f0..d38b2dff4ee4 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/NullAndEmptySource.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/NullAndEmptySource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/NullArgumentsProvider.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/NullArgumentsProvider.java index e654ed6b2b47..eef9d19990c6 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/NullArgumentsProvider.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/NullArgumentsProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/NullEnum.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/NullEnum.java index 1d722287b430..96089872b2db 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/NullEnum.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/NullEnum.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/NullSource.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/NullSource.java index f842cbde2a6c..3dce2cb097ad 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/NullSource.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/NullSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ValueArgumentsProvider.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ValueArgumentsProvider.java index e42d448a7415..39bc714671da 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ValueArgumentsProvider.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ValueArgumentsProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ValueSource.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ValueSource.java index bc0ed303e935..55d8c50aaa2c 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ValueSource.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ValueSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ValueSources.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ValueSources.java index 9b3a489c6a66..6d52255d9713 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ValueSources.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/ValueSources.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/support/AnnotationConsumer.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/support/AnnotationConsumer.java index 6d53313477ec..7549a1c6450f 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/support/AnnotationConsumer.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/support/AnnotationConsumer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/support/AnnotationConsumerInitializer.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/support/AnnotationConsumerInitializer.java index 3efe78d96319..27f6b52853d7 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/support/AnnotationConsumerInitializer.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/support/AnnotationConsumerInitializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-jupiter-params/src/main/kotlin/org/junit/jupiter/params/aggregator/ArgumentsAccessor.kt b/junit-jupiter-params/src/main/kotlin/org/junit/jupiter/params/aggregator/ArgumentsAccessor.kt index 0c27b52ec08a..7d06dc0aa071 100644 --- a/junit-jupiter-params/src/main/kotlin/org/junit/jupiter/params/aggregator/ArgumentsAccessor.kt +++ b/junit-jupiter-params/src/main/kotlin/org/junit/jupiter/params/aggregator/ArgumentsAccessor.kt @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/JUnitException.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/JUnitException.java index 1b8bf98a7f1e..c09c739bc087 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/JUnitException.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/JUnitException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/PreconditionViolationException.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/PreconditionViolationException.java index 1c2f63ac5967..4ae58db3adec 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/PreconditionViolationException.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/PreconditionViolationException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/annotation/Testable.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/annotation/Testable.java index 0adb7c211964..233f712b6156 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/annotation/Testable.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/annotation/Testable.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/function/Try.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/function/Try.java index 84d5c7a173e9..04403c18a34d 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/function/Try.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/function/Try.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/logging/LogRecordListener.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/logging/LogRecordListener.java index 1368ab3d834e..22a53d59453b 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/logging/LogRecordListener.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/logging/LogRecordListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/logging/Logger.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/logging/Logger.java index 016317e7289c..09d4d3c93918 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/logging/Logger.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/logging/Logger.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/logging/LoggerFactory.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/logging/LoggerFactory.java index eabab7e93ae6..c6b3ce3b44e4 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/logging/LoggerFactory.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/logging/LoggerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/AnnotationSupport.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/AnnotationSupport.java index 92ee263134c8..2ef21ac9d0c3 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/AnnotationSupport.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/AnnotationSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ClassSupport.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ClassSupport.java index afd5d7583404..f7b7b1ff32f1 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ClassSupport.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ClassSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/DefaultResource.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/DefaultResource.java index 31e1a9eb9972..26df8c0f876c 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/DefaultResource.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/DefaultResource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/HierarchyTraversalMode.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/HierarchyTraversalMode.java index 7d3aaa26e604..9a424d64e427 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/HierarchyTraversalMode.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/HierarchyTraversalMode.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ModifierSupport.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ModifierSupport.java index da57dcb22986..21302c9f24b0 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ModifierSupport.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ModifierSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ReflectionSupport.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ReflectionSupport.java index 13ae4a640a37..700fcb3d53fc 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ReflectionSupport.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ReflectionSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/Resource.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/Resource.java index c9587c3a5ca6..da3d6df59fd1 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/Resource.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/Resource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/SearchOption.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/SearchOption.java index 8ade7401ed45..a4d21d210871 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/SearchOption.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/SearchOption.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/ConversionException.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/ConversionException.java index 54ddc8e11093..1e3474d27c6c 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/ConversionException.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/ConversionException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/ConversionSupport.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/ConversionSupport.java index 8845d617c7e0..fa95826f5ddd 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/ConversionSupport.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/ConversionSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/FallbackStringToObjectConverter.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/FallbackStringToObjectConverter.java index a7b86052d779..aeea2d9e119d 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/FallbackStringToObjectConverter.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/FallbackStringToObjectConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToBooleanConverter.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToBooleanConverter.java index fcab61e3a468..4bfefc7b48b1 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToBooleanConverter.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToBooleanConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToCharacterConverter.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToCharacterConverter.java index 548819a2641d..0f5729a228fc 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToCharacterConverter.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToCharacterConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToClassConverter.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToClassConverter.java index 882feb0ff78e..ad16fb18edf3 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToClassConverter.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToClassConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToCommonJavaTypesConverter.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToCommonJavaTypesConverter.java index f89e67b5fc38..17aa357439ae 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToCommonJavaTypesConverter.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToCommonJavaTypesConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToEnumConverter.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToEnumConverter.java index 087bb653a974..ee18f8f8b1e3 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToEnumConverter.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToEnumConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToJavaTimeConverter.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToJavaTimeConverter.java index 753cfba69d89..0e544f39a3a4 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToJavaTimeConverter.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToJavaTimeConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToNumberConverter.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToNumberConverter.java index 55c373f7153c..21a7a0fc2e62 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToNumberConverter.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToNumberConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToObjectConverter.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToObjectConverter.java index b4247f0af832..ceb00e2e95d8 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToObjectConverter.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/conversion/StringToObjectConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClassFilter.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClassFilter.java index 4e222c89f683..c8bc48b6b0a4 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClassFilter.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClassFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathFileVisitor.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathFileVisitor.java index e29a6c11cac2..2bc01963da99 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathFileVisitor.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathFileVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathFilters.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathFilters.java index ea461d7d6abe..0ce211f5f924 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathFilters.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathFilters.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathScanner.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathScanner.java index ed1daabf2c69..344863ad6dac 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathScanner.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/ClasspathScanner.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/CloseablePath.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/CloseablePath.java index d299a3a7a495..0cb4977d9477 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/CloseablePath.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/CloseablePath.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/DefaultClasspathScanner.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/DefaultClasspathScanner.java index 0d0c04eeee0a..de9ec7de7b66 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/DefaultClasspathScanner.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/scanning/DefaultClasspathScanner.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/AnnotationUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/AnnotationUtils.java index 5e7157b45c9b..15d47bb253ce 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/AnnotationUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/AnnotationUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/BlacklistedExceptions.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/BlacklistedExceptions.java index e03fa9d54029..f51c6ca8fc75 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/BlacklistedExceptions.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/BlacklistedExceptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClassLoaderUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClassLoaderUtils.java index d90942e77c84..0c4f4eba8cca 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClassLoaderUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClassLoaderUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClassNamePatternFilterUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClassNamePatternFilterUtils.java index 9574477400ee..efca1d2dcdb6 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClassNamePatternFilterUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClassNamePatternFilterUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClassUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClassUtils.java index 720df1994b93..9fc01426c2f6 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClassUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClassUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathScannerLoader.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathScannerLoader.java index 6a2240815605..67c919d930b2 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathScannerLoader.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ClasspathScannerLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/CollectionUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/CollectionUtils.java index 20061af9fd2e..947e4c434998 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/CollectionUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/CollectionUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ExceptionUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ExceptionUtils.java index b4493a76f64f..c2056951ddf8 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ExceptionUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ExceptionUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/FunctionUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/FunctionUtils.java index 4231c77588e0..9546914e2c6a 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/FunctionUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/FunctionUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/LruCache.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/LruCache.java index 1598826739e9..83a56c172608 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/LruCache.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/LruCache.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ModuleUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ModuleUtils.java index 54da1d85af11..980c06394ea2 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ModuleUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ModuleUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/PackageNameUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/PackageNameUtils.java index 9a018363a4a1..2a0094dda4c4 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/PackageNameUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/PackageNameUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/PackageUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/PackageUtils.java index e83f42af02f4..884587c2928d 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/PackageUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/PackageUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/PreconditionViolationException.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/PreconditionViolationException.java index 208db0f299c9..e28c0372d53a 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/PreconditionViolationException.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/PreconditionViolationException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/Preconditions.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/Preconditions.java index 33ecd1e91c08..99c8ae49e6e6 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/Preconditions.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/Preconditions.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java index 3f8a23d2857d..53dc2fbc213d 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ResourceUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ResourceUtils.java index fd6b78e3223e..fd7abb29b638 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ResourceUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ResourceUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/RuntimeUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/RuntimeUtils.java index 786c5997b2d2..e738aea49d8c 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/RuntimeUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/RuntimeUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ServiceLoaderUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ServiceLoaderUtils.java index 89441d68a3f1..ce006d770099 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ServiceLoaderUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ServiceLoaderUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/StringUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/StringUtils.java index 0b45e4ed637a..9989cb33a93b 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/StringUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/StringUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ToStringBuilder.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ToStringBuilder.java index f16e23bd4cdf..eabaf3dcc09a 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ToStringBuilder.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ToStringBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/UnrecoverableExceptions.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/UnrecoverableExceptions.java index 1235a329450d..23589c2a1672 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/UnrecoverableExceptions.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/UnrecoverableExceptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java9/org/junit/platform/commons/util/ModuleUtils.java b/junit-platform-commons/src/main/java9/org/junit/platform/commons/util/ModuleUtils.java index fe83af684518..9f20d964f471 100644 --- a/junit-platform-commons/src/main/java9/org/junit/platform/commons/util/ModuleUtils.java +++ b/junit-platform-commons/src/main/java9/org/junit/platform/commons/util/ModuleUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java9/org/junit/platform/commons/util/PackageNameUtils.java b/junit-platform-commons/src/main/java9/org/junit/platform/commons/util/PackageNameUtils.java index 84afaf736290..0cb6aec9e8d8 100644 --- a/junit-platform-commons/src/main/java9/org/junit/platform/commons/util/PackageNameUtils.java +++ b/junit-platform-commons/src/main/java9/org/junit/platform/commons/util/PackageNameUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/main/java9/org/junit/platform/commons/util/ServiceLoaderUtils.java b/junit-platform-commons/src/main/java9/org/junit/platform/commons/util/ServiceLoaderUtils.java index 426658a3e2ed..878c62a2c7e7 100644 --- a/junit-platform-commons/src/main/java9/org/junit/platform/commons/util/ServiceLoaderUtils.java +++ b/junit-platform-commons/src/main/java9/org/junit/platform/commons/util/ServiceLoaderUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/testFixtures/java/org/junit/platform/commons/test/ConcurrencyTestingUtils.java b/junit-platform-commons/src/testFixtures/java/org/junit/platform/commons/test/ConcurrencyTestingUtils.java index 69f22ef08c40..e0ae6d6c762e 100644 --- a/junit-platform-commons/src/testFixtures/java/org/junit/platform/commons/test/ConcurrencyTestingUtils.java +++ b/junit-platform-commons/src/testFixtures/java/org/junit/platform/commons/test/ConcurrencyTestingUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-commons/src/testFixtures/java/org/junit/platform/commons/test/TestClassLoader.java b/junit-platform-commons/src/testFixtures/java/org/junit/platform/commons/test/TestClassLoader.java index 62965ffc25df..bdf6aa2521d3 100644 --- a/junit-platform-commons/src/testFixtures/java/org/junit/platform/commons/test/TestClassLoader.java +++ b/junit-platform-commons/src/testFixtures/java/org/junit/platform/commons/test/TestClassLoader.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/ConsoleLauncher.java b/junit-platform-console/src/main/java/org/junit/platform/console/ConsoleLauncher.java index 54345f061e2e..240d6216f61e 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/ConsoleLauncher.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/ConsoleLauncher.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/AnsiColorOptionMixin.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/AnsiColorOptionMixin.java index 19a29afac5e7..dfeb690544fc 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/AnsiColorOptionMixin.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/AnsiColorOptionMixin.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/BannerOptionMixin.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/BannerOptionMixin.java index 0517b760ab48..813bb0937d29 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/BannerOptionMixin.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/BannerOptionMixin.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/BaseCommand.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/BaseCommand.java index d484b182399f..51d29e0c157b 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/BaseCommand.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/BaseCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/ClasspathEntriesConverter.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/ClasspathEntriesConverter.java index fcc4524df029..123edba1bb7a 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/ClasspathEntriesConverter.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/ClasspathEntriesConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/CommandFacade.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/CommandFacade.java index b1690e279c96..4409fb6ef762 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/CommandFacade.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/CommandFacade.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/CommandResult.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/CommandResult.java index 6fe178fc627b..147029e80f1d 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/CommandResult.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/CommandResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/ConsoleUtils.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/ConsoleUtils.java index 1ff644aabd38..ed82e426dca0 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/ConsoleUtils.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/ConsoleUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/Details.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/Details.java index 8371fa1a7644..19008f76425c 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/Details.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/Details.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/DiscoverTestsCommand.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/DiscoverTestsCommand.java index e1ff06004689..42e476f0a472 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/DiscoverTestsCommand.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/DiscoverTestsCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/ExecuteTestsCommand.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/ExecuteTestsCommand.java index 93e083217de9..caa0340cb76f 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/ExecuteTestsCommand.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/ExecuteTestsCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/ListTestEnginesCommand.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/ListTestEnginesCommand.java index 875bef485f78..42cfde790699 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/ListTestEnginesCommand.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/ListTestEnginesCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/MainCommand.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/MainCommand.java index 941a4976ea3e..cb186813b716 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/MainCommand.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/MainCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/ManifestVersionProvider.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/ManifestVersionProvider.java index 9b254727fa2f..8f41f9f8c894 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/ManifestVersionProvider.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/ManifestVersionProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/OutputStreamConfig.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/OutputStreamConfig.java index dd72ed9e9f0b..8925bddf2f77 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/OutputStreamConfig.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/OutputStreamConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/SelectorConverter.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/SelectorConverter.java index 0ef1351722cb..9f0c139d2c4a 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/SelectorConverter.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/SelectorConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/TestConsoleOutputOptions.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/TestConsoleOutputOptions.java index c0ff2aa5b77d..06067a1022f5 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/TestConsoleOutputOptions.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/TestConsoleOutputOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/TestConsoleOutputOptionsMixin.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/TestConsoleOutputOptionsMixin.java index a9f5d00d646e..44ee07588e4a 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/TestConsoleOutputOptionsMixin.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/TestConsoleOutputOptionsMixin.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptions.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptions.java index cf6388764669..06278aace90f 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptions.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptionsMixin.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptionsMixin.java index 73e0b61e0d67..3f91263094b9 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptionsMixin.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptionsMixin.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/options/Theme.java b/junit-platform-console/src/main/java/org/junit/platform/console/options/Theme.java index b41aaea1f55c..83d75d08fc8f 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/options/Theme.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/options/Theme.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/ColorPalette.java b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/ColorPalette.java index 790d90a61e44..7ff8e3f6809b 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/ColorPalette.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/ColorPalette.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/ConsoleTestExecutor.java b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/ConsoleTestExecutor.java index d7dc8f8aacff..ab64005eded8 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/ConsoleTestExecutor.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/ConsoleTestExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/CustomContextClassLoaderExecutor.java b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/CustomContextClassLoaderExecutor.java index 470a983bedf7..0313fe16ca5c 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/CustomContextClassLoaderExecutor.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/CustomContextClassLoaderExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/DetailsPrintingListener.java b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/DetailsPrintingListener.java index fc2fbd25da5b..b0e895e70dd9 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/DetailsPrintingListener.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/DetailsPrintingListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/DiscoveryRequestCreator.java b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/DiscoveryRequestCreator.java index 25af8a62a0d7..75934df963ac 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/DiscoveryRequestCreator.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/DiscoveryRequestCreator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/FlatPrintingListener.java b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/FlatPrintingListener.java index c6a50c6349c2..f1b0e755b2a2 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/FlatPrintingListener.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/FlatPrintingListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/Style.java b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/Style.java index abc1cdd2ce87..72b2dc83ff22 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/Style.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/Style.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TestFeedPrintingListener.java b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TestFeedPrintingListener.java index f58841d3578c..f0be524edaab 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TestFeedPrintingListener.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TestFeedPrintingListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreeNode.java b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreeNode.java index fb119bbfa0f0..e60a07146fa2 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreeNode.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreeNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreePrinter.java b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreePrinter.java index 7d078c34da7f..c1997f52d342 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreePrinter.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreePrinter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreePrintingListener.java b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreePrintingListener.java index 34a3b3300b49..49ec53d48ec8 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreePrintingListener.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/TreePrintingListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/VerboseTreePrintingListener.java b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/VerboseTreePrintingListener.java index bf247ff5e1a1..103621853033 100644 --- a/junit-platform-console/src/main/java/org/junit/platform/console/tasks/VerboseTreePrintingListener.java +++ b/junit-platform-console/src/main/java/org/junit/platform/console/tasks/VerboseTreePrintingListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java17/org/junit/platform/console/options/ConsoleUtils.java b/junit-platform-console/src/main/java17/org/junit/platform/console/options/ConsoleUtils.java index f44f94b41e69..145ebed63fd4 100644 --- a/junit-platform-console/src/main/java17/org/junit/platform/console/options/ConsoleUtils.java +++ b/junit-platform-console/src/main/java17/org/junit/platform/console/options/ConsoleUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-console/src/main/java9/org/junit/platform/console/ConsoleLauncherToolProvider.java b/junit-platform-console/src/main/java9/org/junit/platform/console/ConsoleLauncherToolProvider.java index 5783bff33454..0291a0bf0fdf 100644 --- a/junit-platform-console/src/main/java9/org/junit/platform/console/ConsoleLauncherToolProvider.java +++ b/junit-platform-console/src/main/java9/org/junit/platform/console/ConsoleLauncherToolProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/CompositeFilter.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/CompositeFilter.java index 3ab3e6d2f554..6a29af05e7bf 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/CompositeFilter.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/CompositeFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/ConfigurationParameters.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/ConfigurationParameters.java index 498971894992..c28f9229d9ce 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/ConfigurationParameters.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/ConfigurationParameters.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/DiscoveryFilter.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/DiscoveryFilter.java index 7872867244d0..03b5ce65dd7c 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/DiscoveryFilter.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/DiscoveryFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/DiscoverySelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/DiscoverySelector.java index d3faa984fd5f..5284d19ee03e 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/DiscoverySelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/DiscoverySelector.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/DiscoverySelectorIdentifier.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/DiscoverySelectorIdentifier.java index 7f4f8e21138f..0a24baa5f0fe 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/DiscoverySelectorIdentifier.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/DiscoverySelectorIdentifier.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/EngineDiscoveryListener.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/EngineDiscoveryListener.java index f5683f5e67a1..e6af6982e72f 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/EngineDiscoveryListener.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/EngineDiscoveryListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/EngineDiscoveryRequest.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/EngineDiscoveryRequest.java index 3aa9cd5256b5..447790814427 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/EngineDiscoveryRequest.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/EngineDiscoveryRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/EngineExecutionListener.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/EngineExecutionListener.java index c5fe614fc6b6..8affe7aad78c 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/EngineExecutionListener.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/EngineExecutionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/ExecutionRequest.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/ExecutionRequest.java index 64bdc62cb37d..affe5464a184 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/ExecutionRequest.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/ExecutionRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/Filter.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/Filter.java index a18244ee411b..b500a1320a2b 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/Filter.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/Filter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/FilterResult.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/FilterResult.java index 81970ac3daaa..b2bfae49122b 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/FilterResult.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/FilterResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/SelectorResolutionResult.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/SelectorResolutionResult.java index 087ed1e93fd7..80bb8ef0725a 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/SelectorResolutionResult.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/SelectorResolutionResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/TestDescriptor.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/TestDescriptor.java index c1f09a6b4c14..0d3df349bffa 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/TestDescriptor.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/TestDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/TestEngine.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/TestEngine.java index 67122ccc9a72..877beaa26411 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/TestEngine.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/TestEngine.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/TestExecutionResult.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/TestExecutionResult.java index b3a4b280e36d..4bd69d935d05 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/TestExecutionResult.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/TestExecutionResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/TestSource.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/TestSource.java index c10479314dfc..136a3bfe929c 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/TestSource.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/TestSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/TestTag.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/TestTag.java index 956da67c8742..ba0834df4dfa 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/TestTag.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/TestTag.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/UniqueId.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/UniqueId.java index fda16880eeda..acd4fe3d4d2c 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/UniqueId.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/UniqueId.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/UniqueIdFormat.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/UniqueIdFormat.java index cbae6c62a863..2aaebf38eb18 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/UniqueIdFormat.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/UniqueIdFormat.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/AbstractClassNameFilter.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/AbstractClassNameFilter.java index b6de7748547f..ae047beed04c 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/AbstractClassNameFilter.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/AbstractClassNameFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClassNameFilter.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClassNameFilter.java index 9d41c36b3f6e..c742daee1410 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClassNameFilter.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClassNameFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClassSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClassSelector.java index f1dda935b88d..38c412c1e5c1 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClassSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClassSelector.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClasspathResourceSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClasspathResourceSelector.java index 4b591a38684e..d703b5da7d2b 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClasspathResourceSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClasspathResourceSelector.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClasspathRootSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClasspathRootSelector.java index 7e41b9ba4310..133572b909ff 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClasspathRootSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ClasspathRootSelector.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DirectorySelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DirectorySelector.java index 77a18048dfde..fe74b2a1fdc8 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DirectorySelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DirectorySelector.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectorIdentifierParser.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectorIdentifierParser.java index 071e6b09263d..a643a21d89fc 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectorIdentifierParser.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectorIdentifierParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectorIdentifierParsers.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectorIdentifierParsers.java index 7d379a4fce52..0f2d195eeb8d 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectorIdentifierParsers.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectorIdentifierParsers.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectors.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectors.java index 28dda12b3a76..299204c35677 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectors.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/DiscoverySelectors.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ExcludeClassNameFilter.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ExcludeClassNameFilter.java index 9ba34a78d35d..3a1733d00775 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ExcludeClassNameFilter.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ExcludeClassNameFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ExcludePackageNameFilter.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ExcludePackageNameFilter.java index 430234ea38da..eb649b634c3f 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ExcludePackageNameFilter.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ExcludePackageNameFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/FilePosition.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/FilePosition.java index 41a125472cb4..48cb72eb7e73 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/FilePosition.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/FilePosition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/FileSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/FileSelector.java index 7cb12802f1d6..80333c12af9d 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/FileSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/FileSelector.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/IncludeClassNameFilter.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/IncludeClassNameFilter.java index 4d69e22a9de3..8e233bb002fd 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/IncludeClassNameFilter.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/IncludeClassNameFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/IncludePackageNameFilter.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/IncludePackageNameFilter.java index 54e554fb3586..322f840ae94d 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/IncludePackageNameFilter.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/IncludePackageNameFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/IterationSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/IterationSelector.java index c5060aed467a..dd603097263b 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/IterationSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/IterationSelector.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/MethodSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/MethodSelector.java index c2df7e1af657..2bbe3ca08411 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/MethodSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/MethodSelector.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ModuleSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ModuleSelector.java index 140610901155..0cac7f2e3bfe 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ModuleSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/ModuleSelector.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/NestedClassSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/NestedClassSelector.java index 5c0ae7a542cb..c61f68d6df18 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/NestedClassSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/NestedClassSelector.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/NestedMethodSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/NestedMethodSelector.java index ff117ca99be7..e359547a0e30 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/NestedMethodSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/NestedMethodSelector.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/PackageNameFilter.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/PackageNameFilter.java index 082cf82a6d11..ecbd3f2d520a 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/PackageNameFilter.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/PackageNameFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/PackageSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/PackageSelector.java index 21801c7c21ad..8f84886873cf 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/PackageSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/PackageSelector.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/UniqueIdSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/UniqueIdSelector.java index 4c0a00ade87c..ebf1e35697ba 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/UniqueIdSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/UniqueIdSelector.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/UriSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/UriSelector.java index eb18583a93da..1c7b635a915e 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/UriSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/UriSelector.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/FileEntry.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/FileEntry.java index 8ba69a748ef3..13ad5f022b52 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/FileEntry.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/FileEntry.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/OutputDirectoryProvider.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/OutputDirectoryProvider.java index 5bb83fc77dc9..6fcfb80addff 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/OutputDirectoryProvider.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/OutputDirectoryProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/ReportEntry.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/ReportEntry.java index f091e0984ecc..bdea0b7a9568 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/ReportEntry.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/reporting/ReportEntry.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/config/PrefixedConfigurationParameters.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/config/PrefixedConfigurationParameters.java index 53603e8598fe..31454eca91cd 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/config/PrefixedConfigurationParameters.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/config/PrefixedConfigurationParameters.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/AbstractTestDescriptor.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/AbstractTestDescriptor.java index 668456e49f32..e8bc7920792c 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/AbstractTestDescriptor.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/AbstractTestDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/ClassSource.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/ClassSource.java index f5833e11cb1a..186cf149b07d 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/ClassSource.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/ClassSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/ClasspathResourceSource.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/ClasspathResourceSource.java index e326a3343a58..a49f65ed040b 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/ClasspathResourceSource.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/ClasspathResourceSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/CompositeTestSource.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/CompositeTestSource.java index adfdb8669730..43a396a221b5 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/CompositeTestSource.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/CompositeTestSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/DefaultUriSource.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/DefaultUriSource.java index 91a77ee6afa8..54ae69de460a 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/DefaultUriSource.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/DefaultUriSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/DirectorySource.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/DirectorySource.java index 5c719d17dea0..04cc46369d5f 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/DirectorySource.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/DirectorySource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/EngineDescriptor.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/EngineDescriptor.java index 7fef1aae35b5..0e8e55a78a2f 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/EngineDescriptor.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/EngineDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/FilePosition.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/FilePosition.java index ddff0d98e898..859006090008 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/FilePosition.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/FilePosition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/FileSource.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/FileSource.java index d7b4b74d8bab..0e6e42acba94 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/FileSource.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/FileSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/FileSystemSource.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/FileSystemSource.java index 5a338cde508e..2087be665406 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/FileSystemSource.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/FileSystemSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/MethodSource.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/MethodSource.java index 6c89a9db4432..3f2f876a49ba 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/MethodSource.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/MethodSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/PackageSource.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/PackageSource.java index ab78956614af..c6bca4e9c0ff 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/PackageSource.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/PackageSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/UriSource.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/UriSource.java index fef3e61b5db7..58efdba0a566 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/UriSource.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/descriptor/UriSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/ClassContainerSelectorResolver.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/ClassContainerSelectorResolver.java index c8e9b1843476..6c383e418847 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/ClassContainerSelectorResolver.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/ClassContainerSelectorResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/EngineDiscoveryRequestResolution.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/EngineDiscoveryRequestResolution.java index c1a6169293e6..36a939414a7d 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/EngineDiscoveryRequestResolution.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/EngineDiscoveryRequestResolution.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/EngineDiscoveryRequestResolver.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/EngineDiscoveryRequestResolver.java index 277bd119cb24..5ec9b333b206 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/EngineDiscoveryRequestResolver.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/EngineDiscoveryRequestResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/ResourceContainerSelectorResolver.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/ResourceContainerSelectorResolver.java index e5c41492b999..34beef727045 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/ResourceContainerSelectorResolver.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/ResourceContainerSelectorResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/ResourceUtils.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/ResourceUtils.java index 02bcd3656c2a..127b2503952d 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/ResourceUtils.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/ResourceUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/SelectorResolver.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/SelectorResolver.java index 4685fb9b48c9..a402a4679152 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/SelectorResolver.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/discovery/SelectorResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/filter/ClasspathScanningSupport.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/filter/ClasspathScanningSupport.java index 12361024de15..1eabfbdd8475 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/filter/ClasspathScanningSupport.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/filter/ClasspathScanningSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/CompositeLock.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/CompositeLock.java index aff3111df90b..76dbbb6b984c 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/CompositeLock.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/CompositeLock.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/DefaultParallelExecutionConfiguration.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/DefaultParallelExecutionConfiguration.java index cb91d2a84639..c766436ccc98 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/DefaultParallelExecutionConfiguration.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/DefaultParallelExecutionConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/DefaultParallelExecutionConfigurationStrategy.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/DefaultParallelExecutionConfigurationStrategy.java index b8883dd2a941..304c9e943f58 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/DefaultParallelExecutionConfigurationStrategy.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/DefaultParallelExecutionConfigurationStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/EngineExecutionContext.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/EngineExecutionContext.java index bfc78c472970..4f8ccca9d8be 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/EngineExecutionContext.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/EngineExecutionContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ExclusiveResource.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ExclusiveResource.java index 621fe2ed211b..3373f9259f4e 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ExclusiveResource.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ExclusiveResource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorService.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorService.java index fc0aae08f68c..9ccb3747680f 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorService.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorService.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestEngine.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestEngine.java index c80aa81aeed3..92cb86129952 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestEngine.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestEngine.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestExecutor.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestExecutor.java index 9f5da42f82a3..3ce7e541cf43 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestExecutor.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestExecutorService.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestExecutorService.java index e69b5dc30330..d879aa2b5978 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestExecutorService.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestExecutorService.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/LockManager.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/LockManager.java index 8e055cab7f36..988d52efb69e 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/LockManager.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/LockManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/Node.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/Node.java index 1726ae2e1965..f2616e60a6cb 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/Node.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/Node.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeExecutionAdvisor.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeExecutionAdvisor.java index eb95daab0237..050cd065163f 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeExecutionAdvisor.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeExecutionAdvisor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTestTask.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTestTask.java index 8e602b990ba9..39011dab7162 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTestTask.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTestTask.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTestTaskContext.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTestTaskContext.java index 6b1e6dfd8852..a6298847d59a 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTestTaskContext.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTestTaskContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalker.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalker.java index ada030923b76..1f95c6233b5b 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalker.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalker.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeUtils.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeUtils.java index b2807378a05d..4f916837c32c 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeUtils.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NodeUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NopLock.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NopLock.java index 7cdd79592d53..ea43494c2b57 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NopLock.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/NopLock.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/OpenTest4JAwareThrowableCollector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/OpenTest4JAwareThrowableCollector.java index 52f8e2f0ea1e..d925e0bf384a 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/OpenTest4JAwareThrowableCollector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/OpenTest4JAwareThrowableCollector.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionConfiguration.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionConfiguration.java index adde417cbdd3..15f9a3184e7e 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionConfiguration.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionConfigurationStrategy.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionConfigurationStrategy.java index 549ce71c694b..68760af8b982 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionConfigurationStrategy.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionConfigurationStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ResourceLock.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ResourceLock.java index 7e10c3ba7941..4f62637aa6ef 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ResourceLock.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ResourceLock.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SameThreadHierarchicalTestExecutorService.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SameThreadHierarchicalTestExecutorService.java index f18652d5d4bc..d6293ed7874b 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SameThreadHierarchicalTestExecutorService.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SameThreadHierarchicalTestExecutorService.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleLock.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleLock.java index cfa9d2f3acf0..bd5358bfab08 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleLock.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleLock.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleTestExecutor.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleTestExecutor.java index 7765d4b5ed92..3aa0ab4aea6b 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleTestExecutor.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/SingleTestExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ThrowableCollector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ThrowableCollector.java index e8187134671a..88e83cdb9ed5 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ThrowableCollector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/hierarchical/ThrowableCollector.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/store/NamespacedHierarchicalStore.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/store/NamespacedHierarchicalStore.java index 79836ac6f501..9167dde42b13 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/store/NamespacedHierarchicalStore.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/store/NamespacedHierarchicalStore.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/store/NamespacedHierarchicalStoreException.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/store/NamespacedHierarchicalStoreException.java index bf9dfefa1d16..2e67f3d203f4 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/support/store/NamespacedHierarchicalStoreException.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/support/store/NamespacedHierarchicalStoreException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/testFixtures/java/org/junit/platform/engine/support/hierarchical/DemoEngineExecutionContext.java b/junit-platform-engine/src/testFixtures/java/org/junit/platform/engine/support/hierarchical/DemoEngineExecutionContext.java index e6cf952390a2..2bb72762e96d 100644 --- a/junit-platform-engine/src/testFixtures/java/org/junit/platform/engine/support/hierarchical/DemoEngineExecutionContext.java +++ b/junit-platform-engine/src/testFixtures/java/org/junit/platform/engine/support/hierarchical/DemoEngineExecutionContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/testFixtures/java/org/junit/platform/engine/support/hierarchical/DemoHierarchicalContainerDescriptor.java b/junit-platform-engine/src/testFixtures/java/org/junit/platform/engine/support/hierarchical/DemoHierarchicalContainerDescriptor.java index 0361e8c9dcb9..00ead8e16784 100644 --- a/junit-platform-engine/src/testFixtures/java/org/junit/platform/engine/support/hierarchical/DemoHierarchicalContainerDescriptor.java +++ b/junit-platform-engine/src/testFixtures/java/org/junit/platform/engine/support/hierarchical/DemoHierarchicalContainerDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/testFixtures/java/org/junit/platform/engine/support/hierarchical/DemoHierarchicalEngineDescriptor.java b/junit-platform-engine/src/testFixtures/java/org/junit/platform/engine/support/hierarchical/DemoHierarchicalEngineDescriptor.java index 8da648cc3249..5dd40c886bbb 100644 --- a/junit-platform-engine/src/testFixtures/java/org/junit/platform/engine/support/hierarchical/DemoHierarchicalEngineDescriptor.java +++ b/junit-platform-engine/src/testFixtures/java/org/junit/platform/engine/support/hierarchical/DemoHierarchicalEngineDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/testFixtures/java/org/junit/platform/engine/support/hierarchical/DemoHierarchicalTestDescriptor.java b/junit-platform-engine/src/testFixtures/java/org/junit/platform/engine/support/hierarchical/DemoHierarchicalTestDescriptor.java index aaaf64b540de..29b57733512a 100644 --- a/junit-platform-engine/src/testFixtures/java/org/junit/platform/engine/support/hierarchical/DemoHierarchicalTestDescriptor.java +++ b/junit-platform-engine/src/testFixtures/java/org/junit/platform/engine/support/hierarchical/DemoHierarchicalTestDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/testFixtures/java/org/junit/platform/engine/support/hierarchical/DemoHierarchicalTestEngine.java b/junit-platform-engine/src/testFixtures/java/org/junit/platform/engine/support/hierarchical/DemoHierarchicalTestEngine.java index 61656c6b476e..ff5e32299dde 100644 --- a/junit-platform-engine/src/testFixtures/java/org/junit/platform/engine/support/hierarchical/DemoHierarchicalTestEngine.java +++ b/junit-platform-engine/src/testFixtures/java/org/junit/platform/engine/support/hierarchical/DemoHierarchicalTestEngine.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/testFixtures/java/org/junit/platform/fakes/TestDescriptorStub.java b/junit-platform-engine/src/testFixtures/java/org/junit/platform/fakes/TestDescriptorStub.java index 1336811dfac7..a6e7a36fa975 100644 --- a/junit-platform-engine/src/testFixtures/java/org/junit/platform/fakes/TestDescriptorStub.java +++ b/junit-platform-engine/src/testFixtures/java/org/junit/platform/fakes/TestDescriptorStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/testFixtures/java/org/junit/platform/fakes/TestEngineSpy.java b/junit-platform-engine/src/testFixtures/java/org/junit/platform/fakes/TestEngineSpy.java index 0c1dc37aa026..7754c75f411b 100644 --- a/junit-platform-engine/src/testFixtures/java/org/junit/platform/fakes/TestEngineSpy.java +++ b/junit-platform-engine/src/testFixtures/java/org/junit/platform/fakes/TestEngineSpy.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-engine/src/testFixtures/java/org/junit/platform/fakes/TestEngineStub.java b/junit-platform-engine/src/testFixtures/java/org/junit/platform/fakes/TestEngineStub.java index d97cb8307fd2..d29859313222 100644 --- a/junit-platform-engine/src/testFixtures/java/org/junit/platform/fakes/TestEngineStub.java +++ b/junit-platform-engine/src/testFixtures/java/org/junit/platform/fakes/TestEngineStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-jfr/src/main/java/org/junit/platform/jfr/FlightRecordingDiscoveryListener.java b/junit-platform-jfr/src/main/java/org/junit/platform/jfr/FlightRecordingDiscoveryListener.java index 100942573680..f36d31cd2ff3 100644 --- a/junit-platform-jfr/src/main/java/org/junit/platform/jfr/FlightRecordingDiscoveryListener.java +++ b/junit-platform-jfr/src/main/java/org/junit/platform/jfr/FlightRecordingDiscoveryListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-jfr/src/main/java/org/junit/platform/jfr/FlightRecordingExecutionListener.java b/junit-platform-jfr/src/main/java/org/junit/platform/jfr/FlightRecordingExecutionListener.java index 9d416e609010..a854b81d98ec 100644 --- a/junit-platform-jfr/src/main/java/org/junit/platform/jfr/FlightRecordingExecutionListener.java +++ b/junit-platform-jfr/src/main/java/org/junit/platform/jfr/FlightRecordingExecutionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-jfr/src/main/java/org/junit/platform/jfr/UniqueId.java b/junit-platform-jfr/src/main/java/org/junit/platform/jfr/UniqueId.java index 9083cef2e7b2..21ced50f0e42 100644 --- a/junit-platform-jfr/src/main/java/org/junit/platform/jfr/UniqueId.java +++ b/junit-platform-jfr/src/main/java/org/junit/platform/jfr/UniqueId.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/AbstractMethodFilter.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/AbstractMethodFilter.java index 1f8759693fdb..9ac17deea90c 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/AbstractMethodFilter.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/AbstractMethodFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/EngineDiscoveryResult.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/EngineDiscoveryResult.java index d12ed056f1b3..425b1290eda4 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/EngineDiscoveryResult.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/EngineDiscoveryResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/EngineFilter.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/EngineFilter.java index a65a68f265db..8dd34af794aa 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/EngineFilter.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/EngineFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/ExcludeMethodFilter.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/ExcludeMethodFilter.java index e1522163adf2..b9b46d764a2e 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/ExcludeMethodFilter.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/ExcludeMethodFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/IncludeMethodFilter.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/IncludeMethodFilter.java index d9242940e2d5..30d943bfcf94 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/IncludeMethodFilter.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/IncludeMethodFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/Launcher.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/Launcher.java index 41e5f0960576..3b46078278ca 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/Launcher.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/Launcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherConstants.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherConstants.java index da3dac7fae74..a2af5d187a58 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherConstants.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherConstants.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherDiscoveryListener.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherDiscoveryListener.java index 25c8751b6ef2..6b44f026b70f 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherDiscoveryListener.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherDiscoveryListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherDiscoveryRequest.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherDiscoveryRequest.java index f6043705a82c..058281b9b375 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherDiscoveryRequest.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherDiscoveryRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherInterceptor.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherInterceptor.java index 8375db13beed..490ac65483a2 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherInterceptor.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherSession.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherSession.java index 92fb5e9f37ae..c78ed7761888 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherSession.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherSession.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherSessionListener.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherSessionListener.java index 1024b695c188..56b2312d612f 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherSessionListener.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/LauncherSessionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/MethodFilter.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/MethodFilter.java index e7f4f99b1a32..cff14852ed79 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/MethodFilter.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/MethodFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/PostDiscoveryFilter.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/PostDiscoveryFilter.java index c6a6911f478a..d0ae9550024e 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/PostDiscoveryFilter.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/PostDiscoveryFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TagFilter.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TagFilter.java index 7b3579af26a3..2de149079747 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TagFilter.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TagFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestExecutionListener.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestExecutionListener.java index 3593d44c8401..10f6327a4a76 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestExecutionListener.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestExecutionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestIdentifier.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestIdentifier.java index ae3cd416469e..f397eb0b9bc0 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestIdentifier.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestIdentifier.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestPlan.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestPlan.java index c236d1980216..ca8361bb3757 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestPlan.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/TestPlan.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/CompositeEngineExecutionListener.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/CompositeEngineExecutionListener.java index b872c12b0f1a..dac24275f15f 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/CompositeEngineExecutionListener.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/CompositeEngineExecutionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/CompositeTestExecutionListener.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/CompositeTestExecutionListener.java index 1eaeee172a07..e9e823fed1a7 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/CompositeTestExecutionListener.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/CompositeTestExecutionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DefaultDiscoveryRequest.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DefaultDiscoveryRequest.java index fd59b0b447a4..6bd73c4b641e 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DefaultDiscoveryRequest.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DefaultDiscoveryRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DefaultLauncher.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DefaultLauncher.java index b6473d86a86a..5ebc4f9a638e 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DefaultLauncher.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DefaultLauncher.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DefaultLauncherConfig.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DefaultLauncherConfig.java index 6a88425416b0..132618cdb5c0 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DefaultLauncherConfig.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DefaultLauncherConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DefaultLauncherSession.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DefaultLauncherSession.java index 10965c631eb9..018eb41cf8a5 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DefaultLauncherSession.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DefaultLauncherSession.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DelegatingEngineExecutionListener.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DelegatingEngineExecutionListener.java index 2eca74628725..f2e50634a2ef 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DelegatingEngineExecutionListener.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DelegatingEngineExecutionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DelegatingLauncher.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DelegatingLauncher.java index fa0706b5dbef..3cc6be2316f0 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DelegatingLauncher.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/DelegatingLauncher.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineDiscoveryErrorDescriptor.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineDiscoveryErrorDescriptor.java index 8a67aaae4888..018de8fb1b39 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineDiscoveryErrorDescriptor.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineDiscoveryErrorDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineDiscoveryOrchestrator.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineDiscoveryOrchestrator.java index 6e01d443cfb7..862d7bb28ddf 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineDiscoveryOrchestrator.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineDiscoveryOrchestrator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineDiscoveryResultValidator.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineDiscoveryResultValidator.java index 460e8d271825..dc425934e2f1 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineDiscoveryResultValidator.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineDiscoveryResultValidator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineExecutionOrchestrator.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineExecutionOrchestrator.java index 1ef05c02d820..90fa40d97dc8 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineExecutionOrchestrator.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineExecutionOrchestrator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineFilterer.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineFilterer.java index 830855532d87..10e939f1ce84 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineFilterer.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineFilterer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineIdValidator.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineIdValidator.java index f6305283b1b9..878df7d3c207 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineIdValidator.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineIdValidator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ExecutionListenerAdapter.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ExecutionListenerAdapter.java index cd85e331dccb..9f68943b28cf 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ExecutionListenerAdapter.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ExecutionListenerAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/HierarchicalOutputDirectoryProvider.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/HierarchicalOutputDirectoryProvider.java index 9296ca634468..b85d3176668a 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/HierarchicalOutputDirectoryProvider.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/HierarchicalOutputDirectoryProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/InterceptingLauncher.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/InterceptingLauncher.java index 56e9f427071a..44656ff04a51 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/InterceptingLauncher.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/InterceptingLauncher.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/InternalTestPlan.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/InternalTestPlan.java index 3297909c09ae..315652f960a1 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/InternalTestPlan.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/InternalTestPlan.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/IterationOrder.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/IterationOrder.java index 3d1dbfcea19e..d622aff75b5f 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/IterationOrder.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/IterationOrder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherConfig.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherConfig.java index 8efe4de2323b..c51cb1e23271 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherConfig.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherConfigurationParameters.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherConfigurationParameters.java index 1fa5f9a462bc..a33793a346e9 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherConfigurationParameters.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherConfigurationParameters.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilder.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilder.java index 0d62e9a3b5c2..5f6e9f5fe119 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilder.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherDiscoveryResult.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherDiscoveryResult.java index af4c75db0e67..64adb2f55670 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherDiscoveryResult.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherDiscoveryResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherFactory.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherFactory.java index 5feaf010ad2a..d0dfae7c8a7d 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherFactory.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherListenerRegistry.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherListenerRegistry.java index 9e1850e41e50..da2db7e7a07a 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherListenerRegistry.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherListenerRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ListenerRegistry.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ListenerRegistry.java index c5dd3c6fc884..4a535c6bd99e 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ListenerRegistry.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ListenerRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/OutcomeDelayingEngineExecutionListener.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/OutcomeDelayingEngineExecutionListener.java index 9e140c655bf3..1afb4460d5b3 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/OutcomeDelayingEngineExecutionListener.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/OutcomeDelayingEngineExecutionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ServiceLoaderRegistry.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ServiceLoaderRegistry.java index 9f33adc15779..f06339619841 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ServiceLoaderRegistry.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ServiceLoaderRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ServiceLoaderTestEngineRegistry.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ServiceLoaderTestEngineRegistry.java index ada5a07778c3..73d57ed1d5d9 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ServiceLoaderTestEngineRegistry.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ServiceLoaderTestEngineRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/SessionPerRequestLauncher.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/SessionPerRequestLauncher.java index c0edfa8e80b0..dffde014867a 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/SessionPerRequestLauncher.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/SessionPerRequestLauncher.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/StackTracePruningEngineExecutionListener.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/StackTracePruningEngineExecutionListener.java index 3063fd9b8073..6a6193337d89 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/StackTracePruningEngineExecutionListener.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/StackTracePruningEngineExecutionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/StreamInterceptingTestExecutionListener.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/StreamInterceptingTestExecutionListener.java index 32a135896554..65a5f8ba453c 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/StreamInterceptingTestExecutionListener.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/StreamInterceptingTestExecutionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/StreamInterceptor.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/StreamInterceptor.java index 1fbfe7ae81d2..85b69f64bb26 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/StreamInterceptor.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/StreamInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/TestEngineFormatter.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/TestEngineFormatter.java index ec4fe8418ca7..558e6824fbe0 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/TestEngineFormatter.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/TestEngineFormatter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/LegacyReportingUtils.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/LegacyReportingUtils.java index 08ef0e55b7c2..6445265239ba 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/LegacyReportingUtils.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/LegacyReportingUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/LoggingListener.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/LoggingListener.java index 6dd62495353a..3b6e37907565 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/LoggingListener.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/LoggingListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/MutableTestExecutionSummary.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/MutableTestExecutionSummary.java index da39a9a2b6d4..0ef6826b016b 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/MutableTestExecutionSummary.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/MutableTestExecutionSummary.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/OutputDir.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/OutputDir.java index 389a83083a7c..acff49f57a9d 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/OutputDir.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/OutputDir.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/SummaryGeneratingListener.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/SummaryGeneratingListener.java index c01c09af2bf9..751888b2ae86 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/SummaryGeneratingListener.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/SummaryGeneratingListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/TestExecutionSummary.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/TestExecutionSummary.java index 800338127886..48328a32e77c 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/TestExecutionSummary.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/TestExecutionSummary.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListener.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListener.java index 79e49e28c5ee..8b8b8d51f274 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListener.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/discovery/AbortOnFailureLauncherDiscoveryListener.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/discovery/AbortOnFailureLauncherDiscoveryListener.java index e0dd78eda8fc..11a7429219c9 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/discovery/AbortOnFailureLauncherDiscoveryListener.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/discovery/AbortOnFailureLauncherDiscoveryListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/discovery/CompositeLauncherDiscoveryListener.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/discovery/CompositeLauncherDiscoveryListener.java index f94d256cbe16..0f4153ce5b00 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/discovery/CompositeLauncherDiscoveryListener.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/discovery/CompositeLauncherDiscoveryListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/discovery/LauncherDiscoveryListeners.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/discovery/LauncherDiscoveryListeners.java index 70a183621a41..757d17f6f400 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/discovery/LauncherDiscoveryListeners.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/discovery/LauncherDiscoveryListeners.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/discovery/LoggingLauncherDiscoveryListener.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/discovery/LoggingLauncherDiscoveryListener.java index 40a53a7d34cb..e5c31298abdd 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/discovery/LoggingLauncherDiscoveryListener.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/discovery/LoggingLauncherDiscoveryListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/session/CompositeLauncherSessionListener.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/session/CompositeLauncherSessionListener.java index b3d452bd8b42..c1c13327652c 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/session/CompositeLauncherSessionListener.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/session/CompositeLauncherSessionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/session/LauncherSessionListeners.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/session/LauncherSessionListeners.java index ccd7cc0deaab..938420d58c1f 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/session/LauncherSessionListeners.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/listeners/session/LauncherSessionListeners.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/DequeStack.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/DequeStack.java index be9fda237e56..4d3899199cee 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/DequeStack.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/DequeStack.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Operator.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Operator.java index a8b1be00cf76..7adc69050a06 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Operator.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Operator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Operators.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Operators.java index 475fda07d49f..541ceb976bb1 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Operators.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Operators.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/ParseResult.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/ParseResult.java index 50086134e9f8..0882acda8ede 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/ParseResult.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/ParseResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/ParseResults.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/ParseResults.java index c2220484337a..5ca542b8c0f9 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/ParseResults.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/ParseResults.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/ParseStatus.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/ParseStatus.java index a36c11a06cfb..695ef20c70ac 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/ParseStatus.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/ParseStatus.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Parser.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Parser.java index 2a10848dc14b..417cf3e52aad 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Parser.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Parser.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/ShuntingYard.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/ShuntingYard.java index 6c92b7846de7..b54d40f5b6a9 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/ShuntingYard.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/ShuntingYard.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Stack.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Stack.java index 50e9c930ace7..a1a4cd5d0fa9 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Stack.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Stack.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/TagExpression.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/TagExpression.java index 51bf079075ca..ac101b2a6810 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/TagExpression.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/TagExpression.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/TagExpressions.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/TagExpressions.java index 4301d9277f4b..350e6f4d7a68 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/TagExpressions.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/TagExpressions.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Token.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Token.java index f8451100ae0d..4b90dd72c915 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Token.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Token.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/TokenWith.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/TokenWith.java index 511745d8fac6..161cb229f6e7 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/TokenWith.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/TokenWith.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Tokenizer.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Tokenizer.java index a1b3661b0e42..f21dd73aa332 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Tokenizer.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/tagexpression/Tokenizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/testFixtures/java/org/junit/platform/launcher/core/ConfigurationParametersFactoryForTests.java b/junit-platform-launcher/src/testFixtures/java/org/junit/platform/launcher/core/ConfigurationParametersFactoryForTests.java index 102634bdfbf7..45d9af72b788 100644 --- a/junit-platform-launcher/src/testFixtures/java/org/junit/platform/launcher/core/ConfigurationParametersFactoryForTests.java +++ b/junit-platform-launcher/src/testFixtures/java/org/junit/platform/launcher/core/ConfigurationParametersFactoryForTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/testFixtures/java/org/junit/platform/launcher/core/LauncherFactoryForTestingPurposesOnly.java b/junit-platform-launcher/src/testFixtures/java/org/junit/platform/launcher/core/LauncherFactoryForTestingPurposesOnly.java index 7036c0609b60..c3909dd105df 100644 --- a/junit-platform-launcher/src/testFixtures/java/org/junit/platform/launcher/core/LauncherFactoryForTestingPurposesOnly.java +++ b/junit-platform-launcher/src/testFixtures/java/org/junit/platform/launcher/core/LauncherFactoryForTestingPurposesOnly.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-launcher/src/testFixtures/java/org/junit/platform/launcher/core/OutputDirectoryProviders.java b/junit-platform-launcher/src/testFixtures/java/org/junit/platform/launcher/core/OutputDirectoryProviders.java index 408d0740ce6a..b4d30b2b7b8f 100644 --- a/junit-platform-launcher/src/testFixtures/java/org/junit/platform/launcher/core/OutputDirectoryProviders.java +++ b/junit-platform-launcher/src/testFixtures/java/org/junit/platform/launcher/core/OutputDirectoryProviders.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/LegacyReportingUtils.java b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/LegacyReportingUtils.java index 68ac58467101..dc3598b88b57 100644 --- a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/LegacyReportingUtils.java +++ b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/LegacyReportingUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/LegacyXmlReportGeneratingListener.java b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/LegacyXmlReportGeneratingListener.java index 29ef317d3767..06bd0ecfc7a0 100644 --- a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/LegacyXmlReportGeneratingListener.java +++ b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/LegacyXmlReportGeneratingListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/XmlReportData.java b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/XmlReportData.java index b99315243944..f1ce85be73cb 100644 --- a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/XmlReportData.java +++ b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/XmlReportData.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/XmlReportWriter.java b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/XmlReportWriter.java index 4ea8c2f8f6ac..d3ae6b008bd9 100644 --- a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/XmlReportWriter.java +++ b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/legacy/xml/XmlReportWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/JUnitContributor.java b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/JUnitContributor.java index 4a18e53ee2f3..ceff09855452 100644 --- a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/JUnitContributor.java +++ b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/JUnitContributor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/JUnitFactory.java b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/JUnitFactory.java index 8064da6f20c4..bb786f835830 100644 --- a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/JUnitFactory.java +++ b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/JUnitFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/LegacyReportingName.java b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/LegacyReportingName.java index 95ce6cac8d9a..902c0b3210d1 100644 --- a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/LegacyReportingName.java +++ b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/LegacyReportingName.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java index 8573707420a9..954cdc334fc5 100644 --- a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java +++ b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/Type.java b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/Type.java index ca08eef6fad8..42e31aa7ac1a 100644 --- a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/Type.java +++ b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/Type.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/UniqueId.java b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/UniqueId.java index c1ac3bbce988..259e78faa164 100644 --- a/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/UniqueId.java +++ b/junit-platform-reporting/src/main/java/org/junit/platform/reporting/open/xml/UniqueId.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-reporting/src/testFixtures/java/org/junit/platform/reporting/open/xml/OpenTestReportGenerationSystemPropertyOverride.java b/junit-platform-reporting/src/testFixtures/java/org/junit/platform/reporting/open/xml/OpenTestReportGenerationSystemPropertyOverride.java index c3937c128a01..8c9faca9bea8 100644 --- a/junit-platform-reporting/src/testFixtures/java/org/junit/platform/reporting/open/xml/OpenTestReportGenerationSystemPropertyOverride.java +++ b/junit-platform-reporting/src/testFixtures/java/org/junit/platform/reporting/open/xml/OpenTestReportGenerationSystemPropertyOverride.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-reporting/src/testFixtures/java/org/junit/platform/reporting/testutil/FileUtils.java b/junit-platform-reporting/src/testFixtures/java/org/junit/platform/reporting/testutil/FileUtils.java index 503e792dafa6..04228a9aa1fb 100644 --- a/junit-platform-reporting/src/testFixtures/java/org/junit/platform/reporting/testutil/FileUtils.java +++ b/junit-platform-reporting/src/testFixtures/java/org/junit/platform/reporting/testutil/FileUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatform.java b/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatform.java index ee0b3bb15afe..0df3bbb19ef3 100644 --- a/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatform.java +++ b/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatform.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatformRunnerListener.java b/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatformRunnerListener.java index 2a51109e17c2..180472e20bb6 100644 --- a/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatformRunnerListener.java +++ b/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatformRunnerListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatformTestTree.java b/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatformTestTree.java index 99f3eef08f4f..e76f2d56a9be 100644 --- a/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatformTestTree.java +++ b/junit-platform-runner/src/main/java/org/junit/platform/runner/JUnitPlatformTestTree.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/AfterSuite.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/AfterSuite.java index c2b5e33a3467..77ff31333f1a 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/AfterSuite.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/AfterSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/BeforeSuite.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/BeforeSuite.java index 5b4c0d3c93f0..c62d9ccdc040 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/BeforeSuite.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/BeforeSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ConfigurationParameter.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ConfigurationParameter.java index 268f7029cc12..0a8d010a3624 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ConfigurationParameter.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ConfigurationParameter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ConfigurationParameters.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ConfigurationParameters.java index 9c7514a1315b..2deb5286eb68 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ConfigurationParameters.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ConfigurationParameters.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ConfigurationParametersResource.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ConfigurationParametersResource.java index 86fdfb38a71f..6e370f69ff4c 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ConfigurationParametersResource.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ConfigurationParametersResource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ConfigurationParametersResources.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ConfigurationParametersResources.java index 6b6fd1f6790e..0897e77b4622 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ConfigurationParametersResources.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ConfigurationParametersResources.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/DisableParentConfigurationParameters.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/DisableParentConfigurationParameters.java index 84905807c45c..2f059ac7cf5c 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/DisableParentConfigurationParameters.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/DisableParentConfigurationParameters.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ExcludeClassNamePatterns.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ExcludeClassNamePatterns.java index a68525a4a09b..9e8ee74c28ef 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ExcludeClassNamePatterns.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ExcludeClassNamePatterns.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ExcludeEngines.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ExcludeEngines.java index 1925e2b3d612..f6c2ac53f4dc 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ExcludeEngines.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ExcludeEngines.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ExcludePackages.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ExcludePackages.java index 196f6ab156c7..5335f7c0e844 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ExcludePackages.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ExcludePackages.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ExcludeTags.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ExcludeTags.java index 695e68cdb9e1..f24bc12ae6e7 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ExcludeTags.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/ExcludeTags.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/IncludeClassNamePatterns.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/IncludeClassNamePatterns.java index d3d962f1ffb1..313f52c9d371 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/IncludeClassNamePatterns.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/IncludeClassNamePatterns.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/IncludeEngines.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/IncludeEngines.java index b7014e0d39fa..f35461d438fd 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/IncludeEngines.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/IncludeEngines.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/IncludePackages.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/IncludePackages.java index d3191f255e07..f634544a7b84 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/IncludePackages.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/IncludePackages.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/IncludeTags.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/IncludeTags.java index 98cf52e50a38..12110bee9bfc 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/IncludeTags.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/IncludeTags.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/Select.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/Select.java index 79c991743f5e..f2fd4a47a370 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/Select.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/Select.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectClasses.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectClasses.java index 13aa76cf0cf9..9964f7b68b68 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectClasses.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectClasses.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectClasspathResource.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectClasspathResource.java index 1705163ad9aa..c3255f501c39 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectClasspathResource.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectClasspathResource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectClasspathResources.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectClasspathResources.java index a643fbfc0415..26f80d906716 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectClasspathResources.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectClasspathResources.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectDirectories.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectDirectories.java index c08747e5a9fa..57ea6bdbbe39 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectDirectories.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectDirectories.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectFile.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectFile.java index 0df68a8ca0b4..7359febbda84 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectFile.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectFile.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectFiles.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectFiles.java index 53875f94a666..06ebf7ebaf48 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectFiles.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectFiles.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectMethod.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectMethod.java index 7be2264c8a0d..c1fa0f6dc40d 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectMethod.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectMethod.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectMethods.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectMethods.java index 6f487107856d..f3583156f325 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectMethods.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectMethods.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectModules.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectModules.java index 5b003444629a..e0dccf332c18 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectModules.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectModules.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectPackages.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectPackages.java index 592fe107af56..bba47a24c2d9 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectPackages.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectPackages.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectUris.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectUris.java index f3f0bb8e7398..a281678df0a2 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectUris.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SelectUris.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/Selects.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/Selects.java index 44403f81aa21..63f52143916b 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/Selects.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/Selects.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/Suite.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/Suite.java index 35e0d2f2140f..c44c5d9a6bc8 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/Suite.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/Suite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SuiteDisplayName.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SuiteDisplayName.java index 0db93a88eedf..0113b1827b44 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SuiteDisplayName.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/SuiteDisplayName.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/UseTechnicalNames.java b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/UseTechnicalNames.java index d9621689172e..749fcdb13a9f 100644 --- a/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/UseTechnicalNames.java +++ b/junit-platform-suite-api/src/main/java/org/junit/platform/suite/api/UseTechnicalNames.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/AdditionalDiscoverySelectors.java b/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/AdditionalDiscoverySelectors.java index a66a5545de54..969fe04e9376 100644 --- a/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/AdditionalDiscoverySelectors.java +++ b/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/AdditionalDiscoverySelectors.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilder.java b/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilder.java index 44a335d3c7b0..ccee1edb4eb8 100644 --- a/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilder.java +++ b/junit-platform-suite-commons/src/main/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/ClassSelectorResolver.java b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/ClassSelectorResolver.java index 6e7dfffe05a9..1aea480e9569 100644 --- a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/ClassSelectorResolver.java +++ b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/ClassSelectorResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/DiscoverySelectorResolver.java b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/DiscoverySelectorResolver.java index 8fc2bbeef786..3a9775ea5e9a 100644 --- a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/DiscoverySelectorResolver.java +++ b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/DiscoverySelectorResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/IsPotentialTestContainer.java b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/IsPotentialTestContainer.java index 9a72f4c4b581..ebfa4cc50e05 100644 --- a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/IsPotentialTestContainer.java +++ b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/IsPotentialTestContainer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/IsSuiteClass.java b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/IsSuiteClass.java index 6a162075a719..97947eefc831 100644 --- a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/IsSuiteClass.java +++ b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/IsSuiteClass.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/LifecycleMethodUtils.java b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/LifecycleMethodUtils.java index 325f6817ae29..dcf971ce86ad 100644 --- a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/LifecycleMethodUtils.java +++ b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/LifecycleMethodUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/NoTestsDiscoveredException.java b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/NoTestsDiscoveredException.java index 2c4db7af1bb3..e0f22d8fa257 100644 --- a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/NoTestsDiscoveredException.java +++ b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/NoTestsDiscoveredException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteEngineDescriptor.java b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteEngineDescriptor.java index b70aae700fd7..12c038bccf1b 100644 --- a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteEngineDescriptor.java +++ b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteEngineDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteLauncher.java b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteLauncher.java index e2932f3bd4b1..c3a62006e859 100644 --- a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteLauncher.java +++ b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteLauncher.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestDescriptor.java b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestDescriptor.java index 779c2a03bc3a..bfcd2f3b541f 100644 --- a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestDescriptor.java +++ b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestEngine.java b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestEngine.java index b489870ba488..c0f754639c80 100644 --- a/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestEngine.java +++ b/junit-platform-suite-engine/src/main/java/org/junit/platform/suite/engine/SuiteTestEngine.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Assertions.java b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Assertions.java index 30fbc6ba577a..3e01ed7a9f0d 100644 --- a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Assertions.java +++ b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Assertions.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EngineExecutionResults.java b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EngineExecutionResults.java index 8d884d649300..0d78168096c0 100644 --- a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EngineExecutionResults.java +++ b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EngineExecutionResults.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EngineTestKit.java b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EngineTestKit.java index 0d2b634bb01e..7e5e6fae3f5e 100644 --- a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EngineTestKit.java +++ b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EngineTestKit.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Event.java b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Event.java index 08069dfeea17..ff59f8eb84ba 100644 --- a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Event.java +++ b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Event.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventConditions.java b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventConditions.java index 776c6d410ab3..5f260fe3dc14 100644 --- a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventConditions.java +++ b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventConditions.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventStatistics.java b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventStatistics.java index f052d2f2b486..a0e38754ca61 100644 --- a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventStatistics.java +++ b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventStatistics.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventType.java b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventType.java index 7bb029ad9929..9cef63ee24f9 100644 --- a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventType.java +++ b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EventType.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Events.java b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Events.java index 9f688eb9d763..6866116f3ff2 100644 --- a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Events.java +++ b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Events.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Execution.java b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Execution.java index 9b5a70846d83..47f592114b2c 100644 --- a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Execution.java +++ b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Execution.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/ExecutionRecorder.java b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/ExecutionRecorder.java index 1f375f3a4e33..d27b058160da 100644 --- a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/ExecutionRecorder.java +++ b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/ExecutionRecorder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Executions.java b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Executions.java index bbf1d2df1a3f..fae09e861905 100644 --- a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Executions.java +++ b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/Executions.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/TerminationInfo.java b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/TerminationInfo.java index 99035a3bdc16..092c10fe1440 100644 --- a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/TerminationInfo.java +++ b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/TerminationInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/TestExecutionResultConditions.java b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/TestExecutionResultConditions.java index 1ebbeabb875c..f9b1b1f9c53c 100644 --- a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/TestExecutionResultConditions.java +++ b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/TestExecutionResultConditions.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/JUnit4VersionCheck.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/JUnit4VersionCheck.java index bcc7d128b935..f27eaef647ca 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/JUnit4VersionCheck.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/JUnit4VersionCheck.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/VintageTestEngine.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/VintageTestEngine.java index be13d89580a7..9d9eb57c280f 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/VintageTestEngine.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/VintageTestEngine.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/DescriptionUtils.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/DescriptionUtils.java index 85e9c0b51a5d..a55ffd3c572f 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/DescriptionUtils.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/DescriptionUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/OrFilter.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/OrFilter.java index 4826c67faa78..3d8e4bc72714 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/OrFilter.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/OrFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/RunnerDecorator.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/RunnerDecorator.java index 01f890fd50ae..93db77c7a4af 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/RunnerDecorator.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/RunnerDecorator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/RunnerRequest.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/RunnerRequest.java index 414ddc2b4955..e6c8fdb4dd72 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/RunnerRequest.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/RunnerRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/RunnerTestDescriptor.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/RunnerTestDescriptor.java index bd20da74a3d2..8d12fa032a8d 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/RunnerTestDescriptor.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/RunnerTestDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/TestSourceProvider.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/TestSourceProvider.java index 2da8ffcd8ff3..2037f7aeb8d8 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/TestSourceProvider.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/TestSourceProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/VintageEngineDescriptor.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/VintageEngineDescriptor.java index 26356fdfe9f7..0e966081652c 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/VintageEngineDescriptor.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/VintageEngineDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/VintageTestDescriptor.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/VintageTestDescriptor.java index 89435681207c..47319da6e3b6 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/VintageTestDescriptor.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/descriptor/VintageTestDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/ClassSelectorResolver.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/ClassSelectorResolver.java index 8f160a2152f1..e8a005591a40 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/ClassSelectorResolver.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/ClassSelectorResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/DefensiveAllDefaultPossibilitiesBuilder.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/DefensiveAllDefaultPossibilitiesBuilder.java index 5d03e0a64133..db80b987d897 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/DefensiveAllDefaultPossibilitiesBuilder.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/DefensiveAllDefaultPossibilitiesBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/FilterableIgnoringRunnerDecorator.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/FilterableIgnoringRunnerDecorator.java index 636c9a28ee27..ba7c1b75025a 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/FilterableIgnoringRunnerDecorator.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/FilterableIgnoringRunnerDecorator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/IgnoringRunnerDecorator.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/IgnoringRunnerDecorator.java index d95c1d68e57b..93b621ceb9b7 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/IgnoringRunnerDecorator.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/IgnoringRunnerDecorator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/IsPotentialJUnit4TestClass.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/IsPotentialJUnit4TestClass.java index 9470277ac407..91e331540f46 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/IsPotentialJUnit4TestClass.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/IsPotentialJUnit4TestClass.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/IsPotentialJUnit4TestMethod.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/IsPotentialJUnit4TestMethod.java index 75352330d1c2..3ef5419adccd 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/IsPotentialJUnit4TestMethod.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/IsPotentialJUnit4TestMethod.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/MethodSelectorResolver.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/MethodSelectorResolver.java index f3227d857526..6511fe8c5af8 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/MethodSelectorResolver.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/MethodSelectorResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/RunnerTestDescriptorPostProcessor.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/RunnerTestDescriptorPostProcessor.java index e124236e1ac2..8c98ea114e84 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/RunnerTestDescriptorPostProcessor.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/RunnerTestDescriptorPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/UniqueIdFilter.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/UniqueIdFilter.java index 400d64b52f0b..a6d15af76b80 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/UniqueIdFilter.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/UniqueIdFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/VintageDiscoverer.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/VintageDiscoverer.java index ce67578616e6..5f50c2c439f0 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/VintageDiscoverer.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/discovery/VintageDiscoverer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/execution/EventType.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/execution/EventType.java index 75177f5527b4..0004ce56efe4 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/execution/EventType.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/execution/EventType.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/execution/RunListenerAdapter.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/execution/RunListenerAdapter.java index 63d415bd1c11..ae0aab651df9 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/execution/RunListenerAdapter.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/execution/RunListenerAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/execution/RunnerExecutor.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/execution/RunnerExecutor.java index cb0a1d5c35ee..7e5bf6b1306a 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/execution/RunnerExecutor.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/execution/RunnerExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/execution/TestRun.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/execution/TestRun.java index bf0b160b3a83..0e1a4e0ec2e7 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/execution/TestRun.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/execution/TestRun.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/support/UniqueIdReader.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/support/UniqueIdReader.java index 7e396d74bcaf..d9cae90a119a 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/support/UniqueIdReader.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/support/UniqueIdReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/support/UniqueIdStringifier.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/support/UniqueIdStringifier.java index c0fc50aadb2c..6986433ff5e3 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/support/UniqueIdStringifier.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/support/UniqueIdStringifier.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/JUnit4ParameterizedTests.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/JUnit4ParameterizedTests.java index 7ef1faa72686..5ac12b0a1f26 100644 --- a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/JUnit4ParameterizedTests.java +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/JUnit4ParameterizedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/JUnit4VersionCheckTests.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/JUnit4VersionCheckTests.java index af9002c615c6..fc3416f404af 100644 --- a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/JUnit4VersionCheckTests.java +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/JUnit4VersionCheckTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageLauncherIntegrationTests.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageLauncherIntegrationTests.java index 40b0db53a478..975752edee61 100644 --- a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageLauncherIntegrationTests.java +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageLauncherIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineBasicTests.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineBasicTests.java index c51b0875fd88..3f6fa7b5e5d7 100644 --- a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineBasicTests.java +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineBasicTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineDiscoveryTests.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineDiscoveryTests.java index b59d68144595..7425889bccb7 100644 --- a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineDiscoveryTests.java +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineDiscoveryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineExecutionTests.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineExecutionTests.java index 531016e16b4f..d73a8809c6a9 100644 --- a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineExecutionTests.java +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineExecutionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineTestSuite.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineTestSuite.java index 1de375649de0..d45ca3b2139b 100644 --- a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineTestSuite.java +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineTestSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageUniqueIdBuilder.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageUniqueIdBuilder.java index 92a9e1bc0544..5386de3762bf 100644 --- a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageUniqueIdBuilder.java +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageUniqueIdBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/descriptor/DescriptionUtilsTests.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/descriptor/DescriptionUtilsTests.java index 49c7524de53a..5da33f4db28b 100644 --- a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/descriptor/DescriptionUtilsTests.java +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/descriptor/DescriptionUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/descriptor/OrFilterTests.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/descriptor/OrFilterTests.java index 4cc9c5c856fe..6e5d29569b23 100644 --- a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/descriptor/OrFilterTests.java +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/descriptor/OrFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/descriptor/TestSourceProviderTests.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/descriptor/TestSourceProviderTests.java index b182da828175..fc0004d408d5 100644 --- a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/descriptor/TestSourceProviderTests.java +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/descriptor/TestSourceProviderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/descriptor/VintageTestDescriptorTests.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/descriptor/VintageTestDescriptorTests.java index 349cdc8fb409..cb1d22b10d5f 100644 --- a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/descriptor/VintageTestDescriptorTests.java +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/descriptor/VintageTestDescriptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/discovery/IsPotentialJUnit4TestClassTests.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/discovery/IsPotentialJUnit4TestClassTests.java index f19516a527c6..85486d998c89 100644 --- a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/discovery/IsPotentialJUnit4TestClassTests.java +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/discovery/IsPotentialJUnit4TestClassTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/discovery/RunnerTestDescriptorPostProcessorTests.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/discovery/RunnerTestDescriptorPostProcessorTests.java index 01733137bab1..ef8d9586697e 100644 --- a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/discovery/RunnerTestDescriptorPostProcessorTests.java +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/discovery/RunnerTestDescriptorPostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/discovery/VintageDiscovererTests.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/discovery/VintageDiscovererTests.java index 5ed15771d1ac..495083eb494e 100644 --- a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/discovery/VintageDiscovererTests.java +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/discovery/VintageDiscovererTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/execution/TestRunTests.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/execution/TestRunTests.java index cea6d3c6ee86..6d80e7f2938b 100644 --- a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/execution/TestRunTests.java +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/execution/TestRunTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/support/UniqueIdReaderTests.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/support/UniqueIdReaderTests.java index b2eff398baa9..1da96bf1401f 100644 --- a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/support/UniqueIdReaderTests.java +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/support/UniqueIdReaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/support/UniqueIdStringifierTests.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/support/UniqueIdStringifierTests.java index 3d8cc0af798c..d8859b1e1c31 100644 --- a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/support/UniqueIdStringifierTests.java +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/support/UniqueIdStringifierTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/PlainOldJavaClassWithoutAnyTestsTestCase.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/PlainOldJavaClassWithoutAnyTestsTestCase.java index fff58931677f..31f6f9c4e078 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/PlainOldJavaClassWithoutAnyTestsTestCase.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/PlainOldJavaClassWithoutAnyTestsTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/AbstractJUnit3TestCase.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/AbstractJUnit3TestCase.java index 46bbea61fcb4..8e59e1cbe95f 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/AbstractJUnit3TestCase.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/AbstractJUnit3TestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/IgnoredJUnit3TestCase.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/IgnoredJUnit3TestCase.java index e29562595ead..9f42e5dbf7f4 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/IgnoredJUnit3TestCase.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/IgnoredJUnit3TestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3ParallelSuiteWithSubsuites.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3ParallelSuiteWithSubsuites.java index fea0c802c957..91148551ed16 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3ParallelSuiteWithSubsuites.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3ParallelSuiteWithSubsuites.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3SuiteWithSingleTestCaseWithSingleTestWhichFails.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3SuiteWithSingleTestCaseWithSingleTestWhichFails.java index bf0274e2edd2..a3ed0b394af3 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3SuiteWithSingleTestCaseWithSingleTestWhichFails.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3SuiteWithSingleTestCaseWithSingleTestWhichFails.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3SuiteWithSubsuites.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3SuiteWithSubsuites.java index 390499a21f96..624938b947f6 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3SuiteWithSubsuites.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit3SuiteWithSubsuites.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit4SuiteWithIgnoredJUnit3TestCase.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit4SuiteWithIgnoredJUnit3TestCase.java index 288c26e92085..4a096fbb8880 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit4SuiteWithIgnoredJUnit3TestCase.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/JUnit4SuiteWithIgnoredJUnit3TestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/PlainJUnit3TestCaseWithSingleTestWhichFails.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/PlainJUnit3TestCaseWithSingleTestWhichFails.java index 932aac5156f7..aa736e306d46 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/PlainJUnit3TestCaseWithSingleTestWhichFails.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit3/PlainJUnit3TestCaseWithSingleTestWhichFails.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/AbstractJUnit4TestCase.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/AbstractJUnit4TestCase.java index 6a88673df784..aa3b595a8764 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/AbstractJUnit4TestCase.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/AbstractJUnit4TestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/AbstractJunit4TestCaseWithConstructorParameter.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/AbstractJunit4TestCaseWithConstructorParameter.java index 8e5e40eb21eb..d2a2264aa811 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/AbstractJunit4TestCaseWithConstructorParameter.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/AbstractJunit4TestCaseWithConstructorParameter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/Categories.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/Categories.java index ba49bbe39914..62efd6e08aa5 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/Categories.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/Categories.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/CompletelyDynamicTestCase.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/CompletelyDynamicTestCase.java index e435cd0e682f..3c85894ecbf9 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/CompletelyDynamicTestCase.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/CompletelyDynamicTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ConcreteJUnit4TestCase.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ConcreteJUnit4TestCase.java index a717a96cf578..6be6b3f214ce 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ConcreteJUnit4TestCase.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ConcreteJUnit4TestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ConfigurableRunner.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ConfigurableRunner.java index c10e61b28a94..51ef703b2d70 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ConfigurableRunner.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ConfigurableRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/DynamicRunner.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/DynamicRunner.java index 6ebfb7e46625..b18a20202391 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/DynamicRunner.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/DynamicRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/EmptyIgnoredTestCase.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/EmptyIgnoredTestCase.java index ade1340dae5c..c0da6ece4f98 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/EmptyIgnoredTestCase.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/EmptyIgnoredTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/EnclosedJUnit4TestCase.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/EnclosedJUnit4TestCase.java index b315b15b798f..35f92e388961 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/EnclosedJUnit4TestCase.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/EnclosedJUnit4TestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/EnclosedWithParameterizedChildrenJUnit4TestCase.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/EnclosedWithParameterizedChildrenJUnit4TestCase.java index 3305da289100..c4e24e94ca41 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/EnclosedWithParameterizedChildrenJUnit4TestCase.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/EnclosedWithParameterizedChildrenJUnit4TestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ExceptionThrowingRunner.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ExceptionThrowingRunner.java index 00ee38f1eb7f..dd5a946fc75c 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ExceptionThrowingRunner.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ExceptionThrowingRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/IgnoredJUnit4TestCase.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/IgnoredJUnit4TestCase.java index 9a9f860cfe07..0a2dfddb7127 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/IgnoredJUnit4TestCase.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/IgnoredJUnit4TestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/IgnoredJUnit4TestCaseWithNotFilterableRunner.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/IgnoredJUnit4TestCaseWithNotFilterableRunner.java index 4a491c253c24..a3237ed8fcef 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/IgnoredJUnit4TestCaseWithNotFilterableRunner.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/IgnoredJUnit4TestCaseWithNotFilterableRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/IgnoredParameterizedTestCase.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/IgnoredParameterizedTestCase.java index d2625c1e5bc3..582846c551e4 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/IgnoredParameterizedTestCase.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/IgnoredParameterizedTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4ParameterizedTestCase.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4ParameterizedTestCase.java index fe05d745fc61..cfa90bb45292 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4ParameterizedTestCase.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4ParameterizedTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteOfSuiteWithFilterableChildRunner.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteOfSuiteWithFilterableChildRunner.java index 9955d8e10806..12ee418ef5e8 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteOfSuiteWithFilterableChildRunner.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteOfSuiteWithFilterableChildRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteOfSuiteWithIgnoredJUnit4TestCase.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteOfSuiteWithIgnoredJUnit4TestCase.java index dbfd835d67ee..714494651a89 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteOfSuiteWithIgnoredJUnit4TestCase.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteOfSuiteWithIgnoredJUnit4TestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteOfSuiteWithJUnit4TestCaseWithAssumptionFailureInBeforeClass.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteOfSuiteWithJUnit4TestCaseWithAssumptionFailureInBeforeClass.java index d81e679e8ee7..cc797b0bfa58 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteOfSuiteWithJUnit4TestCaseWithAssumptionFailureInBeforeClass.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteOfSuiteWithJUnit4TestCaseWithAssumptionFailureInBeforeClass.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteOfSuiteWithJUnit4TestCaseWithErrorInBeforeClass.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteOfSuiteWithJUnit4TestCaseWithErrorInBeforeClass.java index cab393ed7b4c..cf804e743535 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteOfSuiteWithJUnit4TestCaseWithErrorInBeforeClass.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteOfSuiteWithJUnit4TestCaseWithErrorInBeforeClass.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithExceptionThrowingRunner.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithExceptionThrowingRunner.java index f6fc59535ee8..08749c9f5ca3 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithExceptionThrowingRunner.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithExceptionThrowingRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithIgnoredJUnit4TestCase.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithIgnoredJUnit4TestCase.java index c0b7351e9c3c..2c4dc7ee5205 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithIgnoredJUnit4TestCase.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithIgnoredJUnit4TestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithJUnit3SuiteWithSingleTestCase.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithJUnit3SuiteWithSingleTestCase.java index 8d055eb75720..1d12b78a9363 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithJUnit3SuiteWithSingleTestCase.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithJUnit3SuiteWithSingleTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithJUnit4TestCaseWithAssumptionFailureInBeforeClass.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithJUnit4TestCaseWithAssumptionFailureInBeforeClass.java index 2bffda246870..5057bd76c64e 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithJUnit4TestCaseWithAssumptionFailureInBeforeClass.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithJUnit4TestCaseWithAssumptionFailureInBeforeClass.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithJUnit4TestCaseWithErrorInBeforeClass.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithJUnit4TestCaseWithErrorInBeforeClass.java index 2d2a0eff61a9..962b42c33979 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithJUnit4TestCaseWithErrorInBeforeClass.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithJUnit4TestCaseWithErrorInBeforeClass.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithJUnit4TestCaseWithFailingDescriptionThatIsNotReportedAsFinished.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithJUnit4TestCaseWithFailingDescriptionThatIsNotReportedAsFinished.java index 3477bc366a72..e25ef33f4bdf 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithJUnit4TestCaseWithFailingDescriptionThatIsNotReportedAsFinished.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithJUnit4TestCaseWithFailingDescriptionThatIsNotReportedAsFinished.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithJUnit4TestCaseWithRunnerWithCustomUniqueIdsAndDisplayNames.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithJUnit4TestCaseWithRunnerWithCustomUniqueIdsAndDisplayNames.java index 6f526104e679..b2fd029e5d6b 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithJUnit4TestCaseWithRunnerWithCustomUniqueIdsAndDisplayNames.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithJUnit4TestCaseWithRunnerWithCustomUniqueIdsAndDisplayNames.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithPlainJUnit4TestCaseWithSingleTestWhichIsIgnored.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithPlainJUnit4TestCaseWithSingleTestWhichIsIgnored.java index 3b8fd42c965a..6ffd686b1f6e 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithPlainJUnit4TestCaseWithSingleTestWhichIsIgnored.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithPlainJUnit4TestCaseWithSingleTestWhichIsIgnored.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithTwoTestCases.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithTwoTestCases.java index 498b80d20d5b..c446a1710fdb 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithTwoTestCases.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4SuiteWithTwoTestCases.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithAssumptionFailureInBeforeClass.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithAssumptionFailureInBeforeClass.java index f628dbd5f5ed..f8c86095d98e 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithAssumptionFailureInBeforeClass.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithAssumptionFailureInBeforeClass.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithDistinguishableOverloadedMethod.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithDistinguishableOverloadedMethod.java index 553ab1031f7b..98182465ca7a 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithDistinguishableOverloadedMethod.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithDistinguishableOverloadedMethod.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithErrorCollectorStoringMultipleFailures.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithErrorCollectorStoringMultipleFailures.java index b47efc989451..cbe1fcede463 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithErrorCollectorStoringMultipleFailures.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithErrorCollectorStoringMultipleFailures.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithErrorInAfterClass.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithErrorInAfterClass.java index 00903b8b1999..72d8ff1f5e64 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithErrorInAfterClass.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithErrorInAfterClass.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithErrorInBeforeClass.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithErrorInBeforeClass.java index 53bd47ed80d9..bec3a0dd2bff 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithErrorInBeforeClass.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithErrorInBeforeClass.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithExceptionThrowingRunner.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithExceptionThrowingRunner.java index 3fdde38963bc..7e356c7ab18a 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithExceptionThrowingRunner.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithExceptionThrowingRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithFailingDescriptionThatIsNotReportedAsFinished.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithFailingDescriptionThatIsNotReportedAsFinished.java index f81696ad4fe0..03d49298bc7f 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithFailingDescriptionThatIsNotReportedAsFinished.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithFailingDescriptionThatIsNotReportedAsFinished.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithIndistinguishableOverloadedMethod.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithIndistinguishableOverloadedMethod.java index e590208ccf11..888437d18ac8 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithIndistinguishableOverloadedMethod.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithIndistinguishableOverloadedMethod.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithNotFilterableRunner.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithNotFilterableRunner.java index a36112ba5c26..90d5064448db 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithNotFilterableRunner.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithNotFilterableRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithRunnerWithCustomUniqueIdsAndDisplayNames.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithRunnerWithCustomUniqueIdsAndDisplayNames.java index 1fccc00f7819..07dab7575284 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithRunnerWithCustomUniqueIdsAndDisplayNames.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithRunnerWithCustomUniqueIdsAndDisplayNames.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithRunnerWithDuplicateChangingChildDescriptions.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithRunnerWithDuplicateChangingChildDescriptions.java index 9b82ffc916c0..f772b638133d 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithRunnerWithDuplicateChangingChildDescriptions.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4TestCaseWithRunnerWithDuplicateChangingChildDescriptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/MalformedJUnit4TestCase.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/MalformedJUnit4TestCase.java index d3c318003317..711dc90adb16 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/MalformedJUnit4TestCase.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/MalformedJUnit4TestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/NotFilterableRunner.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/NotFilterableRunner.java index 5fcdfca51ef8..3371d99c281b 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/NotFilterableRunner.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/NotFilterableRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ParameterizedTestCase.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ParameterizedTestCase.java index eae9c787c323..15f37423b6d0 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ParameterizedTestCase.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ParameterizedTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ParameterizedTimingTestCase.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ParameterizedTimingTestCase.java index 9330453cd681..bcf6af174f06 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ParameterizedTimingTestCase.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ParameterizedTimingTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ParameterizedWithAfterParamFailureTestCase.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ParameterizedWithAfterParamFailureTestCase.java index 73c6219695eb..46c56263b4bb 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ParameterizedWithAfterParamFailureTestCase.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ParameterizedWithAfterParamFailureTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ParameterizedWithBeforeParamFailureTestCase.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ParameterizedWithBeforeParamFailureTestCase.java index 685e231dff94..1c960485b091 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ParameterizedWithBeforeParamFailureTestCase.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/ParameterizedWithBeforeParamFailureTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithFiveTestMethods.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithFiveTestMethods.java index fb23515ea145..3f63378233d7 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithFiveTestMethods.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithFiveTestMethods.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithLifecycleMethods.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithLifecycleMethods.java index 12c24a541271..8668768bead3 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithLifecycleMethods.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithLifecycleMethods.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithSingleInheritedTestWhichFails.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithSingleInheritedTestWhichFails.java index 2d7805ec5d71..35d9760b9f78 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithSingleInheritedTestWhichFails.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithSingleInheritedTestWhichFails.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithSingleTestWhichFails.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithSingleTestWhichFails.java index c9b165c261b6..bd7f5125a9db 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithSingleTestWhichFails.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithSingleTestWhichFails.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithSingleTestWhichIsIgnored.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithSingleTestWhichIsIgnored.java index 697a8ac1842d..9186161116a5 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithSingleTestWhichIsIgnored.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithSingleTestWhichIsIgnored.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithTwoTestMethods.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithTwoTestMethods.java index 8055a7cee501..ea9b067ab902 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithTwoTestMethods.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/PlainJUnit4TestCaseWithTwoTestMethods.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/RunnerThatOnlyReportsFailures.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/RunnerThatOnlyReportsFailures.java index 29d379200443..99a713b9eff0 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/RunnerThatOnlyReportsFailures.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/RunnerThatOnlyReportsFailures.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/RunnerWithCustomUniqueIdsAndDisplayNames.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/RunnerWithCustomUniqueIdsAndDisplayNames.java index bdf04f25ff2f..f3af1814485d 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/RunnerWithCustomUniqueIdsAndDisplayNames.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/RunnerWithCustomUniqueIdsAndDisplayNames.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/SingleFailingTheoryTestCase.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/SingleFailingTheoryTestCase.java index 37f7671e7169..5e8f1e3d222c 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/SingleFailingTheoryTestCase.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/SingleFailingTheoryTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/TestCaseRunWithJUnitPlatformRunner.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/TestCaseRunWithJUnitPlatformRunner.java index 2a724e128f12..fe1011fac50e 100644 --- a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/TestCaseRunWithJUnitPlatformRunner.java +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/TestCaseRunWithJUnitPlatformRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/DefaultPackageTestCase.java b/jupiter-tests/src/test/java/DefaultPackageTestCase.java index 305995fcd0e2..e744df16064c 100644 --- a/jupiter-tests/src/test/java/DefaultPackageTestCase.java +++ b/jupiter-tests/src/test/java/DefaultPackageTestCase.java @@ -1,6 +1,6 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/example/B_TestCase.java b/jupiter-tests/src/test/java/example/B_TestCase.java index db7cada43fea..30b66be4921f 100644 --- a/jupiter-tests/src/test/java/example/B_TestCase.java +++ b/jupiter-tests/src/test/java/example/B_TestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/JupiterTestSuite.java b/jupiter-tests/src/test/java/org/junit/jupiter/JupiterTestSuite.java index e29ceeca445a..c569b5ea06f4 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/JupiterTestSuite.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/JupiterTestSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertAllAssertionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertAllAssertionsTests.java index 13a4c58e0f96..dac3a628fb17 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertAllAssertionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertAllAssertionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertArrayEqualsAssertionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertArrayEqualsAssertionsTests.java index 90ce5920a825..2bbfa11fe3e1 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertArrayEqualsAssertionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertArrayEqualsAssertionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertDoesNotThrowAssertionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertDoesNotThrowAssertionsTests.java index ec290530a53e..260be584308a 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertDoesNotThrowAssertionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertDoesNotThrowAssertionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertEqualsAssertionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertEqualsAssertionsTests.java index 9a41bf65882b..df84f44540a2 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertEqualsAssertionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertEqualsAssertionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertFalseAssertionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertFalseAssertionsTests.java index e8a24a98af17..14bef98d37ec 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertFalseAssertionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertFalseAssertionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertInstanceOfAssertionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertInstanceOfAssertionsTests.java index 56a75ced10e0..b5bfd62438eb 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertInstanceOfAssertionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertInstanceOfAssertionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertIterableEqualsAssertionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertIterableEqualsAssertionsTests.java index bc492854d2ac..e09823ddd89d 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertIterableEqualsAssertionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertIterableEqualsAssertionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertLinesMatchAssertionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertLinesMatchAssertionsTests.java index a76c5f6cc049..273b75d11276 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertLinesMatchAssertionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertLinesMatchAssertionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertNotEqualsAssertionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertNotEqualsAssertionsTests.java index 09dfe6b9b9ea..450653ecd327 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertNotEqualsAssertionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertNotEqualsAssertionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertNotNullAssertionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertNotNullAssertionsTests.java index 3a59accdd344..da2386aa0f44 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertNotNullAssertionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertNotNullAssertionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertNotSameAssertionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertNotSameAssertionsTests.java index 9c2ea0fd7c98..d3a2839758d9 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertNotSameAssertionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertNotSameAssertionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertNullAssertionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertNullAssertionsTests.java index 773488a8c8af..e960d250a993 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertNullAssertionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertNullAssertionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertSameAssertionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertSameAssertionsTests.java index debc87667a39..1ee81d533990 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertSameAssertionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertSameAssertionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertThrowsAssertionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertThrowsAssertionsTests.java index 0ac7ef29fe97..c1f5a003cbc4 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertThrowsAssertionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertThrowsAssertionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertThrowsExactlyAssertionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertThrowsExactlyAssertionsTests.java index 7ef6e59e680f..d167f4f08e43 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertThrowsExactlyAssertionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertThrowsExactlyAssertionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertTimeoutAssertionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertTimeoutAssertionsTests.java index 3a3b9ae61fba..932598229940 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertTimeoutAssertionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertTimeoutAssertionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertTimeoutPreemptivelyAssertionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertTimeoutPreemptivelyAssertionsTests.java index 94ee07931088..303bbb3124fe 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertTimeoutPreemptivelyAssertionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertTimeoutPreemptivelyAssertionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertTrueAssertionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertTrueAssertionsTests.java index 930afebda7ea..eb8e1931502b 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertTrueAssertionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertTrueAssertionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertionTestUtils.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertionTestUtils.java index 92ac86c4a2c3..d961acd53496 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertionTestUtils.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssertionTestUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssumptionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssumptionsTests.java index 6c9412cd0974..a63534493de9 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/AssumptionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/AssumptionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationInheritanceTestCase.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationInheritanceTestCase.java index 1d077189d2e8..df9ffcb35a30 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationInheritanceTestCase.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationInheritanceTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationTests.java index cf692a4be153..8dbea0cdb42d 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/DynamicTestTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/DynamicTestTests.java index 1244dc697104..073678ad4088 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/DynamicTestTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/DynamicTestTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/EnigmaThrowable.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/EnigmaThrowable.java index 43b66eeebb2e..2448a2583f4c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/EnigmaThrowable.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/EnigmaThrowable.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/FailAssertionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/FailAssertionsTests.java index 95db2c35ccaa..d549bbbed364 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/FailAssertionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/FailAssertionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesGenerationInheritanceTestCase.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesGenerationInheritanceTestCase.java index c1e9d52f36f9..433c14aa0723 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesGenerationInheritanceTestCase.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesGenerationInheritanceTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesNestedTestCase.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesNestedTestCase.java index 691e8dc86647..b9b79552e3bd 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesNestedTestCase.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesNestedTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesTopLevelTestCase.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesTopLevelTestCase.java index 69390065377d..b6392bfdc862 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesTopLevelTestCase.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesTopLevelTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/IterableFactory.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/IterableFactory.java index 1b756c88ff46..0dcb9c312037 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/IterableFactory.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/IterableFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/RandomlyOrderedTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/RandomlyOrderedTests.java index f43b586c03de..69ab15fe197b 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/RandomlyOrderedTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/RandomlyOrderedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/AbstractExecutionConditionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/AbstractExecutionConditionTests.java index d57298ec576c..2dceb1d3f2a8 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/AbstractExecutionConditionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/AbstractExecutionConditionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledForJreRangeConditionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledForJreRangeConditionTests.java index 01036e36a5a7..cfcd7fcdd9b5 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledForJreRangeConditionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledForJreRangeConditionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledForJreRangeIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledForJreRangeIntegrationTests.java index ff6ef050306b..b04aabc2cbef 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledForJreRangeIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledForJreRangeIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfConditionClassLoaderTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfConditionClassLoaderTests.java index a303597df5db..dcc46f577138 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfConditionClassLoaderTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfConditionClassLoaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfConditionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfConditionTests.java index 68c91b5733d1..ff4800b4511b 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfConditionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfConditionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfEnvironmentVariableConditionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfEnvironmentVariableConditionTests.java index b438f182d21d..c9c7434a5bea 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfEnvironmentVariableConditionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfEnvironmentVariableConditionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfEnvironmentVariableIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfEnvironmentVariableIntegrationTests.java index 19c5ca37eaa2..7cbf973286ee 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfEnvironmentVariableIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfEnvironmentVariableIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfIntegrationTests.java index 8f517b6bfe10..9efc7e998edb 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfSystemPropertyConditionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfSystemPropertyConditionTests.java index 97a56de0e4a4..3270e6cc97da 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfSystemPropertyConditionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfSystemPropertyConditionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfSystemPropertyIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfSystemPropertyIntegrationTests.java index 86b85672f0ec..67f71dbaf0dd 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfSystemPropertyIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledIfSystemPropertyIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledOnOsConditionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledOnOsConditionTests.java index 06c4b316337e..8a098c8a7e04 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledOnOsConditionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledOnOsConditionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledOnOsIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledOnOsIntegrationTests.java index 7dff43fb7d41..5ff83a468a9a 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledOnOsIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/DisabledOnOsIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledForJreRangeConditionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledForJreRangeConditionTests.java index 03b870b462ea..4bb80e722c6d 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledForJreRangeConditionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledForJreRangeConditionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledForJreRangeIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledForJreRangeIntegrationTests.java index 074b26f01da5..8ce5f2bc4329 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledForJreRangeIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledForJreRangeIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfConditionClassLoaderTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfConditionClassLoaderTests.java index 808d50fdd592..152a392eabc3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfConditionClassLoaderTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfConditionClassLoaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfConditionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfConditionTests.java index de2c55c2f7fd..274d9b87a042 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfConditionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfConditionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfEnvironmentVariableConditionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfEnvironmentVariableConditionTests.java index 4dcff0018ede..db0116e38695 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfEnvironmentVariableConditionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfEnvironmentVariableConditionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfEnvironmentVariableIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfEnvironmentVariableIntegrationTests.java index 6e5d0a1d0ff9..641eaf922f28 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfEnvironmentVariableIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfEnvironmentVariableIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfIntegrationTests.java index 6ff479f21209..4c790cbc2204 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfSystemPropertyConditionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfSystemPropertyConditionTests.java index 45d9ad15a657..d9391250e47f 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfSystemPropertyConditionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfSystemPropertyConditionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfSystemPropertyIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfSystemPropertyIntegrationTests.java index 325d42050345..e369f2168769 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfSystemPropertyIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledIfSystemPropertyIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledOnOsConditionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledOnOsConditionTests.java index 9dda47713c51..56c3f0431a37 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledOnOsConditionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledOnOsConditionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledOnOsIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledOnOsIntegrationTests.java index d79df561212b..77a9cae4b831 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledOnOsIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/EnabledOnOsIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/JRETests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/JRETests.java index 26e39ac49af6..548df968e8cc 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/JRETests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/JRETests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/StaticConditionMethods.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/StaticConditionMethods.java index eb113d684bfd..182f737fbe86 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/StaticConditionMethods.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/condition/StaticConditionMethods.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/CloseableResourceIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/CloseableResourceIntegrationTests.java index 8ff419f9d6d6..d6a60aa09e08 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/CloseableResourceIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/CloseableResourceIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExecutableInvokerIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExecutableInvokerIntegrationTests.java index f9b1458f349e..34e3f284596a 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExecutableInvokerIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExecutableInvokerIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExtensionComposabilityTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExtensionComposabilityTests.java index b624bed90df4..9fb7a9efa9dd 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExtensionComposabilityTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/ExtensionComposabilityTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java index 8ee6b62a4075..0d77cac0882e 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/KitchenSinkExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/MediaTypeTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/MediaTypeTests.java index d91aad51804e..b1d06036b6fc 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/MediaTypeTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/MediaTypeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/support/TypeBasedParameterResolverTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/support/TypeBasedParameterResolverTests.java index 0451bfd98260..eec416474611 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/support/TypeBasedParameterResolverTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/extension/support/TypeBasedParameterResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/LockTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/LockTests.java index 3c61edfeecc6..f0e54f73424f 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/LockTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/LockTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/ResourceLockAnnotationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/ResourceLockAnnotationTests.java index 16af5783e41c..2025c6e0ad49 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/ResourceLockAnnotationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/ResourceLockAnnotationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/ResourceLocksProviderTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/ResourceLocksProviderTests.java index 4fcf6a5012ad..8a73be42b8ee 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/ResourceLocksProviderTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/ResourceLocksProviderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/subpackage/SubclassedAssertionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/subpackage/SubclassedAssertionsTests.java index 0347d7be2303..1bd6484957f7 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/subpackage/SubclassedAssertionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/subpackage/SubclassedAssertionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/subpackage/SubclassedAssumptionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/subpackage/SubclassedAssumptionsTests.java index f7183446af82..ffc55bca0505 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/subpackage/SubclassedAssumptionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/subpackage/SubclassedAssumptionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/AbstractJupiterTestEngineTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/AbstractJupiterTestEngineTests.java index b868af74f87f..3ec1035ebb5c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/AbstractJupiterTestEngineTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/AbstractJupiterTestEngineTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/AtypicalJvmMethodNameTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/AtypicalJvmMethodNameTests.java index 9b54101ced9e..701515ed967b 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/AtypicalJvmMethodNameTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/AtypicalJvmMethodNameTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeAllAndAfterAllComposedAnnotationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeAllAndAfterAllComposedAnnotationTests.java index e62ea2d5cb27..69d19154ef21 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeAllAndAfterAllComposedAnnotationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeAllAndAfterAllComposedAnnotationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeEachAndAfterEachComposedAnnotationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeEachAndAfterEachComposedAnnotationTests.java index c9338fb40861..c59264075b7b 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeEachAndAfterEachComposedAnnotationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/BeforeEachAndAfterEachComposedAnnotationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultExecutionModeTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultExecutionModeTests.java index e116f4668472..57fdb111c7a7 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultExecutionModeTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultExecutionModeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultMethodTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultMethodTests.java index b548e26def2c..1561fbb76cce 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultMethodTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/DefaultMethodTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/DisabledTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/DisabledTests.java index d9af4d65202c..0e956d97ff87 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/DisabledTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/DisabledTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/DynamicNodeGenerationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/DynamicNodeGenerationTests.java index 17e57d80ac61..30dcea34760c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/DynamicNodeGenerationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/DynamicNodeGenerationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/ExceptionHandlingTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/ExceptionHandlingTests.java index e039e37e448f..e1b460a292a1 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/ExceptionHandlingTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/ExceptionHandlingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/FailedAssumptionsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/FailedAssumptionsTests.java index 8aec67537576..6f1b05b6261e 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/FailedAssumptionsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/FailedAssumptionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/InvalidLifecycleMethodConfigurationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/InvalidLifecycleMethodConfigurationTests.java index 461c24c3a779..e1d7a47cfce6 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/InvalidLifecycleMethodConfigurationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/InvalidLifecycleMethodConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/JupiterTestEngineBasicTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/JupiterTestEngineBasicTests.java index bc07210ac92d..dd242d20132a 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/JupiterTestEngineBasicTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/JupiterTestEngineBasicTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/LifecycleMethodOverridingTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/LifecycleMethodOverridingTests.java index f9e7f0b3ec89..39597094df51 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/LifecycleMethodOverridingTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/LifecycleMethodOverridingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/MultipleTestableAnnotationsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/MultipleTestableAnnotationsTests.java index 713f56d52ca7..6aa1fc0e1c84 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/MultipleTestableAnnotationsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/MultipleTestableAnnotationsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/NestedTestClassesTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/NestedTestClassesTests.java index 72650a841dec..634aa46c34de 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/NestedTestClassesTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/NestedTestClassesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/NestedWithInheritanceTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/NestedWithInheritanceTests.java index 032d9bb33df7..3b3602e09fb8 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/NestedWithInheritanceTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/NestedWithInheritanceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/NestedWithSeparateInheritanceTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/NestedWithSeparateInheritanceTests.java index c5f7f808ba9d..b73cee268861 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/NestedWithSeparateInheritanceTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/NestedWithSeparateInheritanceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/NonVoidTestableMethodIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/NonVoidTestableMethodIntegrationTests.java index b3694440c4f0..c00cac6960dd 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/NonVoidTestableMethodIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/NonVoidTestableMethodIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/OverloadedTestMethodTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/OverloadedTestMethodTests.java index bcd5d5f8fed3..d0669f81cbe4 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/OverloadedTestMethodTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/OverloadedTestMethodTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/RecordTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/RecordTests.java index a42187591b72..74ef3bc0d803 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/RecordTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/RecordTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java index f73a59a4f163..7d69e5d8c932 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/ReportingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/SealedClassTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/SealedClassTests.java index bcbf37408c68..899cf5333280 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/SealedClassTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/SealedClassTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/StandardTestClassTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/StandardTestClassTests.java index a5d1b6bfb6a2..18459ff98194 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/StandardTestClassTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/StandardTestClassTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/StaticNestedBeforeAllAndAfterAllMethodsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/StaticNestedBeforeAllAndAfterAllMethodsTests.java index 431830a6495f..47ef8231cc38 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/StaticNestedBeforeAllAndAfterAllMethodsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/StaticNestedBeforeAllAndAfterAllMethodsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestClassInheritanceTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestClassInheritanceTests.java index aed5b3eaa969..7db63a5e3021 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestClassInheritanceTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestClassInheritanceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleConfigurationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleConfigurationTests.java index 740807fbf0e3..fdb7e512ce75 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleConfigurationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleKotlinTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleKotlinTests.java index 6a1f1cf843f5..c4fd1d8087c3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleKotlinTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleKotlinTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleTests.java index a80c660b9a69..91676086da86 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestInstanceLifecycleTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestTemplateInvocationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestTemplateInvocationTests.java index 921ec12060b1..b9427e78e6e6 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestTemplateInvocationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/TestTemplateInvocationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/AbstractNonGenericTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/AbstractNonGenericTests.java index fc4a7616f884..823ccbd591ca 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/AbstractNonGenericTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/AbstractNonGenericTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/AbstractNumberTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/AbstractNumberTests.java index 2f3f06bbb4d7..6357ab8f9ad4 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/AbstractNumberTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/AbstractNumberTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/BridgeMethodTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/BridgeMethodTests.java index 87a9c02cdd17..2483cb2e4e8a 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/BridgeMethodTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/BridgeMethodTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/ChildWithBridgeMethods.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/ChildWithBridgeMethods.java index 373b6a0e5bb0..9aa56c376e4a 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/ChildWithBridgeMethods.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/ChildWithBridgeMethods.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/ChildWithoutBridgeMethods.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/ChildWithoutBridgeMethods.java index 52a8afcfa9b5..60dff28fa5d7 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/ChildWithoutBridgeMethods.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/ChildWithoutBridgeMethods.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/NumberResolver.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/NumberResolver.java index 9da2a5c20721..7bf5fdea49f9 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/NumberResolver.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/NumberResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/NumberTestGroup.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/NumberTestGroup.java index 4c66e26c42c9..0e83f8ac3c02 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/NumberTestGroup.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/NumberTestGroup.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/PackagePrivateParent.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/PackagePrivateParent.java index 2aed5ec13288..0807c14f3252 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/PackagePrivateParent.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/bridge/PackagePrivateParent.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/config/CachingJupiterConfigurationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/config/CachingJupiterConfigurationTests.java index 5d1214a68972..7f961da52cc6 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/config/CachingJupiterConfigurationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/config/CachingJupiterConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/config/DefaultJupiterConfigurationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/config/DefaultJupiterConfigurationTests.java index 2b329c1704c1..ba7daa0fe4bb 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/config/DefaultJupiterConfigurationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/config/DefaultJupiterConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/config/InstantiatingConfigurationParameterConverterTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/config/InstantiatingConfigurationParameterConverterTests.java index c5bb4939fc5c..0f8f6b630c38 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/config/InstantiatingConfigurationParameterConverterTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/config/InstantiatingConfigurationParameterConverterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/CustomDisplayNameGenerator.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/CustomDisplayNameGenerator.java index 3e3c7c411d01..f7b8afae102c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/CustomDisplayNameGenerator.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/CustomDisplayNameGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/DisplayNameUtilsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/DisplayNameUtilsTests.java index 1bd74fd21f55..a5d019e1f95a 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/DisplayNameUtilsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/DisplayNameUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java index 04dc2cf5ece1..482290a3c559 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionsUtilsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionsUtilsTests.java index b7afbb0c44b4..2ede30ff8fc4 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionsUtilsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionsUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptorTests.java index f2f07aca4548..7a8266f7f19f 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/JupiterTestDescriptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtilsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtilsTests.java index 9705c1fa162f..719f335679bf 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtilsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/LifecycleMethodUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/NamespaceTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/NamespaceTests.java index 8841c01c3efa..500c36113a7d 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/NamespaceTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/NamespaceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestFactoryTestDescriptorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestFactoryTestDescriptorTests.java index b16f765f0e91..618d290870d2 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestFactoryTestDescriptorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestFactoryTestDescriptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestInstanceLifecycleUtilsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestInstanceLifecycleUtilsTests.java index 4a6e6294d80a..186604bc98a9 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestInstanceLifecycleUtilsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestInstanceLifecycleUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestTemplateInvocationTestDescriptorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestTemplateInvocationTestDescriptorTests.java index 0e0834f3e105..0491150abb57 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestTemplateInvocationTestDescriptorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestTemplateInvocationTestDescriptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptorTests.java index ecc410f2af2f..1cd492db23ce 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/Class1WithTestCases.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/Class1WithTestCases.java index 8d34c3705df0..a990fdf2b21a 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/Class1WithTestCases.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/Class1WithTestCases.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/Class2WithTestCases.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/Class2WithTestCases.java index 49f87adb29e6..0327f7ed288b 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/Class2WithTestCases.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/Class2WithTestCases.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/ClassWithStaticInnerTestCases.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/ClassWithStaticInnerTestCases.java index 4f5b578f3124..aec19a0891a4 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/ClassWithStaticInnerTestCases.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/ClassWithStaticInnerTestCases.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/ClassWithoutTestCases.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/ClassWithoutTestCases.java index e1c29f8e0c64..bb5682af0c86 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/ClassWithoutTestCases.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/subpackage/ClassWithoutTestCases.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolverTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolverTests.java index 3e81ce9a98c9..6c74b09dbbb4 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolverTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoverySelectorResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoveryTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoveryTests.java index 3916735e44ec..7d5a91951bc3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoveryTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/DiscoveryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsInnerClassTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsInnerClassTests.java index dfc305708a55..d371fd3f2e03 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsInnerClassTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsInnerClassTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsNestedTestClassTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsNestedTestClassTests.java index 37133ca9587e..609785f4a3e4 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsNestedTestClassTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsNestedTestClassTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsPotentialTestContainerTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsPotentialTestContainerTests.java index 8b2a36d9bf1f..47c9c7143815 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsPotentialTestContainerTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsPotentialTestContainerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestClassWithTestsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestClassWithTestsTests.java index f92921c82932..c07e5eff03c1 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestClassWithTestsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestClassWithTestsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestFactoryMethodTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestFactoryMethodTests.java index cc07c58e3f63..6487d0927db3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestFactoryMethodTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestFactoryMethodTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestMethodTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestMethodTests.java index 0865ef4889ed..c8787aafaa20 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestMethodTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestMethodTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestTemplateMethodTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestTemplateMethodTests.java index d5bf7b0b927c..a71da9ec39b0 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestTemplateMethodTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/discovery/predicates/IsTestTemplateMethodTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/AbstractExecutableInvokerTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/AbstractExecutableInvokerTests.java index a1992c0670f1..c054f3ec1220 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/AbstractExecutableInvokerTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/AbstractExecutableInvokerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/DefaultExecutableInvokerTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/DefaultExecutableInvokerTests.java index b09c9cec7f83..c9db82e0dd9c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/DefaultExecutableInvokerTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/DefaultExecutableInvokerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/DefaultTestInstancesTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/DefaultTestInstancesTests.java index 24c836c173ee..8928a59a0607 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/DefaultTestInstancesTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/DefaultTestInstancesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/DynamicTestIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/DynamicTestIntegrationTests.java index 561ead14e647..f9f666cbda76 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/DynamicTestIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/DynamicTestIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/ExtensionContextStoreConcurrencyTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/ExtensionContextStoreConcurrencyTests.java index 305f94173a52..199b6903f46b 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/ExtensionContextStoreConcurrencyTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/ExtensionContextStoreConcurrencyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/ExtensionContextStoreTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/ExtensionContextStoreTests.java index 07ba68b15886..2c62a186b9fa 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/ExtensionContextStoreTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/ExtensionContextStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvokerTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvokerTests.java index 6de1cd4935eb..58d96e0ecce1 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvokerTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/InterceptingExecutableInvokerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/JupiterEngineExecutionContextTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/JupiterEngineExecutionContextTests.java index c85403ebae22..80eeca958fbd 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/JupiterEngineExecutionContextTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/JupiterEngineExecutionContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/ParameterResolutionUtilsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/ParameterResolutionUtilsTests.java index 34b18e0723b8..54e175b8bc6f 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/ParameterResolutionUtilsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/ParameterResolutionUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/UniqueIdParsingForArrayParameterIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/UniqueIdParsingForArrayParameterIntegrationTests.java index 7f5dde7869f2..71035953ee13 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/UniqueIdParsingForArrayParameterIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/UniqueIdParsingForArrayParameterIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/CustomAnnotation.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/CustomAnnotation.java index 8fa982dc3a5e..9e04410e1c6f 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/CustomAnnotation.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/CustomAnnotation.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/CustomAnnotationParameterResolver.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/CustomAnnotationParameterResolver.java index f15c5c5eb966..eec47744f5ca 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/CustomAnnotationParameterResolver.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/CustomAnnotationParameterResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/CustomType.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/CustomType.java index d1dc6f4983b3..5545582f7ce0 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/CustomType.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/CustomType.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/CustomTypeParameterResolver.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/CustomTypeParameterResolver.java index 9a75754d2180..126e5ee751bd 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/CustomTypeParameterResolver.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/CustomTypeParameterResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/DoubleParameterResolver.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/DoubleParameterResolver.java index 1659da6705a3..ab714e19f011 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/DoubleParameterResolver.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/DoubleParameterResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/LongParameterResolver.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/LongParameterResolver.java index a59dc6f7a898..b668e8fc9609 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/LongParameterResolver.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/LongParameterResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/MapOfListsTypeBasedParameterResolver.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/MapOfListsTypeBasedParameterResolver.java index b8a0172970e7..5858080ad462 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/MapOfListsTypeBasedParameterResolver.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/MapOfListsTypeBasedParameterResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/MapOfStringsParameterResolver.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/MapOfStringsParameterResolver.java index 3d7d531e4b77..e669fe26b07b 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/MapOfStringsParameterResolver.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/MapOfStringsParameterResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/NullIntegerParameterResolver.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/NullIntegerParameterResolver.java index 7a73b82d8623..2419640c9fb4 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/NullIntegerParameterResolver.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/NullIntegerParameterResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/NumberParameterResolver.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/NumberParameterResolver.java index 66d8e4d7e85f..d2450ec7cbf6 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/NumberParameterResolver.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/NumberParameterResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/PrimitiveArrayParameterResolver.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/PrimitiveArrayParameterResolver.java index d3fac903d770..23a693608381 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/PrimitiveArrayParameterResolver.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/PrimitiveArrayParameterResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/PrimitiveIntegerParameterResolver.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/PrimitiveIntegerParameterResolver.java index e042489a471e..0e986fffdaf7 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/PrimitiveIntegerParameterResolver.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/execution/injection/sample/PrimitiveIntegerParameterResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/AutoCloseTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/AutoCloseTests.java index 7677923d6122..c1fc0ed4cfa1 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/AutoCloseTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/AutoCloseTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterAllTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterAllTests.java index c3f98cb7ec4a..34ebef190656 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterAllTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterAllTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterEachTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterEachTests.java index 123b786e3d93..e6856ea36e0e 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterEachTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterEachTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterTestExecutionCallbackTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterTestExecutionCallbackTests.java index b6cd2fb8df09..119b2ecb6909 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterTestExecutionCallbackTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/BeforeAndAfterTestExecutionCallbackTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/CloseablePathTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/CloseablePathTests.java index 11a55e711610..12a1ad739482 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/CloseablePathTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/CloseablePathTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ConfigLoaderExtension.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ConfigLoaderExtension.java index 9112e8587a7b..e5228e78624a 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ConfigLoaderExtension.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ConfigLoaderExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/DefaultTestReporterTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/DefaultTestReporterTests.java index 9405ff457aca..d4eb9b5a3b25 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/DefaultTestReporterTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/DefaultTestReporterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/EnigmaException.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/EnigmaException.java index 1db44a0f6198..96651e87078c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/EnigmaException.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/EnigmaException.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/EventuallyInterruptibleInvocation.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/EventuallyInterruptibleInvocation.java index 67d6314d4b6b..57a14765bcc5 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/EventuallyInterruptibleInvocation.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/EventuallyInterruptibleInvocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExecutionConditionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExecutionConditionTests.java index 03005f9bd1df..e414483a6bcc 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExecutionConditionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExecutionConditionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionContextExecutionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionContextExecutionTests.java index 3a6605bbc3af..c3214cf18aad 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionContextExecutionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionContextExecutionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistrationViaParametersAndFieldsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistrationViaParametersAndFieldsTests.java index a9f04addddd6..c70238d7473e 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistrationViaParametersAndFieldsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistrationViaParametersAndFieldsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistryTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistryTests.java index 06163b90377e..ce27bf7d0c85 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistryTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ExtensionRegistryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/InvocationInterceptorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/InvocationInterceptorTests.java index 4f9b6391f5fb..b9b39cecff58 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/InvocationInterceptorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/InvocationInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/LifecycleMethodExecutionExceptionHandlerTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/LifecycleMethodExecutionExceptionHandlerTests.java index 7bc8c447ba97..30f8cb052e21 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/LifecycleMethodExecutionExceptionHandlerTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/LifecycleMethodExecutionExceptionHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedClassTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedClassTests.java index 19d28c9fcbb9..ff8560830382 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedClassTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedClassTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedMethodTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedMethodTests.java index eeeea87571e0..2d859001066a 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedMethodTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedMethodTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedProgrammaticExtensionRegistrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedProgrammaticExtensionRegistrationTests.java index c9f451ed4e2b..1cd4632dc28e 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedProgrammaticExtensionRegistrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/OrderedProgrammaticExtensionRegistrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ParameterResolverTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ParameterResolverTests.java index 87919d8a087f..500a1fcbd1f3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ParameterResolverTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ParameterResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/PreInterruptCallbackTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/PreInterruptCallbackTests.java index 6f39ed398da7..13ea7eff61d1 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/PreInterruptCallbackTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/PreInterruptCallbackTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ProgrammaticExtensionRegistrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ProgrammaticExtensionRegistrationTests.java index ac2f02350a66..e168d58cc974 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ProgrammaticExtensionRegistrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ProgrammaticExtensionRegistrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/RepeatedTestTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/RepeatedTestTests.java index 410255454622..567a38431463 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/RepeatedTestTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/RepeatedTestTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/SameThreadTimeoutInvocationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/SameThreadTimeoutInvocationTests.java index 6a2191f8e015..bf5f4d192f9b 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/SameThreadTimeoutInvocationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/SameThreadTimeoutInvocationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/SeparateThreadTimeoutInvocationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/SeparateThreadTimeoutInvocationTests.java index 166fcb0897e2..750611a5c67a 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/SeparateThreadTimeoutInvocationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/SeparateThreadTimeoutInvocationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ServiceLoaderExtension.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ServiceLoaderExtension.java index aab386b973e0..b56f4febb31c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ServiceLoaderExtension.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/ServiceLoaderExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryCleanupTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryCleanupTests.java index 95f1c19eb285..6a7d687fc1a3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryCleanupTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryCleanupTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryMetaAnnotationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryMetaAnnotationTests.java index a156270e356f..338ba7dd286a 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryMetaAnnotationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryMetaAnnotationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerContextTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerContextTests.java index 07202e36696a..6200f2e47645 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerContextTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerDeclarationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerDeclarationTests.java index 5414e18a5af3..2deb303768b9 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerDeclarationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPerDeclarationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPreconditionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPreconditionTests.java index ebfa6cd8a054..fc3f84f3a146 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPreconditionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TempDirectoryPreconditionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestExecutionExceptionHandlerTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestExecutionExceptionHandlerTests.java index 86a07926465b..4fbebbcc1102 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestExecutionExceptionHandlerTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestExecutionExceptionHandlerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInfoParameterResolverTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInfoParameterResolverTests.java index 63a6cf8b985c..835b5e518ddd 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInfoParameterResolverTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInfoParameterResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java index 1549260f0007..8e670d0a3601 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstanceFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorAndPreDestroyCallbackTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorAndPreDestroyCallbackTests.java index bcd968a5f466..974d82af7679 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorAndPreDestroyCallbackTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorAndPreDestroyCallbackTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java index 0a1c3fa0e0d8..8299c1cbff1e 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePostProcessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java index 0065d9234d10..a73e0c494505 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreConstructCallbackTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreDestroyCallbackTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreDestroyCallbackTests.java index 3ae4d8997537..f2d05a8dc002 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreDestroyCallbackTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreDestroyCallbackTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreDestroyCallbackUtilityMethodTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreDestroyCallbackUtilityMethodTests.java index 23dd06a39efa..1a96f9639b98 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreDestroyCallbackUtilityMethodTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestInstancePreDestroyCallbackUtilityMethodTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestReporterParameterResolverTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestReporterParameterResolverTests.java index 0f16131b8ff3..f785fb791744 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestReporterParameterResolverTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestReporterParameterResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestWatcherTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestWatcherTests.java index fdbde376dfe9..05d318c12418 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestWatcherTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TestWatcherTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutConfigurationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutConfigurationTests.java index 52dd96bb08f3..ffda80ba26a3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutConfigurationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutDurationParserTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutDurationParserTests.java index 14fe2ce0f5e0..2c727766eee8 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutDurationParserTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutDurationParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutDurationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutDurationTests.java index cf20a202ad4a..a950ca372255 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutDurationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutDurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutExceptionFactoryTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutExceptionFactoryTests.java index 34a621391141..3c5c5a29602e 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutExceptionFactoryTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutExceptionFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutExtensionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutExtensionTests.java index 85b00639a6bd..8cfd1f1c24d3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutExtensionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutExtensionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactoryTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactoryTests.java index 8c91d4b231c3..234a2c19e63e 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactoryTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/TimeoutInvocationFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/sub/AlwaysDisabledCondition.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/sub/AlwaysDisabledCondition.java index ba60a5f27ac5..d32cb1bfe3eb 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/sub/AlwaysDisabledCondition.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/sub/AlwaysDisabledCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/sub/AnotherAlwaysDisabledCondition.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/sub/AnotherAlwaysDisabledCondition.java index 2dd26dfcda19..9683666a67d4 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/sub/AnotherAlwaysDisabledCondition.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/sub/AnotherAlwaysDisabledCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/sub/SystemPropertyCondition.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/sub/SystemPropertyCondition.java index a05ccd37e014..bb50d774a31c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/sub/SystemPropertyCondition.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/extension/sub/SystemPropertyCondition.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/subpackage/SuperClassWithPackagePrivateLifecycleMethodInDifferentPackageTestCase.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/subpackage/SuperClassWithPackagePrivateLifecycleMethodInDifferentPackageTestCase.java index 77e807247f7b..07f895044a7b 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/subpackage/SuperClassWithPackagePrivateLifecycleMethodInDifferentPackageTestCase.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/subpackage/SuperClassWithPackagePrivateLifecycleMethodInDifferentPackageTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/support/OpenTest4JAndJUnit4AwareThrowableCollectorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/support/OpenTest4JAndJUnit4AwareThrowableCollectorTests.java index 3c81342dc92d..846f8886fc8c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/support/OpenTest4JAndJUnit4AwareThrowableCollectorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/support/OpenTest4JAndJUnit4AwareThrowableCollectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/JupiterMigrationSupportTestSuite.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/JupiterMigrationSupportTestSuite.java index 80cca83a0b5c..1dfe99b4cafe 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/JupiterMigrationSupportTestSuite.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/JupiterMigrationSupportTestSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/conditions/IgnoreAnnotationIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/conditions/IgnoreAnnotationIntegrationTests.java index 0c9487556d82..532703006296 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/conditions/IgnoreAnnotationIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/conditions/IgnoreAnnotationIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/conditions/IgnoreConditionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/conditions/IgnoreConditionTests.java index b50fe4528742..d1c3556cec40 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/conditions/IgnoreConditionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/conditions/IgnoreConditionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/AbstractTestRuleAdapterTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/AbstractTestRuleAdapterTests.java index 3457cf3ed04c..9890182b4a40 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/AbstractTestRuleAdapterTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/AbstractTestRuleAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/EnableRuleMigrationSupportWithBothRuleTypesTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/EnableRuleMigrationSupportWithBothRuleTypesTests.java index 14ef7fb260e8..ba149cdf0e1b 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/EnableRuleMigrationSupportWithBothRuleTypesTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/EnableRuleMigrationSupportWithBothRuleTypesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExpectedExceptionSupportTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExpectedExceptionSupportTests.java index cf54fc79e067..2ee4f9155881 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExpectedExceptionSupportTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExpectedExceptionSupportTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForDifferentDeclaredReturnTypesRulesTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForDifferentDeclaredReturnTypesRulesTests.java index 9f9db6def7b3..c71f63ac9178 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForDifferentDeclaredReturnTypesRulesTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForDifferentDeclaredReturnTypesRulesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForMixedMethodAndFieldRulesTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForMixedMethodAndFieldRulesTests.java index 18567a385668..c4fc1b66a0d3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForMixedMethodAndFieldRulesTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForMixedMethodAndFieldRulesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForMultipleFieldRulesTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForMultipleFieldRulesTests.java index 6cc63fd9828e..f2ba8354f6cc 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForMultipleFieldRulesTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForMultipleFieldRulesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForMultipleMethodRulesTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForMultipleMethodRulesTests.java index 593c02cff54c..e5ad795f43c0 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForMultipleMethodRulesTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForMultipleMethodRulesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForTemporaryFolderFieldTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForTemporaryFolderFieldTests.java index 8495213209e7..c58690716548 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForTemporaryFolderFieldTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportForTemporaryFolderFieldTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportWithInheritanceTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportWithInheritanceTests.java index 230e6e0b59b4..71b645e6a9a9 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportWithInheritanceTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceSupportWithInheritanceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceWithoutAdapterTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceWithoutAdapterTests.java index 474135bd0fca..18c70f02eddc 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceWithoutAdapterTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/ExternalResourceWithoutAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/FailAfterAllHelper.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/FailAfterAllHelper.java index 57fc525000a6..ae15007c7462 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/FailAfterAllHelper.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/FailAfterAllHelper.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/LauncherBasedEnableRuleMigrationSupportTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/LauncherBasedEnableRuleMigrationSupportTests.java index 13194fa224d5..1a022944706b 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/LauncherBasedEnableRuleMigrationSupportTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/LauncherBasedEnableRuleMigrationSupportTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/VerifierSupportForMixedMethodAndFieldRulesTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/VerifierSupportForMixedMethodAndFieldRulesTests.java index 50f5158ded28..42a292c7e860 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/VerifierSupportForMixedMethodAndFieldRulesTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/VerifierSupportForMixedMethodAndFieldRulesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/WrongExtendWithForVerifierFieldTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/WrongExtendWithForVerifierFieldTests.java index b2a7335794b6..ec4c7871fdb3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/WrongExtendWithForVerifierFieldTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/WrongExtendWithForVerifierFieldTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/WrongExtendWithForVerifierMethodTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/WrongExtendWithForVerifierMethodTests.java index 12ff43594287..77d89f7bddb7 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/WrongExtendWithForVerifierMethodTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/migrationsupport/rules/WrongExtendWithForVerifierMethodTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java index 03862588dc3c..aa36f907aa25 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestExtensionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java index ad28cd7fa555..eabe6470ec83 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestMethodContextTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestMethodContextTests.java index e2ce097ca4c5..7272b084a52d 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestMethodContextTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestMethodContextTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestNameFormatterTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestNameFormatterTests.java index c95332c171bb..fc07dae767a9 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestNameFormatterTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestNameFormatterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestSuite.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestSuite.java index 3d16c471d0d2..a52d27408719 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestSuite.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/ParameterizedTestSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/aggregator/AggregatorIntegrationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/aggregator/AggregatorIntegrationTests.java index 96a4890088b1..90bfcb7b367b 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/aggregator/AggregatorIntegrationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/aggregator/AggregatorIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/aggregator/DefaultArgumentsAccessorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/aggregator/DefaultArgumentsAccessorTests.java index 421e6bb0af4d..22d1ce685a67 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/aggregator/DefaultArgumentsAccessorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/aggregator/DefaultArgumentsAccessorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/DefaultArgumentConverterTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/DefaultArgumentConverterTests.java index 3dfe8c44dd89..609f83cd95d3 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/DefaultArgumentConverterTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/DefaultArgumentConverterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/JavaTimeArgumentConverterTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/JavaTimeArgumentConverterTests.java index 095fcb983176..2cee9d79f7c9 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/JavaTimeArgumentConverterTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/JavaTimeArgumentConverterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/TypedArgumentConverterTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/TypedArgumentConverterTests.java index e181fa58f911..599f3d2e9163 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/TypedArgumentConverterTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/converter/TypedArgumentConverterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/AnnotationBasedArgumentsProviderTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/AnnotationBasedArgumentsProviderTests.java index af6e1eec06bd..0cbbb252204c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/AnnotationBasedArgumentsProviderTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/AnnotationBasedArgumentsProviderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/ArgumentsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/ArgumentsTests.java index 3a56f283a2da..76dd591f7101 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/ArgumentsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/ArgumentsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/CsvArgumentsProviderTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/CsvArgumentsProviderTests.java index 4aec498e9eca..4a1e9722e0a9 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/CsvArgumentsProviderTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/CsvArgumentsProviderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/CsvFileArgumentsProviderTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/CsvFileArgumentsProviderTests.java index f43ea0a2d01f..63f5a7aa3a76 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/CsvFileArgumentsProviderTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/CsvFileArgumentsProviderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/EnumArgumentsProviderTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/EnumArgumentsProviderTests.java index 6a5312085776..a8363ce1c716 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/EnumArgumentsProviderTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/EnumArgumentsProviderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/EnumSourceTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/EnumSourceTests.java index 819dd6bd56df..1e37beb124c1 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/EnumSourceTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/EnumSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/FieldArgumentsProviderTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/FieldArgumentsProviderTests.java index afe49a882000..a8a395cea0ac 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/FieldArgumentsProviderTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/FieldArgumentsProviderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/MethodArgumentsProviderTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/MethodArgumentsProviderTests.java index 54287492112e..50e8bcc83ee2 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/MethodArgumentsProviderTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/MethodArgumentsProviderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/MockCsvAnnotationBuilder.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/MockCsvAnnotationBuilder.java index c3b3c10648bb..22434b0f243f 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/MockCsvAnnotationBuilder.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/MockCsvAnnotationBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/ValueArgumentsProviderTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/ValueArgumentsProviderTests.java index dea71ff0f727..bbfaf94b69f0 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/ValueArgumentsProviderTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/ValueArgumentsProviderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/support/AnnotationConsumerInitializerTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/support/AnnotationConsumerInitializerTests.java index b60da429e03e..b304ec8f4baa 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/support/AnnotationConsumerInitializerTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/support/AnnotationConsumerInitializerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/kotlin/org/junit/jupiter/api/KotlinAssertTimeoutAssertionsTests.kt b/jupiter-tests/src/test/kotlin/org/junit/jupiter/api/KotlinAssertTimeoutAssertionsTests.kt index ea057f658bd5..ad06f68f928e 100644 --- a/jupiter-tests/src/test/kotlin/org/junit/jupiter/api/KotlinAssertTimeoutAssertionsTests.kt +++ b/jupiter-tests/src/test/kotlin/org/junit/jupiter/api/KotlinAssertTimeoutAssertionsTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/kotlin/org/junit/jupiter/api/KotlinAssertionsTests.kt b/jupiter-tests/src/test/kotlin/org/junit/jupiter/api/KotlinAssertionsTests.kt index 9e6958c10ebe..8160432ac52d 100644 --- a/jupiter-tests/src/test/kotlin/org/junit/jupiter/api/KotlinAssertionsTests.kt +++ b/jupiter-tests/src/test/kotlin/org/junit/jupiter/api/KotlinAssertionsTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/kotlin/org/junit/jupiter/api/KotlinFailAssertionsTests.kt b/jupiter-tests/src/test/kotlin/org/junit/jupiter/api/KotlinFailAssertionsTests.kt index 2b1311232187..d0e026669a22 100644 --- a/jupiter-tests/src/test/kotlin/org/junit/jupiter/api/KotlinFailAssertionsTests.kt +++ b/jupiter-tests/src/test/kotlin/org/junit/jupiter/api/KotlinFailAssertionsTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/kotlin/org/junit/jupiter/engine/kotlin/ArbitraryNamingKotlinTestCase.kt b/jupiter-tests/src/test/kotlin/org/junit/jupiter/engine/kotlin/ArbitraryNamingKotlinTestCase.kt index 2a3737f56f0b..662b608b0f69 100644 --- a/jupiter-tests/src/test/kotlin/org/junit/jupiter/engine/kotlin/ArbitraryNamingKotlinTestCase.kt +++ b/jupiter-tests/src/test/kotlin/org/junit/jupiter/engine/kotlin/ArbitraryNamingKotlinTestCase.kt @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/kotlin/org/junit/jupiter/engine/kotlin/InstancePerClassKotlinTestCase.kt b/jupiter-tests/src/test/kotlin/org/junit/jupiter/engine/kotlin/InstancePerClassKotlinTestCase.kt index ef87340692f6..baa72c6d7455 100644 --- a/jupiter-tests/src/test/kotlin/org/junit/jupiter/engine/kotlin/InstancePerClassKotlinTestCase.kt +++ b/jupiter-tests/src/test/kotlin/org/junit/jupiter/engine/kotlin/InstancePerClassKotlinTestCase.kt @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/kotlin/org/junit/jupiter/engine/kotlin/InstancePerMethodKotlinTestCase.kt b/jupiter-tests/src/test/kotlin/org/junit/jupiter/engine/kotlin/InstancePerMethodKotlinTestCase.kt index 463a39ad9473..494fcdacb03a 100644 --- a/jupiter-tests/src/test/kotlin/org/junit/jupiter/engine/kotlin/InstancePerMethodKotlinTestCase.kt +++ b/jupiter-tests/src/test/kotlin/org/junit/jupiter/engine/kotlin/InstancePerMethodKotlinTestCase.kt @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/kotlin/org/junit/jupiter/params/ParameterizedTestNameFormatterIntegrationTests.kt b/jupiter-tests/src/test/kotlin/org/junit/jupiter/params/ParameterizedTestNameFormatterIntegrationTests.kt index a5dc306c1bb2..5ce7d3fabdae 100644 --- a/jupiter-tests/src/test/kotlin/org/junit/jupiter/params/ParameterizedTestNameFormatterIntegrationTests.kt +++ b/jupiter-tests/src/test/kotlin/org/junit/jupiter/params/ParameterizedTestNameFormatterIntegrationTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/kotlin/org/junit/jupiter/params/aggregator/ArgumentsAccessorKotlinTests.kt b/jupiter-tests/src/test/kotlin/org/junit/jupiter/params/aggregator/ArgumentsAccessorKotlinTests.kt index c3b97696cc5c..479a625775cc 100644 --- a/jupiter-tests/src/test/kotlin/org/junit/jupiter/params/aggregator/ArgumentsAccessorKotlinTests.kt +++ b/jupiter-tests/src/test/kotlin/org/junit/jupiter/params/aggregator/ArgumentsAccessorKotlinTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/jupiter-tests/src/test/kotlin/org/junit/jupiter/params/aggregator/DisplayNameTests.kt b/jupiter-tests/src/test/kotlin/org/junit/jupiter/params/aggregator/DisplayNameTests.kt index d12ac782b0f6..12d9b336860f 100644 --- a/jupiter-tests/src/test/kotlin/org/junit/jupiter/params/aggregator/DisplayNameTests.kt +++ b/jupiter-tests/src/test/kotlin/org/junit/jupiter/params/aggregator/DisplayNameTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/jmh/java/org/junit/jupiter/jmh/AssertionBenchmarks.java b/platform-tests/src/jmh/java/org/junit/jupiter/jmh/AssertionBenchmarks.java index 6b0940f6de80..79824e02ca90 100644 --- a/platform-tests/src/jmh/java/org/junit/jupiter/jmh/AssertionBenchmarks.java +++ b/platform-tests/src/jmh/java/org/junit/jupiter/jmh/AssertionBenchmarks.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/processStarter/java/org/junit/platform/tests/process/OutputFiles.java b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/OutputFiles.java index 379e94e124d4..61208e404262 100644 --- a/platform-tests/src/processStarter/java/org/junit/platform/tests/process/OutputFiles.java +++ b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/OutputFiles.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/processStarter/java/org/junit/platform/tests/process/ProcessResult.java b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/ProcessResult.java index 9c018e7aaf79..a05302abef85 100644 --- a/platform-tests/src/processStarter/java/org/junit/platform/tests/process/ProcessResult.java +++ b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/ProcessResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/processStarter/java/org/junit/platform/tests/process/ProcessStarter.java b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/ProcessStarter.java index 277ecf13508c..e438c017a0c0 100644 --- a/platform-tests/src/processStarter/java/org/junit/platform/tests/process/ProcessStarter.java +++ b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/ProcessStarter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/processStarter/java/org/junit/platform/tests/process/WatchedOutput.java b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/WatchedOutput.java index 573dd4933128..a2c35e9e9a4d 100644 --- a/platform-tests/src/processStarter/java/org/junit/platform/tests/process/WatchedOutput.java +++ b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/WatchedOutput.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/processStarter/java/org/junit/platform/tests/process/WatchedProcess.java b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/WatchedProcess.java index 62bdbd5eede2..b3a864bce6ff 100644 --- a/platform-tests/src/processStarter/java/org/junit/platform/tests/process/WatchedProcess.java +++ b/platform-tests/src/processStarter/java/org/junit/platform/tests/process/WatchedProcess.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/DefaultPackageTestCase.java b/platform-tests/src/test/java/DefaultPackageTestCase.java index 5acabf2e975d..600942ad8147 100644 --- a/platform-tests/src/test/java/DefaultPackageTestCase.java +++ b/platform-tests/src/test/java/DefaultPackageTestCase.java @@ -1,6 +1,6 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/jupiter/api/condition/OSTests.java b/platform-tests/src/test/java/org/junit/jupiter/api/condition/OSTests.java index 971e6ab9e035..70a0c42350e1 100644 --- a/platform-tests/src/test/java/org/junit/jupiter/api/condition/OSTests.java +++ b/platform-tests/src/test/java/org/junit/jupiter/api/condition/OSTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/jupiter/extensions/Heavyweight.java b/platform-tests/src/test/java/org/junit/jupiter/extensions/Heavyweight.java index 208b0a5cac27..ce5370f1ec28 100644 --- a/platform-tests/src/test/java/org/junit/jupiter/extensions/Heavyweight.java +++ b/platform-tests/src/test/java/org/junit/jupiter/extensions/Heavyweight.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/jupiter/extensions/HeavyweightTests.java b/platform-tests/src/test/java/org/junit/jupiter/extensions/HeavyweightTests.java index 5f0aaf1911be..6c278c9ae8c2 100644 --- a/platform-tests/src/test/java/org/junit/jupiter/extensions/HeavyweightTests.java +++ b/platform-tests/src/test/java/org/junit/jupiter/extensions/HeavyweightTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/JUnitPlatformTestSuite.java b/platform-tests/src/test/java/org/junit/platform/JUnitPlatformTestSuite.java index 456fcf9a5117..097994002ddc 100644 --- a/platform-tests/src/test/java/org/junit/platform/JUnitPlatformTestSuite.java +++ b/platform-tests/src/test/java/org/junit/platform/JUnitPlatformTestSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/StackTracePruningTests.java b/platform-tests/src/test/java/org/junit/platform/StackTracePruningTests.java index 14efaa029759..8c36d36b9929 100644 --- a/platform-tests/src/test/java/org/junit/platform/StackTracePruningTests.java +++ b/platform-tests/src/test/java/org/junit/platform/StackTracePruningTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/TestEngineTests.java b/platform-tests/src/test/java/org/junit/platform/TestEngineTests.java index a5ad5f3ccbdb..02fac34e7604 100644 --- a/platform-tests/src/test/java/org/junit/platform/TestEngineTests.java +++ b/platform-tests/src/test/java/org/junit/platform/TestEngineTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/annotation/TestableAnnotationTests.java b/platform-tests/src/test/java/org/junit/platform/commons/annotation/TestableAnnotationTests.java index 894550f22604..297d3add4993 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/annotation/TestableAnnotationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/annotation/TestableAnnotationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/function/TryTests.java b/platform-tests/src/test/java/org/junit/platform/commons/function/TryTests.java index 54716dc3fad5..4ad2dce22055 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/function/TryTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/function/TryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/support/AnnotationSupportTests.java b/platform-tests/src/test/java/org/junit/platform/commons/support/AnnotationSupportTests.java index 33d7d0caeaa1..88cf94db32ed 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/support/AnnotationSupportTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/support/AnnotationSupportTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/support/ClassSupportTests.java b/platform-tests/src/test/java/org/junit/platform/commons/support/ClassSupportTests.java index ebde2ce33e10..e2b972348253 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/support/ClassSupportTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/support/ClassSupportTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/support/ModifierSupportTests.java b/platform-tests/src/test/java/org/junit/platform/commons/support/ModifierSupportTests.java index 00ed5422a5b8..27e1092c4441 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/support/ModifierSupportTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/support/ModifierSupportTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/support/PreconditionAssertions.java b/platform-tests/src/test/java/org/junit/platform/commons/support/PreconditionAssertions.java index 3a8060479a10..d8a396e7084c 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/support/PreconditionAssertions.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/support/PreconditionAssertions.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/support/ReflectionSupportTests.java b/platform-tests/src/test/java/org/junit/platform/commons/support/ReflectionSupportTests.java index d86843227abc..0d1d9fc05454 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/support/ReflectionSupportTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/support/ReflectionSupportTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/support/conversion/FallbackStringToObjectConverterTests.java b/platform-tests/src/test/java/org/junit/platform/commons/support/conversion/FallbackStringToObjectConverterTests.java index c3dcce9135e9..4f4a07da3409 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/support/conversion/FallbackStringToObjectConverterTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/support/conversion/FallbackStringToObjectConverterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/support/scanning/CloseablePathTests.java b/platform-tests/src/test/java/org/junit/platform/commons/support/scanning/CloseablePathTests.java index ecac16c34c01..27081f85e92d 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/support/scanning/CloseablePathTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/support/scanning/CloseablePathTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/support/scanning/DefaultClasspathScannerTests.java b/platform-tests/src/test/java/org/junit/platform/commons/support/scanning/DefaultClasspathScannerTests.java index 1bcd92ce8b11..c99ae9b6b51f 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/support/scanning/DefaultClasspathScannerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/support/scanning/DefaultClasspathScannerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/AnnotationUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/AnnotationUtilsTests.java index 4b921b1920e0..e6865357192c 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/AnnotationUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/AnnotationUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/ClassLoaderUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/ClassLoaderUtilsTests.java index a80cd18242ea..3d8a72df921a 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/ClassLoaderUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/ClassLoaderUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/ClassNamePatternFilterUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/ClassNamePatternFilterUtilsTests.java index a76f67a31026..5204a27bf5d6 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/ClassNamePatternFilterUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/ClassNamePatternFilterUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/ClassUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/ClassUtilsTests.java index 8a683324b0e4..a73af19f3169 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/ClassUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/ClassUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/CollectionUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/CollectionUtilsTests.java index d3b34205e6c3..9e6f01daccbb 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/CollectionUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/CollectionUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/ExceptionUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/ExceptionUtilsTests.java index fcd55714f993..798185711c3c 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/ExceptionUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/ExceptionUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/FunctionUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/FunctionUtilsTests.java index dd7c44d6f770..ee74043ceb39 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/FunctionUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/FunctionUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/LruCacheTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/LruCacheTests.java index 917e7c864705..2762de3ee4be 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/LruCacheTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/LruCacheTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/ModuleUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/ModuleUtilsTests.java index c3800cf0c8c0..83ac9352098b 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/ModuleUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/ModuleUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/PackageUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/PackageUtilsTests.java index 397419bba54f..801500ccede9 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/PackageUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/PackageUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/PreconditionsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/PreconditionsTests.java index 5b97851f697e..73e35ff00ee9 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/PreconditionsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/PreconditionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java index c8d6e694ec0b..b001ee14bd76 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsWithGenericTypeHierarchiesTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsWithGenericTypeHierarchiesTests.java index 75fbe7376782..4e56c9283792 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsWithGenericTypeHierarchiesTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsWithGenericTypeHierarchiesTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/RuntimeUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/RuntimeUtilsTests.java index 0367fcdcbf72..d0c5d30ed8de 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/RuntimeUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/RuntimeUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/SerializationUtils.java b/platform-tests/src/test/java/org/junit/platform/commons/util/SerializationUtils.java index deaf5e207f9d..42ac1d444034 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/SerializationUtils.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/SerializationUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/StringUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/StringUtilsTests.java index c90dbd58c32b..ca66fe79c766 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/StringUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/StringUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/ToStringBuilderTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/ToStringBuilderTests.java index ddf167ff89d3..c030ba8673de 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/ToStringBuilderTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/ToStringBuilderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/classes/AExecutionConditionClass.java b/platform-tests/src/test/java/org/junit/platform/commons/util/classes/AExecutionConditionClass.java index 18367db12db0..09c7d84bccbb 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/classes/AExecutionConditionClass.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/classes/AExecutionConditionClass.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/classes/ATestExecutionListenerClass.java b/platform-tests/src/test/java/org/junit/platform/commons/util/classes/ATestExecutionListenerClass.java index 319fb326daa6..e109392c26c3 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/classes/ATestExecutionListenerClass.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/classes/ATestExecutionListenerClass.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/classes/AVanillaEmpty.java b/platform-tests/src/test/java/org/junit/platform/commons/util/classes/AVanillaEmpty.java index 1cd156254f05..83d2fc6e6205 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/classes/AVanillaEmpty.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/classes/AVanillaEmpty.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/classes/BExecutionConditionClass.java b/platform-tests/src/test/java/org/junit/platform/commons/util/classes/BExecutionConditionClass.java index 3767c86e9178..e8d05459f058 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/classes/BExecutionConditionClass.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/classes/BExecutionConditionClass.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/classes/BTestExecutionListenerClass.java b/platform-tests/src/test/java/org/junit/platform/commons/util/classes/BTestExecutionListenerClass.java index dd80bad88608..8b57fba484ff 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/classes/BTestExecutionListenerClass.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/classes/BTestExecutionListenerClass.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/classes/BVanillaEmpty.java b/platform-tests/src/test/java/org/junit/platform/commons/util/classes/BVanillaEmpty.java index b5e683adb975..5c9555799a5e 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/classes/BVanillaEmpty.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/classes/BVanillaEmpty.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/classes/CustomType.java b/platform-tests/src/test/java/org/junit/platform/commons/util/classes/CustomType.java index 3088ef0dda2a..cb08d101527c 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/classes/CustomType.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/classes/CustomType.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/ClassLevelDir.java b/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/ClassLevelDir.java index e35f513135e1..3d29caa3abc8 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/ClassLevelDir.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/ClassLevelDir.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/InstanceLevelDir.java b/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/InstanceLevelDir.java index a8f31bb10a2d..c59966885311 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/InstanceLevelDir.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/InstanceLevelDir.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/SuperclassWithStaticPackagePrivateBeforeMethod.java b/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/SuperclassWithStaticPackagePrivateBeforeMethod.java index 493a8a2bbc24..f5d579ac3f39 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/SuperclassWithStaticPackagePrivateBeforeMethod.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/SuperclassWithStaticPackagePrivateBeforeMethod.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/SuperclassWithStaticPackagePrivateTempDirField.java b/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/SuperclassWithStaticPackagePrivateTempDirField.java index 778076cf14d2..eccfc241a6f8 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/SuperclassWithStaticPackagePrivateTempDirField.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/SuperclassWithStaticPackagePrivateTempDirField.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/subpkg/SubclassWithNonStaticPackagePrivateBeforeMethod.java b/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/subpkg/SubclassWithNonStaticPackagePrivateBeforeMethod.java index 0cc671a42b28..0ed8b8ad1212 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/subpkg/SubclassWithNonStaticPackagePrivateBeforeMethod.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/subpkg/SubclassWithNonStaticPackagePrivateBeforeMethod.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/subpkg/SubclassWithNonStaticPackagePrivateTempDirField.java b/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/subpkg/SubclassWithNonStaticPackagePrivateTempDirField.java index a6749d41c917..1c6efa40cdfb 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/subpkg/SubclassWithNonStaticPackagePrivateTempDirField.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/pkg1/subpkg/SubclassWithNonStaticPackagePrivateTempDirField.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/ConsoleDetailsTests.java b/platform-tests/src/test/java/org/junit/platform/console/ConsoleDetailsTests.java index f4d7d80e4609..b908ab457893 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/ConsoleDetailsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/ConsoleDetailsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherIntegrationTests.java index c06186886bdf..a9f0be73a810 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherTests.java b/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherTests.java index f4fb02f4a935..82be8c8a584a 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherWrapper.java b/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherWrapper.java index 0d2c240d8ea3..03fb3528f543 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherWrapper.java +++ b/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherWrapperResult.java b/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherWrapperResult.java index d0efb56e0e35..f7fd34632fe5 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherWrapperResult.java +++ b/platform-tests/src/test/java/org/junit/platform/console/ConsoleLauncherWrapperResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/options/CommandLineOptionsParsingTests.java b/platform-tests/src/test/java/org/junit/platform/console/options/CommandLineOptionsParsingTests.java index dd5d01a479aa..0745f27a914a 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/options/CommandLineOptionsParsingTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/options/CommandLineOptionsParsingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/options/ConsoleUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/console/options/ConsoleUtilsTests.java index b322c1657afd..9fb2d92da4c0 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/options/ConsoleUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/options/ConsoleUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/options/ExecuteTestsCommandTests.java b/platform-tests/src/test/java/org/junit/platform/console/options/ExecuteTestsCommandTests.java index cddf92b68611..d7186357b51c 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/options/ExecuteTestsCommandTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/options/ExecuteTestsCommandTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/options/ThemeTests.java b/platform-tests/src/test/java/org/junit/platform/console/options/ThemeTests.java index cb49cbf631f4..e3d0cdcd1390 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/options/ThemeTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/options/ThemeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForInnerTest.java b/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForInnerTest.java index 287cbbc35005..98f28f17639f 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForInnerTest.java +++ b/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForInnerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForInnerTests.java b/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForInnerTests.java index bd7d2accebc1..2147563c291f 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForInnerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForInnerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTest.java b/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTest.java index be1624fa7d87..5a47e143d8c8 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTest.java +++ b/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTests.java b/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTests.java index bf95368df12a..c9febd321bf8 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/subpackage/ContainerForStaticNestedTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/subpackage/SecondTest.java b/platform-tests/src/test/java/org/junit/platform/console/subpackage/SecondTest.java index cdc962fe84d0..21d85cc79860 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/subpackage/SecondTest.java +++ b/platform-tests/src/test/java/org/junit/platform/console/subpackage/SecondTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/subpackage/Test.java b/platform-tests/src/test/java/org/junit/platform/console/subpackage/Test.java index cf5d40fd7afe..1e80f0c98650 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/subpackage/Test.java +++ b/platform-tests/src/test/java/org/junit/platform/console/subpackage/Test.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/subpackage/Test1.java b/platform-tests/src/test/java/org/junit/platform/console/subpackage/Test1.java index af3e80934eab..82a75f8b9b5b 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/subpackage/Test1.java +++ b/platform-tests/src/test/java/org/junit/platform/console/subpackage/Test1.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/subpackage/Tests.java b/platform-tests/src/test/java/org/junit/platform/console/subpackage/Tests.java index 8cb8a8c507fc..3e3869c7fe30 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/subpackage/Tests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/subpackage/Tests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/subpackage/ThirdTests.java b/platform-tests/src/test/java/org/junit/platform/console/subpackage/ThirdTests.java index 88fec97e3acd..66f87788ddbf 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/subpackage/ThirdTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/subpackage/ThirdTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/tasks/ColorPaletteTests.java b/platform-tests/src/test/java/org/junit/platform/console/tasks/ColorPaletteTests.java index 576f2b3ed97b..55adbe486218 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/tasks/ColorPaletteTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/tasks/ColorPaletteTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/tasks/ConsoleTestExecutorTests.java b/platform-tests/src/test/java/org/junit/platform/console/tasks/ConsoleTestExecutorTests.java index 9f04b044f370..f3c99037a180 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/tasks/ConsoleTestExecutorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/tasks/ConsoleTestExecutorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/tasks/CustomContextClassLoaderExecutorTests.java b/platform-tests/src/test/java/org/junit/platform/console/tasks/CustomContextClassLoaderExecutorTests.java index a3b72bb4692c..0c0d6e9ec935 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/tasks/CustomContextClassLoaderExecutorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/tasks/CustomContextClassLoaderExecutorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/tasks/DiscoveryRequestCreatorTests.java b/platform-tests/src/test/java/org/junit/platform/console/tasks/DiscoveryRequestCreatorTests.java index 3e560fa1fabc..014c167a203e 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/tasks/DiscoveryRequestCreatorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/tasks/DiscoveryRequestCreatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/tasks/FlatPrintingListenerTests.java b/platform-tests/src/test/java/org/junit/platform/console/tasks/FlatPrintingListenerTests.java index cba9f30a84b3..4ca4605f6e35 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/tasks/FlatPrintingListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/tasks/FlatPrintingListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/tasks/TestFeedPrintingListenerTests.java b/platform-tests/src/test/java/org/junit/platform/console/tasks/TestFeedPrintingListenerTests.java index 953cda4a2d58..35c37df1c1cc 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/tasks/TestFeedPrintingListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/tasks/TestFeedPrintingListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/tasks/TreeNodeTests.java b/platform-tests/src/test/java/org/junit/platform/console/tasks/TreeNodeTests.java index 93cf99cbcd80..33c08f6063a8 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/tasks/TreeNodeTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/tasks/TreeNodeTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/tasks/TreePrinterTests.java b/platform-tests/src/test/java/org/junit/platform/console/tasks/TreePrinterTests.java index 49577c4b9fa7..b4f712a639f4 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/tasks/TreePrinterTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/tasks/TreePrinterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/console/tasks/VerboseTreePrintingListenerTests.java b/platform-tests/src/test/java/org/junit/platform/console/tasks/VerboseTreePrintingListenerTests.java index c8ae4f0ec3b3..73addec06823 100644 --- a/platform-tests/src/test/java/org/junit/platform/console/tasks/VerboseTreePrintingListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/console/tasks/VerboseTreePrintingListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/FilterCompositionTests.java b/platform-tests/src/test/java/org/junit/platform/engine/FilterCompositionTests.java index 92a7f879e960..e1679ac20b12 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/FilterCompositionTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/FilterCompositionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/TestDescriptorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/TestDescriptorTests.java index 6b8907e463dd..2ce70b95db9d 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/TestDescriptorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/TestDescriptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/TestTagTests.java b/platform-tests/src/test/java/org/junit/platform/engine/TestTagTests.java index e18b6cc990f9..63adfe5e51a5 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/TestTagTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/TestTagTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/UniqueIdFormatTests.java b/platform-tests/src/test/java/org/junit/platform/engine/UniqueIdFormatTests.java index ee6c731d6643..f2901b85557b 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/UniqueIdFormatTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/UniqueIdFormatTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/UniqueIdTests.java b/platform-tests/src/test/java/org/junit/platform/engine/UniqueIdTests.java index c126da921107..d9dc72a328f9 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/UniqueIdTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/UniqueIdTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClassNameFilterTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClassNameFilterTests.java index 990c1dc1e179..fd14be421e26 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClassNameFilterTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClassNameFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClassSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClassSelectorTests.java index 01d39c02d5a8..80dd13652a1a 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClassSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClassSelectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathResourceSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathResourceSelectorTests.java index a3b842048deb..bf4222c3f6fd 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathResourceSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathResourceSelectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathRootSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathRootSelectorTests.java index e9fef4739978..1b690029aaf4 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathRootSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ClasspathRootSelectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/DirectorySelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/DirectorySelectorTests.java index 35d4d630b2ce..5eecbbdfcca5 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/DirectorySelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/DirectorySelectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/DiscoverySelectorsTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/DiscoverySelectorsTests.java index df80a3f580c2..c384a90434d2 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/DiscoverySelectorsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/DiscoverySelectorsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/FilePositionTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/FilePositionTests.java index fe080a0eb816..8108bfd76a36 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/FilePositionTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/FilePositionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/FileSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/FileSelectorTests.java index a3f1fa718a64..d324fe767504 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/FileSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/FileSelectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/IterationSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/IterationSelectorTests.java index 9eb66c820c2a..cba42d58f00b 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/IterationSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/IterationSelectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/MethodSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/MethodSelectorTests.java index 699073145f1c..b8599347ea67 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/MethodSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/MethodSelectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ModuleSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ModuleSelectorTests.java index 4ffc796b0c66..34cf92a2c4db 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/ModuleSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/ModuleSelectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedClassSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedClassSelectorTests.java index 42dd2baf1793..a06756041174 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedClassSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedClassSelectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedMethodSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedMethodSelectorTests.java index a351b90114fc..003721ff098e 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedMethodSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/NestedMethodSelectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/PackageNameFilterTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/PackageNameFilterTests.java index cedd2ed6f439..b93ba77a34c9 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/PackageNameFilterTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/PackageNameFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/PackageSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/PackageSelectorTests.java index 72907ae2b931..fcc90fd8b2ef 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/PackageSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/PackageSelectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/UniqueIdSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/UniqueIdSelectorTests.java index 7266b1833832..fef5907b6ca3 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/UniqueIdSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/UniqueIdSelectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/discovery/UriSelectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/discovery/UriSelectorTests.java index 179963809b6b..79fafc208768 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/discovery/UriSelectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/discovery/UriSelectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/config/PrefixedConfigurationParametersTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/config/PrefixedConfigurationParametersTests.java index bf2f411e6b06..ae64f77463d3 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/config/PrefixedConfigurationParametersTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/config/PrefixedConfigurationParametersTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/AbstractTestDescriptorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/AbstractTestDescriptorTests.java index 3b8c8ae0d5f8..5f4fe3011fb2 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/AbstractTestDescriptorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/AbstractTestDescriptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/AbstractTestSourceTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/AbstractTestSourceTests.java index a2af378fadd6..6154598e5264 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/AbstractTestSourceTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/AbstractTestSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ClassSourceTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ClassSourceTests.java index 2915946c54b0..078c9f629c76 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ClassSourceTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ClassSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ClasspathResourceSourceTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ClasspathResourceSourceTests.java index 90335c81dbef..9141a47fd5bb 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ClasspathResourceSourceTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/ClasspathResourceSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/CompositeTestSourceTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/CompositeTestSourceTests.java index 2b32f485df8e..2702e480ae33 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/CompositeTestSourceTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/CompositeTestSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DefaultUriSourceTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DefaultUriSourceTests.java index e67431ac93bd..03f5edd70f6b 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DefaultUriSourceTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DefaultUriSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DemoClassTestDescriptor.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DemoClassTestDescriptor.java index 048e26e1bd5c..5687846244dc 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DemoClassTestDescriptor.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DemoClassTestDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DemoMethodTestDescriptor.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DemoMethodTestDescriptor.java index ac226663d796..4e3c5aee0aa0 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DemoMethodTestDescriptor.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/DemoMethodTestDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/FilePositionTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/FilePositionTests.java index b50fd31d7e4b..d1d85ae156d7 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/FilePositionTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/FilePositionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/FileSystemSourceTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/FileSystemSourceTests.java index 43a1bd9aae85..307193a02774 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/FileSystemSourceTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/FileSystemSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/MethodSourceTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/MethodSourceTests.java index 37df1266425f..4f97624c7ce6 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/MethodSourceTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/MethodSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/PackageSourceTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/PackageSourceTests.java index 5bf3f8fd2a0b..8da7f16a8545 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/PackageSourceTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/descriptor/PackageSourceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/discovery/ResourceContainerSelectorResolverTest.java b/platform-tests/src/test/java/org/junit/platform/engine/support/discovery/ResourceContainerSelectorResolverTest.java index 67ea75c1d0f6..7a1c9b4d072d 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/discovery/ResourceContainerSelectorResolverTest.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/discovery/ResourceContainerSelectorResolverTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/CompositeLockTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/CompositeLockTests.java index 75e0a262f98e..3fbbaabf6191 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/CompositeLockTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/CompositeLockTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/DefaultParallelExecutionConfigurationStrategyTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/DefaultParallelExecutionConfigurationStrategyTests.java index dde62fa84c50..9a55301ab6af 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/DefaultParallelExecutionConfigurationStrategyTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/DefaultParallelExecutionConfigurationStrategyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinDeadLockTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinDeadLockTests.java index b50b2e23c700..5663e4e0be8c 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinDeadLockTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinDeadLockTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java index 46c5bcc6cafe..59dfbba0f789 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ForkJoinPoolHierarchicalTestExecutorServiceTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestExecutorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestExecutorTests.java index 057fb6a66826..1b520dc5f30f 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestExecutorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestExecutorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/LockManagerTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/LockManagerTests.java index a1cb3efd1483..ef008b03d221 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/LockManagerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/LockManagerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/MemoryLeakTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/MemoryLeakTests.java index ad97557e5fb6..e8daa4b230a5 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/MemoryLeakTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/MemoryLeakTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalkerIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalkerIntegrationTests.java index 6e0a7f4c78c9..4857212814cb 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalkerIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/NodeTreeWalkerIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionIntegrationTests.java index 26b132d02120..2775585bb9da 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ParallelExecutionIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ResourceLockSupport.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ResourceLockSupport.java index 1660eb08f1b6..8325fb7b30a9 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ResourceLockSupport.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ResourceLockSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ResourceLockTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ResourceLockTests.java index 2372ff27de42..40fbdf0be196 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ResourceLockTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ResourceLockTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SameThreadExecutionIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SameThreadExecutionIntegrationTests.java index ab06a7ed6982..c6e82bb1ae37 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SameThreadExecutionIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SameThreadExecutionIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SingleLockTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SingleLockTests.java index d4a9ef75e0cb..d988d151435c 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SingleLockTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SingleLockTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SingleTestExecutorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SingleTestExecutorTests.java index e80890a1d6ef..35b139b12243 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SingleTestExecutorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/SingleTestExecutorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ThrowableCollectorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ThrowableCollectorTests.java index bf5ca1bffc32..fbf7864e08a9 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ThrowableCollectorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/ThrowableCollectorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/store/NamespacedHierarchicalStoreTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/store/NamespacedHierarchicalStoreTests.java index f234ff11dbe3..77b14f19ca6a 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/store/NamespacedHierarchicalStoreTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/store/NamespacedHierarchicalStoreTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingDiscoveryListenerIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingDiscoveryListenerIntegrationTests.java index 2767ec89746e..5fe5dbe2aeb6 100644 --- a/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingDiscoveryListenerIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingDiscoveryListenerIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingExecutionListenerIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingExecutionListenerIntegrationTests.java index 0faf037f2d2a..afda445bc142 100644 --- a/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingExecutionListenerIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/jfr/FlightRecordingExecutionListenerIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/DiscoveryFilterStub.java b/platform-tests/src/test/java/org/junit/platform/launcher/DiscoveryFilterStub.java index a31de9b54f55..088d35c34862 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/DiscoveryFilterStub.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/DiscoveryFilterStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/FilterStub.java b/platform-tests/src/test/java/org/junit/platform/launcher/FilterStub.java index 01771f42889b..f340397ab287 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/FilterStub.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/FilterStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/InterceptedTestEngine.java b/platform-tests/src/test/java/org/junit/platform/launcher/InterceptedTestEngine.java index ce90b6eb1620..253f7434a0ca 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/InterceptedTestEngine.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/InterceptedTestEngine.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/InterceptorInjectedLauncherSessionListener.java b/platform-tests/src/test/java/org/junit/platform/launcher/InterceptorInjectedLauncherSessionListener.java index 606f6cedef5f..982ed805cb04 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/InterceptorInjectedLauncherSessionListener.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/InterceptorInjectedLauncherSessionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/MethodFilterTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/MethodFilterTests.java index a7622264f1ff..10a3d7931788 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/MethodFilterTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/MethodFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/PostDiscoveryFilterStub.java b/platform-tests/src/test/java/org/junit/platform/launcher/PostDiscoveryFilterStub.java index e863f8c56d67..cf428c20a5d2 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/PostDiscoveryFilterStub.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/PostDiscoveryFilterStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/TagFilterTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/TagFilterTests.java index 0c1b54e9b4d7..d81e7879ef0b 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/TagFilterTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/TagFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/TagIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/TagIntegrationTests.java index 027a2228b1a8..7f39c87a6f54 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/TagIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/TagIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/TestIdentifierTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/TestIdentifierTests.java index 7ba6716495e6..0b845babfda9 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/TestIdentifierTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/TestIdentifierTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/TestLauncherDiscoveryListener.java b/platform-tests/src/test/java/org/junit/platform/launcher/TestLauncherDiscoveryListener.java index 93e91f168108..cf6a437b3928 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/TestLauncherDiscoveryListener.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/TestLauncherDiscoveryListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/TestLauncherInterceptor1.java b/platform-tests/src/test/java/org/junit/platform/launcher/TestLauncherInterceptor1.java index a077c68afad3..3f1007458293 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/TestLauncherInterceptor1.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/TestLauncherInterceptor1.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/TestLauncherInterceptor2.java b/platform-tests/src/test/java/org/junit/platform/launcher/TestLauncherInterceptor2.java index 6adbd6a56e35..b19195c466b4 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/TestLauncherInterceptor2.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/TestLauncherInterceptor2.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/TestLauncherSessionListener.java b/platform-tests/src/test/java/org/junit/platform/launcher/TestLauncherSessionListener.java index e239effb560b..04256b97b4d6 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/TestLauncherSessionListener.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/TestLauncherSessionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/TestPlanTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/TestPlanTests.java index 80c09b0bea04..22be5ce5d260 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/TestPlanTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/TestPlanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/TestPostDiscoveryTagFilter.java b/platform-tests/src/test/java/org/junit/platform/launcher/TestPostDiscoveryTagFilter.java index 7b79b2e4ab49..f03091c3d7d3 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/TestPostDiscoveryTagFilter.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/TestPostDiscoveryTagFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/CompositeEngineExecutionListenerTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/CompositeEngineExecutionListenerTests.java index 46f26f12d7cf..575f4407c24d 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/CompositeEngineExecutionListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/CompositeEngineExecutionListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/CompositeTestExecutionListenerTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/CompositeTestExecutionListenerTests.java index cb2973165fff..ebb6357891b8 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/CompositeTestExecutionListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/CompositeTestExecutionListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/DefaultLauncherEngineFilterTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/DefaultLauncherEngineFilterTests.java index 7f473923ec20..04c9492a09ce 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/DefaultLauncherEngineFilterTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/DefaultLauncherEngineFilterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/DefaultLauncherTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/DefaultLauncherTests.java index 49ba72767990..e1f240617575 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/DefaultLauncherTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/DefaultLauncherTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/EngineDiscoveryResultValidatorTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/EngineDiscoveryResultValidatorTests.java index 8744124def16..854c3bcefdf4 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/EngineDiscoveryResultValidatorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/EngineDiscoveryResultValidatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/ExecutionListenerAdapterTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/ExecutionListenerAdapterTests.java index d60b569abb98..32b2087ed966 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/ExecutionListenerAdapterTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/ExecutionListenerAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/HierarchicalOutputDirectoryProviderTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/HierarchicalOutputDirectoryProviderTests.java index c5c23e3e6fa2..7ba1efb5fba6 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/HierarchicalOutputDirectoryProviderTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/HierarchicalOutputDirectoryProviderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherConfigTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherConfigTests.java index 5471b0214be1..c3b518dcd3b2 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherConfigTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherConfigTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherConfigurationParametersTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherConfigurationParametersTests.java index ccac05dcc9f7..2bd8b5aea1da 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherConfigurationParametersTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherConfigurationParametersTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilderTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilderTests.java index 1e7da55eecc9..93d9cd4a771f 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilderTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherDiscoveryRequestBuilderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherFactoryTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherFactoryTests.java index ccdd66de0f9a..06f6c308242d 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherFactoryTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherSessionTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherSessionTests.java index 95e38a9c733c..70e2cb5c6814 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherSessionTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/LauncherSessionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/ListenerRegistryTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/ListenerRegistryTests.java index 2c73ee57e198..c95b2ea1fd2f 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/ListenerRegistryTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/ListenerRegistryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/StreamInterceptingTestExecutionListenerIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/StreamInterceptingTestExecutionListenerIntegrationTests.java index 01aacc458db0..ee7e27cae5cd 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/StreamInterceptingTestExecutionListenerIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/StreamInterceptingTestExecutionListenerIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/StreamInterceptorTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/StreamInterceptorTests.java index 04b00edb441f..2b5f35ca86bb 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/core/StreamInterceptorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/StreamInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/AnotherUnusedTestExecutionListener.java b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/AnotherUnusedTestExecutionListener.java index 7d6dcc2b8326..8df258c9b277 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/AnotherUnusedTestExecutionListener.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/AnotherUnusedTestExecutionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/LoggingListenerTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/LoggingListenerTests.java index abe2e5f89f82..fe7c18cdc0fe 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/LoggingListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/LoggingListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/NoopTestExecutionListener.java b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/NoopTestExecutionListener.java index 8d21878f1dc2..e36ec8b76840 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/NoopTestExecutionListener.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/NoopTestExecutionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/OutputDirTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/OutputDirTests.java index d3ac3bea016b..0699c10fe69a 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/OutputDirTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/OutputDirTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/SummaryGenerationTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/SummaryGenerationTests.java index 70c519e08167..adda779701d0 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/SummaryGenerationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/SummaryGenerationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListenerIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListenerIntegrationTests.java index feb645cefaa8..dd916c324636 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListenerIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/UniqueIdTrackingListenerIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/UnusedTestExecutionListener.java b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/UnusedTestExecutionListener.java index b34399936e4c..ca9904096fa4 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/UnusedTestExecutionListener.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/UnusedTestExecutionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/discovery/AbortOnFailureLauncherDiscoveryListenerTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/discovery/AbortOnFailureLauncherDiscoveryListenerTests.java index 727bb93a399a..5c855acdaf39 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/discovery/AbortOnFailureLauncherDiscoveryListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/discovery/AbortOnFailureLauncherDiscoveryListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/discovery/AbstractLauncherDiscoveryListenerTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/discovery/AbstractLauncherDiscoveryListenerTests.java index 060df776f852..f2ffad3215d4 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/discovery/AbstractLauncherDiscoveryListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/discovery/AbstractLauncherDiscoveryListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/discovery/CompositeLauncherDiscoveryListenerTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/discovery/CompositeLauncherDiscoveryListenerTests.java index 00fe416ec014..b0a1f5bbcf2c 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/discovery/CompositeLauncherDiscoveryListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/discovery/CompositeLauncherDiscoveryListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/discovery/LoggingLauncherDiscoveryListenerTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/discovery/LoggingLauncherDiscoveryListenerTests.java index 4ec465bfcbf3..86c7f5724999 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/discovery/LoggingLauncherDiscoveryListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/discovery/LoggingLauncherDiscoveryListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/session/CompositeLauncherSessionListenerTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/session/CompositeLauncherSessionListenerTests.java index 13e4ec36b440..cc262c54f2c2 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/listeners/session/CompositeLauncherSessionListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/listeners/session/CompositeLauncherSessionListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/ParserErrorTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/ParserErrorTests.java index 43fb4e25dbda..648d624cac3c 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/ParserErrorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/ParserErrorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/ParserTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/ParserTests.java index 9fbab1299437..4d3133f66f27 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/ParserTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/ParserTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/TagExpressionsTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/TagExpressionsTests.java index 8ef18564f46b..1133b03f5d7e 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/TagExpressionsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/TagExpressionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/TokenTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/TokenTests.java index b8fca58da169..edee8f37edaf 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/TokenTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/TokenTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/TokenizerTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/TokenizerTests.java index e4651128c67b..37cfb09786e6 100644 --- a/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/TokenizerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/launcher/tagexpression/TokenizerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/LegacyReportingUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/LegacyReportingUtilsTests.java index a9a11684c5b1..b8e5b25d5f41 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/LegacyReportingUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/LegacyReportingUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/IncrementingClock.java b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/IncrementingClock.java index a167ab629e6a..00db12731cd6 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/IncrementingClock.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/IncrementingClock.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/LegacyXmlReportGeneratingListenerTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/LegacyXmlReportGeneratingListenerTests.java index 1f6eeb70dc63..a291ff90b51f 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/LegacyXmlReportGeneratingListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/LegacyXmlReportGeneratingListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportAssertions.java b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportAssertions.java index fd220731d0b6..3f4e594dd9b9 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportAssertions.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportAssertions.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportDataTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportDataTests.java index f2890b183884..c0e84ebdccbe 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportDataTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportDataTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java index 3f43326329cd..0eebd933ffc4 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/legacy/xml/XmlReportWriterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/JUnitContributorTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/JUnitContributorTests.java index 1bf1ee6fb0cc..e13f7b44fce4 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/JUnitContributorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/JUnitContributorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java index fd82f3355bb9..80a076abaa59 100644 --- a/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/reporting/open/xml/OpenTestReportGeneratingListenerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/runner/JUnitPlatformRunnerTests.java b/platform-tests/src/test/java/org/junit/platform/runner/JUnitPlatformRunnerTests.java index 45064f00a2b1..1a0f6190c21d 100644 --- a/platform-tests/src/test/java/org/junit/platform/runner/JUnitPlatformRunnerTests.java +++ b/platform-tests/src/test/java/org/junit/platform/runner/JUnitPlatformRunnerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilderTests.java b/platform-tests/src/test/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilderTests.java index 5575d4996038..b2239ca97817 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilderTests.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/commons/SuiteLauncherDiscoveryRequestBuilderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/BeforeAndAfterSuiteTests.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/BeforeAndAfterSuiteTests.java index c892eee146bb..d1032281d826 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/BeforeAndAfterSuiteTests.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/BeforeAndAfterSuiteTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/SuiteEngineTests.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/SuiteEngineTests.java index 9675f662c5b8..8041c89f1cf7 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/SuiteEngineTests.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/SuiteEngineTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/SuiteTestDescriptorTests.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/SuiteTestDescriptorTests.java index 2f9507a01dc1..0cc23198b237 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/SuiteTestDescriptorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/SuiteTestDescriptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/ConfigurationSensitiveTestCase.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/ConfigurationSensitiveTestCase.java index 1219e8c16251..926fef81e1cd 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/ConfigurationSensitiveTestCase.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/ConfigurationSensitiveTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/DynamicTestsTestCase.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/DynamicTestsTestCase.java index 4d470c5b86e6..0854b1391f03 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/DynamicTestsTestCase.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/DynamicTestsTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/EmptyDynamicTestsTestCase.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/EmptyDynamicTestsTestCase.java index 5ca4c08b960f..c16ba9d70c54 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/EmptyDynamicTestsTestCase.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/EmptyDynamicTestsTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/EmptyTestTestCase.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/EmptyTestTestCase.java index 8b43ab0d8b0b..a03e57f434cd 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/EmptyTestTestCase.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/EmptyTestTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/JUnit4TestsTestCase.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/JUnit4TestsTestCase.java index 42348afa6dbd..a39cafc41d2e 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/JUnit4TestsTestCase.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/JUnit4TestsTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/MultipleTestsTestCase.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/MultipleTestsTestCase.java index 4a0b5a2a7813..cdb6f733acfa 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/MultipleTestsTestCase.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/MultipleTestsTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/SingleTestTestCase.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/SingleTestTestCase.java index e8aa2c9e3e41..359a7d8a25d0 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/SingleTestTestCase.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/SingleTestTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/StatefulTestCase.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/StatefulTestCase.java index b480a7349aa7..b611bd9451ec 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/StatefulTestCase.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/StatefulTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/TaggedTestTestCase.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/TaggedTestTestCase.java index 5e726a4e8d91..962954b7c6ae 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/TaggedTestTestCase.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testcases/TaggedTestTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/AbstractSuite.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/AbstractSuite.java index b99d11bd7471..2dd69ed2532b 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/AbstractSuite.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/AbstractSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/ConfigurationSuite.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/ConfigurationSuite.java index 8e7f6cba21b2..ccc1eb74040f 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/ConfigurationSuite.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/ConfigurationSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/CyclicSuite.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/CyclicSuite.java index 07274993fd56..9d958173bbfa 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/CyclicSuite.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/CyclicSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/DynamicSuite.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/DynamicSuite.java index 37490756e8b9..238c1b6220b7 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/DynamicSuite.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/DynamicSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/EmptyCyclicSuite.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/EmptyCyclicSuite.java index 05d8d4518aa8..49d4f7ff22e0 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/EmptyCyclicSuite.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/EmptyCyclicSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/EmptyDynamicTestSuite.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/EmptyDynamicTestSuite.java index 6e547b19d6fb..b5a03def9112 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/EmptyDynamicTestSuite.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/EmptyDynamicTestSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/EmptyDynamicTestWithFailIfNoTestFalseSuite.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/EmptyDynamicTestWithFailIfNoTestFalseSuite.java index 619c98e2a9c3..5a8ab46f0b70 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/EmptyDynamicTestWithFailIfNoTestFalseSuite.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/EmptyDynamicTestWithFailIfNoTestFalseSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/EmptyTestCaseSuite.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/EmptyTestCaseSuite.java index 8bb833394339..436c60caf8fd 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/EmptyTestCaseSuite.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/EmptyTestCaseSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/EmptyTestCaseWithFailIfNoTestFalseSuite.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/EmptyTestCaseWithFailIfNoTestFalseSuite.java index 388dec7317c8..ea5ed9353a68 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/EmptyTestCaseWithFailIfNoTestFalseSuite.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/EmptyTestCaseWithFailIfNoTestFalseSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/LifecycleMethodsSuites.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/LifecycleMethodsSuites.java index 8a5af3587d38..bfbd4619d35d 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/LifecycleMethodsSuites.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/LifecycleMethodsSuites.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/MultiEngineSuite.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/MultiEngineSuite.java index 0546e6df7213..faa98e04cc6c 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/MultiEngineSuite.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/MultiEngineSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/MultipleSuite.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/MultipleSuite.java index 1570efccb1fa..7208ff543635 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/MultipleSuite.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/MultipleSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/NestedSuite.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/NestedSuite.java index 8f15386fb018..aa6581f3a791 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/NestedSuite.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/NestedSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/SelectByIdentifierSuite.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/SelectByIdentifierSuite.java index 5aad2b329d60..6ceb2ce905b1 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/SelectByIdentifierSuite.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/SelectByIdentifierSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/SelectClassesSuite.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/SelectClassesSuite.java index a2fac4e257e3..c2d5f58d4f0d 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/SelectClassesSuite.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/SelectClassesSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/SelectMethodsSuite.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/SelectMethodsSuite.java index c04b0869ee06..a01b26b08b7c 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/SelectMethodsSuite.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/SelectMethodsSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/SuiteDisplayNameSuite.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/SuiteDisplayNameSuite.java index baa6db4f6476..c87116af45f7 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/SuiteDisplayNameSuite.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/SuiteDisplayNameSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/SuiteSuite.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/SuiteSuite.java index 282092b8f842..32f55881f642 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/SuiteSuite.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/SuiteSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/ThreePartCyclicSuite.java b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/ThreePartCyclicSuite.java index 133330816eb5..3890ff950101 100644 --- a/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/ThreePartCyclicSuite.java +++ b/platform-tests/src/test/java/org/junit/platform/suite/engine/testsuites/ThreePartCyclicSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/testkit/engine/EngineTestKitTests.java b/platform-tests/src/test/java/org/junit/platform/testkit/engine/EngineTestKitTests.java index 6e852b821fb7..55325c1962c4 100644 --- a/platform-tests/src/test/java/org/junit/platform/testkit/engine/EngineTestKitTests.java +++ b/platform-tests/src/test/java/org/junit/platform/testkit/engine/EngineTestKitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/testkit/engine/EventsTests.java b/platform-tests/src/test/java/org/junit/platform/testkit/engine/EventsTests.java index a6133808f8a2..e490d029a74f 100644 --- a/platform-tests/src/test/java/org/junit/platform/testkit/engine/EventsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/testkit/engine/EventsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/testkit/engine/ExecutionsIntegrationTests.java b/platform-tests/src/test/java/org/junit/platform/testkit/engine/ExecutionsIntegrationTests.java index 0bba668c23fc..2524d62dc7da 100644 --- a/platform-tests/src/test/java/org/junit/platform/testkit/engine/ExecutionsIntegrationTests.java +++ b/platform-tests/src/test/java/org/junit/platform/testkit/engine/ExecutionsIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/testkit/engine/NestedContainerEventConditionTests.java b/platform-tests/src/test/java/org/junit/platform/testkit/engine/NestedContainerEventConditionTests.java index d328eb1065d5..d109969008b1 100644 --- a/platform-tests/src/test/java/org/junit/platform/testkit/engine/NestedContainerEventConditionTests.java +++ b/platform-tests/src/test/java/org/junit/platform/testkit/engine/NestedContainerEventConditionTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tests/src/test/java/org/junit/platform/testkit/engine/TestExecutionResultConditionsTests.java b/platform-tests/src/test/java/org/junit/platform/testkit/engine/TestExecutionResultConditionsTests.java index 9ea2079aedbf..c8e868b0ede4 100644 --- a/platform-tests/src/test/java/org/junit/platform/testkit/engine/TestExecutionResultConditionsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/testkit/engine/TestExecutionResultConditionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/ant-starter/src/main/java/com/example/project/Calculator.java b/platform-tooling-support-tests/projects/ant-starter/src/main/java/com/example/project/Calculator.java index c0540f6b3e95..704d536c0866 100644 --- a/platform-tooling-support-tests/projects/ant-starter/src/main/java/com/example/project/Calculator.java +++ b/platform-tooling-support-tests/projects/ant-starter/src/main/java/com/example/project/Calculator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/ant-starter/src/test/java/com/example/project/CalculatorTests.java b/platform-tooling-support-tests/projects/ant-starter/src/test/java/com/example/project/CalculatorTests.java index 0b0a25ab7fdc..8f9c8153041d 100644 --- a/platform-tooling-support-tests/projects/ant-starter/src/test/java/com/example/project/CalculatorTests.java +++ b/platform-tooling-support-tests/projects/ant-starter/src/test/java/com/example/project/CalculatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/graalvm-starter/src/main/java/com/example/project/Calculator.java b/platform-tooling-support-tests/projects/graalvm-starter/src/main/java/com/example/project/Calculator.java index c0540f6b3e95..704d536c0866 100644 --- a/platform-tooling-support-tests/projects/graalvm-starter/src/main/java/com/example/project/Calculator.java +++ b/platform-tooling-support-tests/projects/graalvm-starter/src/main/java/com/example/project/Calculator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/CalculatorTests.java b/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/CalculatorTests.java index 0b0a25ab7fdc..8f9c8153041d 100644 --- a/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/CalculatorTests.java +++ b/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/CalculatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/ClassLevelAnnotationTests.java b/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/ClassLevelAnnotationTests.java index 582b46f7cde1..709f4a0de1cb 100644 --- a/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/ClassLevelAnnotationTests.java +++ b/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/ClassLevelAnnotationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/GraalvmSuite.java b/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/GraalvmSuite.java index 82796513068d..ad02aea308af 100644 --- a/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/GraalvmSuite.java +++ b/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/GraalvmSuite.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/VintageTests.java b/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/VintageTests.java index 3ce117dea75b..d12865d1e312 100644 --- a/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/VintageTests.java +++ b/platform-tooling-support-tests/projects/graalvm-starter/src/test/java/com/example/project/VintageTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/gradle-kotlin-extensions/src/test/kotlin/com/example/project/ExtensionFunctionsTests.kt b/platform-tooling-support-tests/projects/gradle-kotlin-extensions/src/test/kotlin/com/example/project/ExtensionFunctionsTests.kt index d60205669fc3..ccc93d4c789b 100644 --- a/platform-tooling-support-tests/projects/gradle-kotlin-extensions/src/test/kotlin/com/example/project/ExtensionFunctionsTests.kt +++ b/platform-tooling-support-tests/projects/gradle-kotlin-extensions/src/test/kotlin/com/example/project/ExtensionFunctionsTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/gradle-missing-engine/src/test/java/FooTests.java b/platform-tooling-support-tests/projects/gradle-missing-engine/src/test/java/FooTests.java index d389a1357fdf..f6c8e9c71b9a 100644 --- a/platform-tooling-support-tests/projects/gradle-missing-engine/src/test/java/FooTests.java +++ b/platform-tooling-support-tests/projects/gradle-missing-engine/src/test/java/FooTests.java @@ -1,6 +1,6 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/gradle-starter/src/main/java/com/example/project/Calculator.java b/platform-tooling-support-tests/projects/gradle-starter/src/main/java/com/example/project/Calculator.java index c0540f6b3e95..704d536c0866 100644 --- a/platform-tooling-support-tests/projects/gradle-starter/src/main/java/com/example/project/Calculator.java +++ b/platform-tooling-support-tests/projects/gradle-starter/src/main/java/com/example/project/Calculator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/gradle-starter/src/test/java/com/example/project/CalculatorTests.java b/platform-tooling-support-tests/projects/gradle-starter/src/test/java/com/example/project/CalculatorTests.java index 06e73789b1af..d4ab5f97afcc 100644 --- a/platform-tooling-support-tests/projects/gradle-starter/src/test/java/com/example/project/CalculatorTests.java +++ b/platform-tooling-support-tests/projects/gradle-starter/src/test/java/com/example/project/CalculatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/java-versions/src/test/java/JUnitPlatformCommonsTests.java b/platform-tooling-support-tests/projects/java-versions/src/test/java/JUnitPlatformCommonsTests.java index 1d76fa7b2ed4..7e7a888bdd6b 100644 --- a/platform-tooling-support-tests/projects/java-versions/src/test/java/JUnitPlatformCommonsTests.java +++ b/platform-tooling-support-tests/projects/java-versions/src/test/java/JUnitPlatformCommonsTests.java @@ -1,6 +1,6 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/maven-starter/src/main/java/com/example/project/Calculator.java b/platform-tooling-support-tests/projects/maven-starter/src/main/java/com/example/project/Calculator.java index c0540f6b3e95..704d536c0866 100644 --- a/platform-tooling-support-tests/projects/maven-starter/src/main/java/com/example/project/Calculator.java +++ b/platform-tooling-support-tests/projects/maven-starter/src/main/java/com/example/project/Calculator.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/maven-starter/src/test/java/com/example/project/CalculatorTests.java b/platform-tooling-support-tests/projects/maven-starter/src/test/java/com/example/project/CalculatorTests.java index 0b0a25ab7fdc..8f9c8153041d 100644 --- a/platform-tooling-support-tests/projects/maven-starter/src/test/java/com/example/project/CalculatorTests.java +++ b/platform-tooling-support-tests/projects/maven-starter/src/test/java/com/example/project/CalculatorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/maven-surefire-compatibility/src/test/java/com/example/project/DummyTests.java b/platform-tooling-support-tests/projects/maven-surefire-compatibility/src/test/java/com/example/project/DummyTests.java index 4751e1f005c8..8ce5c082ef86 100644 --- a/platform-tooling-support-tests/projects/maven-surefire-compatibility/src/test/java/com/example/project/DummyTests.java +++ b/platform-tooling-support-tests/projects/maven-surefire-compatibility/src/test/java/com/example/project/DummyTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/multi-release-jar/src/test/java/integration/integration/JupiterIntegrationTests.java b/platform-tooling-support-tests/projects/multi-release-jar/src/test/java/integration/integration/JupiterIntegrationTests.java index e5f363bc284c..1ec807b3a8dc 100644 --- a/platform-tooling-support-tests/projects/multi-release-jar/src/test/java/integration/integration/JupiterIntegrationTests.java +++ b/platform-tooling-support-tests/projects/multi-release-jar/src/test/java/integration/integration/JupiterIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/multi-release-jar/src/test/java/integration/integration/ModuleUtilsTests.java b/platform-tooling-support-tests/projects/multi-release-jar/src/test/java/integration/integration/ModuleUtilsTests.java index c74a8e97c853..858a8d332111 100644 --- a/platform-tooling-support-tests/projects/multi-release-jar/src/test/java/integration/integration/ModuleUtilsTests.java +++ b/platform-tooling-support-tests/projects/multi-release-jar/src/test/java/integration/integration/ModuleUtilsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/reflection-tests/src/test/java/ReflectionTestCase.java b/platform-tooling-support-tests/projects/reflection-tests/src/test/java/ReflectionTestCase.java index a6df7c7dcfd7..188ff6eaf620 100644 --- a/platform-tooling-support-tests/projects/reflection-tests/src/test/java/ReflectionTestCase.java +++ b/platform-tooling-support-tests/projects/reflection-tests/src/test/java/ReflectionTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/standalone/src/standalone/JupiterIntegration.java b/platform-tooling-support-tests/projects/standalone/src/standalone/JupiterIntegration.java index 718927809b9c..e8bbce2489cb 100644 --- a/platform-tooling-support-tests/projects/standalone/src/standalone/JupiterIntegration.java +++ b/platform-tooling-support-tests/projects/standalone/src/standalone/JupiterIntegration.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/standalone/src/standalone/JupiterParamsIntegration.java b/platform-tooling-support-tests/projects/standalone/src/standalone/JupiterParamsIntegration.java index c2e632a83a1e..7d81da33f214 100644 --- a/platform-tooling-support-tests/projects/standalone/src/standalone/JupiterParamsIntegration.java +++ b/platform-tooling-support-tests/projects/standalone/src/standalone/JupiterParamsIntegration.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/standalone/src/standalone/SuiteIntegration.java b/platform-tooling-support-tests/projects/standalone/src/standalone/SuiteIntegration.java index 3719ebd097af..5210add0a831 100644 --- a/platform-tooling-support-tests/projects/standalone/src/standalone/SuiteIntegration.java +++ b/platform-tooling-support-tests/projects/standalone/src/standalone/SuiteIntegration.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/standalone/src/standalone/VintageIntegration.java b/platform-tooling-support-tests/projects/standalone/src/standalone/VintageIntegration.java index 151460a6f0cc..a234e3516450 100644 --- a/platform-tooling-support-tests/projects/standalone/src/standalone/VintageIntegration.java +++ b/platform-tooling-support-tests/projects/standalone/src/standalone/VintageIntegration.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/vintage/src/test/java/DefaultPackageTest.java b/platform-tooling-support-tests/projects/vintage/src/test/java/DefaultPackageTest.java index beebfdd5fd54..8d73c776b02b 100644 --- a/platform-tooling-support-tests/projects/vintage/src/test/java/DefaultPackageTest.java +++ b/platform-tooling-support-tests/projects/vintage/src/test/java/DefaultPackageTest.java @@ -1,6 +1,6 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/projects/vintage/src/test/java/com/example/vintage/VintageTest.java b/platform-tooling-support-tests/projects/vintage/src/test/java/com/example/vintage/VintageTest.java index a6efb8990791..94a1b44247a8 100644 --- a/platform-tooling-support-tests/projects/vintage/src/test/java/com/example/vintage/VintageTest.java +++ b/platform-tooling-support-tests/projects/vintage/src/test/java/com/example/vintage/VintageTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/Helper.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/Helper.java index 9f5d3f08d1ee..7deff0c5ed1c 100644 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/Helper.java +++ b/platform-tooling-support-tests/src/main/java/platform/tooling/support/Helper.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/MavenRepo.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/MavenRepo.java index 84e47bfd98b8..d5ebac39bc92 100644 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/MavenRepo.java +++ b/platform-tooling-support-tests/src/main/java/platform/tooling/support/MavenRepo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/ProcessStarters.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/ProcessStarters.java index d96f387faf65..773b360aed7c 100644 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/ProcessStarters.java +++ b/platform-tooling-support-tests/src/main/java/platform/tooling/support/ProcessStarters.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/main/java/platform/tooling/support/ThirdPartyJars.java b/platform-tooling-support-tests/src/main/java/platform/tooling/support/ThirdPartyJars.java index 04ff5084b0dd..7873f4cae08d 100644 --- a/platform-tooling-support-tests/src/main/java/platform/tooling/support/ThirdPartyJars.java +++ b/platform-tooling-support-tests/src/main/java/platform/tooling/support/ThirdPartyJars.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/HelperTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/HelperTests.java index 15fe8d5e4ecd..6aaa2b1c29be 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/HelperTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/HelperTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java index c7cac81bbb4a..f451fa332b66 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/AntStarterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java index 54c297c863c8..635ea9b5f630 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ArchUnitTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/FilePrefix.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/FilePrefix.java index e19dfc041f22..a1bc3185986d 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/FilePrefix.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/FilePrefix.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GlobalResource.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GlobalResource.java index 637a9abb7ac4..8774adbda241 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GlobalResource.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GlobalResource.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java index 1a36ff86d129..092c48967b09 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GraalVmStarterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java index 89364149d815..6c05aef99240 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleKotlinExtensionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java index 79895cad55c4..fdc04d46445e 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleMissingEngineTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleModuleFileTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleModuleFileTests.java index e3fd94a7f67b..c79c2b4e54f4 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleModuleFileTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleModuleFileTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java index 6c61b76125b3..95d0a14a23f2 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GradleStarterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarContainsManifestFirstTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarContainsManifestFirstTests.java index aac342d5d92f..1a8a30c26adf 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarContainsManifestFirstTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarContainsManifestFirstTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java index 94999aaefcaa..4a03dcd5270f 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JarDescribeModuleTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java index fff8079e90d8..8cbe4e3ea29b 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/LocalMavenRepo.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/LocalMavenRepo.java index 614caa229137..dc9b99e58a8d 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/LocalMavenRepo.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/LocalMavenRepo.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ManifestTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ManifestTests.java index 5f507ea1d1f9..d215ca8e99c0 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ManifestTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ManifestTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenEnvVars.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenEnvVars.java index eebfc4ffd58f..f502c6120acd 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenEnvVars.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenEnvVars.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenPomFileTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenPomFileTests.java index e7e4fd4881b8..59dcef5d94ab 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenPomFileTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenPomFileTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenRepoProxy.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenRepoProxy.java index fa13d76b6ab5..96a657d750c8 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenRepoProxy.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenRepoProxy.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java index 4adbbcec40c1..9faf699942ea 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java index 49066bd07a39..a59d90ecbf53 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java index 794de9468ba6..e7987317cdd2 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ModularUserGuideTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java index 70c2679fc2d5..27f3c2a762b9 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/OutputAttachingExtension.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/OutputAttachingExtension.java index 9e7c2c3fa0e9..7d31baf23423 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/OutputAttachingExtension.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/OutputAttachingExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/Projects.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/Projects.java index b2e64d2848df..a1fda9669400 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/Projects.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/Projects.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java index c2f62026313d..bc9135a1cc54 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ReflectionCompatibilityTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java index a511b31f19e2..6cbb5bc931e1 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/StandaloneTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ToolProviderTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ToolProviderTests.java index 792e2aa49667..d018c629fc7a 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ToolProviderTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ToolProviderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java index b29abc319d76..39a02d21168e 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageGradleIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java index 9fc4294a3d5e..7f735753f009 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java index 052b3208e681..6bfd2ff168e1 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/XmlAssertions.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v2.0 which From a68309a9d10493574ab399f8117a69b40bdb3890 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 5 Jan 2025 15:44:04 +0000 Subject: [PATCH 459/611] Update dependency org.assertj:assertj-core to v3.27.2 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 921c3f707ae0..c686e6f201dd 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,7 +3,7 @@ ant = "1.10.15" apiguardian = "1.1.2" asciidoctorj-pdf = "2.3.19" asciidoctor-plugins = "4.0.4" # Check if workaround in documentation.gradle.kts can be removed when upgrading -assertj = "3.27.1" +assertj = "3.27.2" bnd = "7.1.0" checkstyle = "10.21.1" eclipse = "4.34.0" From ef13c441710cfe5713454bd41480a84a9b79bb60 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 5 Jan 2025 22:42:26 +0000 Subject: [PATCH 460/611] Update dependency ch.qos.logback:logback-core to v1.5.16 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c686e6f201dd..349db4973b86 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -14,7 +14,7 @@ junit4 = "4.13.2" junit4Min = "4.12" ktlint = "1.5.0" log4j = "2.24.3" -logback = "1.5.15" +logback = "1.5.16" mockito = "5.15.2" opentest4j = "1.3.0" openTestReporting = "0.2.0-M2" From 00b22a7864ffc608e7f0eb4ae072eff805581689 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 6 Jan 2025 15:09:36 +0100 Subject: [PATCH 461/611] Introduce dry-run mode --- .github/workflows/release.yml | 50 ++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e024e8f12b2e..124553894c5b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,12 +9,18 @@ on: stagingRepoId: description: ID of the Nexus staging repository (e.g. "orgjunit-1159") required: true + dryRun: + description: Whether to perform a dry run + type: boolean + required: false + default: false permissions: read-all env: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} STAGING_REPO_URL: https://oss.sonatype.org/service/local/repositories/${{ github.event.inputs.stagingRepoId }}/content + RELEASE_TAG: r${{ github.event.inputs.releaseVersion }} jobs: @@ -29,7 +35,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: fetch-depth: 1 - ref: "refs/tags/r${{ github.event.inputs.releaseVersion }}" + ref: "refs/tags/${{ env.RELEASE_TAG }}" - name: Download reference JAR from staging repository id: referenceJar run: | @@ -51,6 +57,7 @@ jobs: --remote-repo-url=${{ env.STAGING_REPO_URL }} - name: Generate build provenance attestations uses: actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0 + if: ${{ !github.event.inputs.dryRun }} with: subject-path: build/repo/**/*.jar - name: Upload local repository for later jobs @@ -91,12 +98,13 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: fetch-depth: 1 - ref: "refs/tags/r${{ github.event.inputs.releaseVersion }}" + ref: "refs/tags/${{ env.RELEASE_TAG }}" - name: Release staging repository uses: ./.github/actions/run-gradle with: encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} arguments: | + ${{ github.event.inputs.dryRun && '--dry-run' || '' }} \ releaseSonatypeStagingRepository \ --staging-repository-id=${{ github.event.inputs.stagingRepoId }} @@ -109,20 +117,21 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: fetch-depth: 1 - ref: "refs/tags/r${{ github.event.inputs.releaseVersion }}" + ref: "refs/tags/${{ env.RELEASE_TAG }}" - name: Configure Git run: | git config --global user.name "JUnit Team" git config --global user.email "team@junit.org" - name: Build and publish documentation uses: ./.github/actions/run-gradle + if: ${{ !github.event.inputs.dryRun }} with: encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} arguments: | --no-build-cache \ --no-configuration-cache \ clean \ - gitPublishPush \ + ${{ github.event.inputs.dryRun && 'gitPublishCommit' || 'gitPublishPush' }} \ -Pdocumentation.replaceCurrentDocs=${{ contains(github.event.inputs.releaseVersion, '-') && 'false' || 'true' }} - name: Wait for deployment to GitHub Pages id: pagesDeployment @@ -145,9 +154,11 @@ jobs: permissions: issues: write steps: - - name: Close milestone + - name: Find milestone + id: milestoneNumber uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 with: + result-encoding: string script: | const openMilestones = await github.rest.issues.listMilestones({ owner: context.repo.owner, @@ -155,10 +166,16 @@ jobs: state: 'open' }); const [milestone] = openMilestones.data.filter(x => x.title === "${{ github.event.inputs.releaseVersion }}") + return milestone.number; + - name: Close milestone + if: ${{ !github.event.inputs.dryRun }} + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 + with: + script: | await github.rest.issues.updateMilestone({ owner: context.repo.owner, repo: context.repo.repo, - milestone_number: milestone.number, + milestone_number: ${{ steps.milestoneNumber.outputs.result }}, state: 'closed' }); @@ -202,15 +219,15 @@ jobs: run: | git config user.name "JUnit Team" git config user.email "team@junit.org" - git switch -c "r${{ github.event.inputs.releaseVersion }}" + git switch -c "${{ env.RELEASE_TAG }}" git commit -a -m "Use ${{ github.event.inputs.releaseVersion }}" - git push origin "r${{ github.event.inputs.releaseVersion }}" + ${{ github.event.inputs.dryRun && '' || format('git push origin {0}', env.RELEASE_TAG) }} - name: Update main branch (only for GA releases) if: ${{ !contains(github.event.inputs.releaseVersion, '-') }} run: | git switch main - git merge --ff-only "r${{ github.event.inputs.releaseVersion }}" - git push origin main + git merge --ff-only "${{ env.RELEASE_TAG }}" + ${{ github.event.inputs.dryRun && '' || 'git push origin main' }} create_github_release: name: Create GitHub release @@ -219,7 +236,8 @@ jobs: permissions: contents: write steps: - - name: Create GitHub release + - name: Prepare request body + id: requestBody uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 with: script: | @@ -227,7 +245,7 @@ jobs: const jupiterVersion = releaseVersion; const vintageVersion = releaseVersion; const platformVersion = "1." + releaseVersion.substring(2); - await github.rest.repos.createRelease({ + return { owner: context.repo.owner, repo: context.repo.repo, tag_name: `r${releaseVersion}`, @@ -235,4 +253,10 @@ jobs: generate_release_notes: true, body: `JUnit ${jupiterVersion} = Platform ${platformVersion} + Jupiter ${jupiterVersion} + Vintage ${vintageVersion}\n\nSee [Release Notes](https://junit.org/junit5/docs/${releaseVersion}/release-notes/).`, prerelease: releaseVersion.includes("-"), - }); + }; + - name: Create GitHub release + if: ${{ !github.event.inputs.dryRun }} + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 + with: + script: | + await github.rest.repos.createRelease(JSON.parse(`${{ steps.requestBody.outputs.result }}`)); From 1b5006a1f47f86f7a63d6de14d4bbbd315eea6f0 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 6 Jan 2025 15:21:46 +0100 Subject: [PATCH 462/611] Inject repository owner for testing --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 124553894c5b..a81e0188dee7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -73,7 +73,7 @@ jobs: - name: Check out samples repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: - repository: junit-team/junit5-samples + repository: ${{ github.repository_owner }}/junit5-samples token: ${{ secrets.GITHUB_TOKEN }} fetch-depth: 1 - name: Set up JDK @@ -202,7 +202,7 @@ jobs: - name: Check out samples repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: - repository: junit-team/junit5-samples + repository: ${{ github.repository_owner }}/junit5-samples token: ${{ secrets.GITHUB_TOKEN }} fetch-depth: 1 - name: Set up JDK From c7c918c32331212d83a40c6abd415235c7c59e5d Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 6 Jan 2025 15:35:08 +0100 Subject: [PATCH 463/611] Inject custom GitHub token --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a81e0188dee7..591a3a3a1559 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -74,7 +74,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: repository: ${{ github.repository_owner }}/junit5-samples - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.GH_TOKEN }} fetch-depth: 1 - name: Set up JDK uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4 @@ -203,7 +203,7 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 with: repository: ${{ github.repository_owner }}/junit5-samples - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.GH_TOKEN }} fetch-depth: 1 - name: Set up JDK uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4 From b1484ed4c4e085585e4a8ea55c057e6af7709142 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 6 Jan 2025 16:55:19 +0100 Subject: [PATCH 464/611] Shorten names to improve summary graph --- .github/workflows/release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 591a3a3a1559..05515495d51f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,7 +25,7 @@ env: jobs: verify_reproducibility: - name: Verify artifacts are reproducible + name: Verify reproducibility runs-on: ubuntu-24.04 # required to get a recent version of `jc` permissions: attestations: write # required for build provenance attestation @@ -67,7 +67,7 @@ jobs: path: build/repo verify_consumability: - name: Verify artifacts are consumable + name: Verify consumability runs-on: ubuntu-latest steps: - name: Check out samples repository @@ -90,7 +90,7 @@ jobs: run: java src/Builder.java release_staging_repo: - name: Release staging repository + name: Release staging repo needs: [verify_reproducibility, verify_consumability] runs-on: ubuntu-latest steps: @@ -180,7 +180,7 @@ jobs: }); wait_for_maven_central: - name: Wait for sync to Maven Central + name: Wait for Maven Central needs: release_staging_repo runs-on: ubuntu-latest steps: From 71b3cdbe13b5f0a1bc56757ecdf302b9673ae0fd Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 6 Jan 2025 16:57:16 +0100 Subject: [PATCH 465/611] Checkout repo prior to running script --- .github/workflows/release.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 05515495d51f..e94081704475 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -184,6 +184,11 @@ jobs: needs: release_staging_repo runs-on: ubuntu-latest steps: + - name: Check out repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 + with: + fetch-depth: 1 + ref: "refs/tags/${{ env.RELEASE_TAG }}" - name: Download local Maven repository uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4 with: From b479c509f4691c8cec509ac41c6d34deed8c206d Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 6 Jan 2025 18:01:31 +0100 Subject: [PATCH 466/611] Inject GitHub credentials --- .github/workflows/release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e94081704475..4478200f0267 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -124,7 +124,9 @@ jobs: git config --global user.email "team@junit.org" - name: Build and publish documentation uses: ./.github/actions/run-gradle - if: ${{ !github.event.inputs.dryRun }} + env: + GIT_USERNAME: git + GIT_PASSWORD: ${{ secrets.GH_TOKEN }} with: encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} arguments: | From 7a9e5ae0ba751dda8e3c039bfad7082575974bbf Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 6 Jan 2025 18:01:40 +0100 Subject: [PATCH 467/611] Improve error message --- .github/workflows/release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4478200f0267..3e89749c0bac 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -168,6 +168,9 @@ jobs: state: 'open' }); const [milestone] = openMilestones.data.filter(x => x.title === "${{ github.event.inputs.releaseVersion }}") + if (!milestone) { + throw new Error('Milestone "${{ github.event.inputs.releaseVersion }}" not found'); + } return milestone.number; - name: Close milestone if: ${{ !github.event.inputs.dryRun }} From 28f19403da2a0aaff592e9cbae6e2b07feb89590 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 6 Jan 2025 18:01:56 +0100 Subject: [PATCH 468/611] Print Git status prior to creating commit --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3e89749c0bac..3fbd78971279 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -230,6 +230,7 @@ jobs: git config user.name "JUnit Team" git config user.email "team@junit.org" git switch -c "${{ env.RELEASE_TAG }}" + git status git commit -a -m "Use ${{ github.event.inputs.releaseVersion }}" ${{ github.event.inputs.dryRun && '' || format('git push origin {0}', env.RELEASE_TAG) }} - name: Update main branch (only for GA releases) From 42809a79dfaa9dc3b92fbde0197db1cc9a16a2b9 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 6 Jan 2025 18:11:52 +0100 Subject: [PATCH 469/611] Simplify github-script jobs again --- .github/workflows/release.yml | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3fbd78971279..26b96526d3df 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -157,6 +157,7 @@ jobs: issues: write steps: - name: Find milestone + if: ${{ !github.event.inputs.dryRun }} id: milestoneNumber uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 with: @@ -171,18 +172,14 @@ jobs: if (!milestone) { throw new Error('Milestone "${{ github.event.inputs.releaseVersion }}" not found'); } - return milestone.number; - - name: Close milestone - if: ${{ !github.event.inputs.dryRun }} - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 - with: - script: | - await github.rest.issues.updateMilestone({ + const requestBody = { owner: context.repo.owner, repo: context.repo.repo, - milestone_number: ${{ steps.milestoneNumber.outputs.result }}, + milestone_number: milestone.number, state: 'closed' - }); + }; + console.log(requestBody); + await github.rest.issues.updateMilestone(requestBody); wait_for_maven_central: name: Wait for Maven Central @@ -247,8 +244,8 @@ jobs: permissions: contents: write steps: - - name: Prepare request body - id: requestBody + - name: Create GitHub release + if: ${{ !github.event.inputs.dryRun }} uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 with: script: | @@ -256,7 +253,7 @@ jobs: const jupiterVersion = releaseVersion; const vintageVersion = releaseVersion; const platformVersion = "1." + releaseVersion.substring(2); - return { + const requestBody = { owner: context.repo.owner, repo: context.repo.repo, tag_name: `r${releaseVersion}`, @@ -265,9 +262,5 @@ jobs: body: `JUnit ${jupiterVersion} = Platform ${platformVersion} + Jupiter ${jupiterVersion} + Vintage ${vintageVersion}\n\nSee [Release Notes](https://junit.org/junit5/docs/${releaseVersion}/release-notes/).`, prerelease: releaseVersion.includes("-"), }; - - name: Create GitHub release - if: ${{ !github.event.inputs.dryRun }} - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 - with: - script: | - await github.rest.repos.createRelease(JSON.parse(`${{ steps.requestBody.outputs.result }}`)); + console.log(requestBody); + await github.rest.repos.createRelease(requestBody); From 39703161f05c88db907a7f53ddd0c8c553a8d70f Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Mon, 6 Jan 2025 18:18:12 +0100 Subject: [PATCH 470/611] Remove dry-run mode after local testing --- .github/workflows/release.yml | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 26b96526d3df..615aa2d61e78 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,11 +9,6 @@ on: stagingRepoId: description: ID of the Nexus staging repository (e.g. "orgjunit-1159") required: true - dryRun: - description: Whether to perform a dry run - type: boolean - required: false - default: false permissions: read-all @@ -57,7 +52,6 @@ jobs: --remote-repo-url=${{ env.STAGING_REPO_URL }} - name: Generate build provenance attestations uses: actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0 - if: ${{ !github.event.inputs.dryRun }} with: subject-path: build/repo/**/*.jar - name: Upload local repository for later jobs @@ -104,7 +98,6 @@ jobs: with: encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} arguments: | - ${{ github.event.inputs.dryRun && '--dry-run' || '' }} \ releaseSonatypeStagingRepository \ --staging-repository-id=${{ github.event.inputs.stagingRepoId }} @@ -133,7 +126,7 @@ jobs: --no-build-cache \ --no-configuration-cache \ clean \ - ${{ github.event.inputs.dryRun && 'gitPublishCommit' || 'gitPublishPush' }} \ + gitPublishPush \ -Pdocumentation.replaceCurrentDocs=${{ contains(github.event.inputs.releaseVersion, '-') && 'false' || 'true' }} - name: Wait for deployment to GitHub Pages id: pagesDeployment @@ -157,7 +150,6 @@ jobs: issues: write steps: - name: Find milestone - if: ${{ !github.event.inputs.dryRun }} id: milestoneNumber uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 with: @@ -229,13 +221,13 @@ jobs: git switch -c "${{ env.RELEASE_TAG }}" git status git commit -a -m "Use ${{ github.event.inputs.releaseVersion }}" - ${{ github.event.inputs.dryRun && '' || format('git push origin {0}', env.RELEASE_TAG) }} + git push origin "${{ env.RELEASE_TAG }}" - name: Update main branch (only for GA releases) if: ${{ !contains(github.event.inputs.releaseVersion, '-') }} run: | git switch main git merge --ff-only "${{ env.RELEASE_TAG }}" - ${{ github.event.inputs.dryRun && '' || 'git push origin main' }} + git push origin main create_github_release: name: Create GitHub release @@ -245,7 +237,6 @@ jobs: contents: write steps: - name: Create GitHub release - if: ${{ !github.event.inputs.dryRun }} uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 with: script: | From 4f926ed576b0290cd739925897ce658174ca5169 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 7 Jan 2025 10:49:33 +0100 Subject: [PATCH 471/611] Document #4120 in release notes --- .../docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 3c29620bee9a..4ee49424456c 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -137,6 +137,9 @@ JUnit repository on GitHub. thread dump to `System.out` prior to interrupting a test thread due to a timeout. * `TestReporter` now allows publishing files for a test method or test class which can be used to include them in test reports, such as the Open Test Reporting format. +* Auto-registered extensions can now be + <<../user-guide/index.adoc#extensions-registration-automatic-filtering, filtered>> using + include and exclude patterns that can be specified as configuration parameters. [[release-notes-5.12.0-M1-junit-vintage]] From 0a552398fa6a87ec1a492b4b023ab7f6367618e7 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Tue, 7 Jan 2025 10:49:59 +0100 Subject: [PATCH 472/611] Move entry to Platform section --- .../asciidoc/release-notes/release-notes-5.12.0-M1.adoc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 4ee49424456c..99de69a0b960 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -44,6 +44,10 @@ JUnit repository on GitHub. calling the internal `ReflectionUtils.makeAccessible(Field)` method directly. * Support both the primitive type `void` and the wrapper type `Void` in the internal `ReflectionUtils` to allow `String` to `Class` conversion in parameterized tests. +* New `--exclude-methodname` and `--include-methodname` options added to the + `ConsoleLauncher` to include or exclude methods based on fully qualified method names + without parameters. For example, `--exclude-methodname=^org\.example\..+#methodname` + will exclude all methods called `methodName` under package `org.example`. * Add support for passing line and column number to `ConsoleLauncher` via `--select-file` and `--select-resource`. * `ConsoleLauncher` now accepts multiple values for all `--select` options. @@ -96,10 +100,6 @@ JUnit repository on GitHub. [[release-notes-5.12.0-M1-junit-jupiter-new-features-and-improvements]] ==== New Features and Improvements -* New `--exclude-methodname` and `--include-methodname` options added to the - `ConsoleLauncher` to include or exclude methods based on fully qualified method names - without parameters. For example, `--exclude-methodname=^org\.example\..+#methodname` - will exclude all methods called `methodName` under package `org.example`. * In a `@ParameterizedTest` method, a `null` value can now be supplied for Java Date/Time types such as `LocalDate` if the new `nullable` attribute in `@JavaTimeConversionPattern` is set to `true`. From 7664e38a9bf1a9d7942685d366c1f04682610a64 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 7 Jan 2025 09:55:54 +0000 Subject: [PATCH 473/611] Update plugin spotless to v7 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 349db4973b86..0f35b8ed0443 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -98,5 +98,5 @@ jmh = { id = "me.champeau.jmh", version = "0.7.2" } nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" } plantuml = { id = "io.freefair.plantuml", version = "8.11" } shadow = { id = "com.gradleup.shadow", version = "8.3.5" } -spotless = { id = "com.diffplug.spotless", version = "6.25.0" } +spotless = { id = "com.diffplug.spotless", version = "7.0.0" } versions = { id = "com.github.ben-manes.versions", version = "0.51.0" } From bebff4123850e39517ac67dd31bbb0eff41fa0fc Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 8 Jan 2025 10:26:56 +0100 Subject: [PATCH 474/611] Revert "Update plugin spotless to v7" This reverts commit 7664e38a9bf1a9d7942685d366c1f04682610a64. --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0f35b8ed0443..349db4973b86 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -98,5 +98,5 @@ jmh = { id = "me.champeau.jmh", version = "0.7.2" } nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" } plantuml = { id = "io.freefair.plantuml", version = "8.11" } shadow = { id = "com.gradleup.shadow", version = "8.3.5" } -spotless = { id = "com.diffplug.spotless", version = "7.0.0" } +spotless = { id = "com.diffplug.spotless", version = "6.25.0" } versions = { id = "com.github.ben-manes.versions", version = "0.51.0" } From cc2f60c63548eb10d7dca0bba862e88e3a84bac2 Mon Sep 17 00:00:00 2001 From: "Y.H. Kuo" Date: Wed, 8 Jan 2025 19:26:28 +0900 Subject: [PATCH 475/611] Introduce from and to attributes on @EnumSource (#4221) The new attributes allow defining the range of enum constants to be tested. Resolves #4185. --------- Co-authored-by: Marc Philipp --- .../release-notes-5.12.0-M1.adoc | 2 + .../asciidoc/user-guide/writing-tests.adoc | 26 +++- .../java/example/ParameterizedTestDemo.java | 17 +++ .../provider/EnumArgumentsProvider.java | 14 +- .../jupiter/params/provider/EnumSource.java | 54 ++++++- .../provider/EnumArgumentsProviderTests.java | 133 ++++++++++++++---- 6 files changed, 215 insertions(+), 31 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 99de69a0b960..a0df1b06b7c3 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -137,6 +137,8 @@ JUnit repository on GitHub. thread dump to `System.out` prior to interrupting a test thread due to a timeout. * `TestReporter` now allows publishing files for a test method or test class which can be used to include them in test reports, such as the Open Test Reporting format. +* New `from` and `to` attributes added to `@EnumSource` to support range selection of + enum constants. * Auto-registered extensions can now be <<../user-guide/index.adoc#extensions-registration-automatic-filtering, filtered>> using include and exclude patterns that can be specified as configuration parameters. diff --git a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc index 25a442d6c295..286727143a94 100644 --- a/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc +++ b/documentation/src/docs/asciidoc/user-guide/writing-tests.adoc @@ -1560,14 +1560,28 @@ include::{testDir}/example/ParameterizedTestDemo.java[tags=EnumSource_example_au ---- The annotation provides an optional `names` attribute that lets you specify which -constants shall be used, like in the following example. If omitted, all constants will be -used. +constants shall be used, like in the following example. [source,java,indent=0] ---- include::{testDir}/example/ParameterizedTestDemo.java[tags=EnumSource_include_example] ---- +In addition to `names`, you can use the `from` and `to` attributes to specify a range of +constants. The range starts from the constant specified in the `from` attribute and +includes all subsequent constants up to and including the one specified in the `to` +attribute, based on the natural order of the enum constants. + +If `from` and `to` attributes are omitted, they default to the first and last constants +in the enum type, respectively. If all `names`, `from`, and `to` attributes are omitted, +all constants will be used. The following example demonstrates how to specify a range of +constants. + +[source,java,indent=0] +---- +include::{testDir}/example/ParameterizedTestDemo.java[tags=EnumSource_range_example] +---- + The `@EnumSource` annotation also provides an optional `mode` attribute that enables fine-grained control over which constants are passed to the test method. For example, you can exclude names from the enum constant pool or specify regular expressions as in the @@ -1583,6 +1597,14 @@ include::{testDir}/example/ParameterizedTestDemo.java[tags=EnumSource_exclude_ex include::{testDir}/example/ParameterizedTestDemo.java[tags=EnumSource_regex_example] ---- +You can also combine `mode` with the `from`, `to` and `names` attributes to define a +range of constants while excluding specific values from that range as shown below. + +[source,java,indent=0] +---- +include::{testDir}/example/ParameterizedTestDemo.java[tags=EnumSource_range_exclude_example] +---- + [[writing-tests-parameterized-tests-sources-MethodSource]] ===== @MethodSource diff --git a/documentation/src/test/java/example/ParameterizedTestDemo.java b/documentation/src/test/java/example/ParameterizedTestDemo.java index c57a6ae3e0ad..d17d76624130 100644 --- a/documentation/src/test/java/example/ParameterizedTestDemo.java +++ b/documentation/src/test/java/example/ParameterizedTestDemo.java @@ -148,6 +148,14 @@ void testWithEnumSourceInclude(ChronoUnit unit) { } // end::EnumSource_include_example[] + // tag::EnumSource_range_example[] + @ParameterizedTest + @EnumSource(from = "HOURS", to = "DAYS") + void testWithEnumSourceRange(ChronoUnit unit) { + assertTrue(EnumSet.of(ChronoUnit.HOURS, ChronoUnit.HALF_DAYS, ChronoUnit.DAYS).contains(unit)); + } + // end::EnumSource_range_example[] + // tag::EnumSource_exclude_example[] @ParameterizedTest @EnumSource(mode = EXCLUDE, names = { "ERAS", "FOREVER" }) @@ -164,6 +172,15 @@ void testWithEnumSourceRegex(ChronoUnit unit) { } // end::EnumSource_regex_example[] + // tag::EnumSource_range_exclude_example[] + @ParameterizedTest + @EnumSource(from = "HOURS", to = "DAYS", mode = EXCLUDE, names = { "HALF_DAYS" }) + void testWithEnumSourceRangeExclude(ChronoUnit unit) { + assertTrue(EnumSet.of(ChronoUnit.HOURS, ChronoUnit.DAYS).contains(unit)); + assertFalse(EnumSet.of(ChronoUnit.HALF_DAYS).contains(unit)); + } + // end::EnumSource_range_exclude_example[] + // tag::simple_MethodSource_example[] @ParameterizedTest @MethodSource("stringProvider") diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumArgumentsProvider.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumArgumentsProvider.java index d339c59073d4..27e2d3a57fc8 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumArgumentsProvider.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumArgumentsProvider.java @@ -43,7 +43,19 @@ protected Stream provideArguments(ExtensionContext context, private > Set getEnumConstants(ExtensionContext context, EnumSource enumSource) { Class enumClass = determineEnumClass(context, enumSource); - return EnumSet.allOf(enumClass); + E[] constants = enumClass.getEnumConstants(); + if (constants.length == 0) { + Preconditions.condition(enumSource.from().isEmpty() && enumSource.to().isEmpty(), + "No enum constant in " + enumClass.getSimpleName() + ", but 'from' or 'to' is not empty."); + return EnumSet.noneOf(enumClass); + } + E from = enumSource.from().isEmpty() ? constants[0] : Enum.valueOf(enumClass, enumSource.from()); + E to = enumSource.to().isEmpty() ? constants[constants.length - 1] : Enum.valueOf(enumClass, enumSource.to()); + Preconditions.condition(from.compareTo(to) <= 0, + () -> String.format( + "Invalid enum range: 'from' (%s) must come before 'to' (%s) in the natural order of enum constants.", + from, to)); + return EnumSet.range(from, to); } @SuppressWarnings({ "unchecked", "rawtypes" }) diff --git a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumSource.java b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumSource.java index ddb790750dc6..20eb707d638d 100644 --- a/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumSource.java +++ b/junit-jupiter-params/src/main/java/org/junit/jupiter/params/provider/EnumSource.java @@ -40,8 +40,8 @@ * attribute. Otherwise, the declared type of the first parameter of the * {@code @ParameterizedTest} method is used. * - *

    The set of enum constants can be restricted via the {@link #names} and - * {@link #mode} attributes. + *

    The set of enum constants can be restricted via the {@link #names}, + * {@link #from}, {@link #to} and {@link #mode} attributes. * * @since 5.0 * @see org.junit.jupiter.params.provider.ArgumentsSource @@ -63,6 +63,8 @@ * first parameter of the {@code @ParameterizedTest} method is used. * * @see #names + * @see #from + * @see #to * @see #mode */ Class> value() default NullEnum.class; @@ -71,19 +73,61 @@ * The names of enum constants to provide, or regular expressions to select * the names of enum constants to provide. * - *

    If no names or regular expressions are specified, all enum constants - * declared in the specified {@linkplain #value enum type} will be provided. + *

    If no names or regular expressions are specified, and neither {@link #from} + * nor {@link #to} are specified, all enum constants declared in the specified + * {@linkplain #value enum type} will be provided. + * + *

    If {@link #from} or {@link #to} are specified, the elements in names must + * fall within the range defined by {@link #from} and {@link #to}. * *

    The {@link #mode} determines how the names are interpreted. * * @see #value + * @see #from + * @see #to * @see #mode */ String[] names() default {}; + /** + * The starting enum constant of the range to be included. + * + *

    Defaults to an empty string, where the range starts from the first enum + * constant of the specified {@linkplain #value enum type}. + * + * @see #value + * @see #names + * @see #to + * @see #mode + * + * @since 5.12 + */ + @API(status = EXPERIMENTAL, since = "5.12") + String from() default ""; + + /** + * The ending enum constant of the range to be included. + * + *

    Defaults to an empty string, where the range ends at the last enum + * constant of the specified {@linkplain #value enum type}. + * + * @see #value + * @see #names + * @see #from + * @see #mode + * + * @since 5.12 + */ + @API(status = EXPERIMENTAL, since = "5.12") + String to() default ""; + /** * The enum constant selection mode. * + *

    The mode only applies to the {@link #names} attribute and does not change + * the behavior of {@link #from} and {@link #to}, which always define a range + * based on the natural order of the enum constants. + * *

    Defaults to {@link Mode#INCLUDE INCLUDE}. * * @see Mode#INCLUDE @@ -92,6 +136,8 @@ * @see Mode#MATCH_ANY * @see Mode#MATCH_NONE * @see #names + * @see #from + * @see #to */ Mode mode() default Mode.INCLUDE; diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/EnumArgumentsProviderTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/EnumArgumentsProviderTests.java index a8363ce1c716..8d2d5cfbd170 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/EnumArgumentsProviderTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/params/provider/EnumArgumentsProviderTests.java @@ -12,8 +12,10 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.params.provider.EnumArgumentsProviderTests.EnumWithTwoConstants.BAR; -import static org.junit.jupiter.params.provider.EnumArgumentsProviderTests.EnumWithTwoConstants.FOO; +import static org.junit.jupiter.params.provider.EnumArgumentsProviderTests.EnumWithFourConstants.BAR; +import static org.junit.jupiter.params.provider.EnumArgumentsProviderTests.EnumWithFourConstants.BAZ; +import static org.junit.jupiter.params.provider.EnumArgumentsProviderTests.EnumWithFourConstants.FOO; +import static org.junit.jupiter.params.provider.EnumArgumentsProviderTests.EnumWithFourConstants.QUX; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -34,54 +36,56 @@ class EnumArgumentsProviderTests { @Test void providesAllEnumConstants() { - var arguments = provideArguments(EnumWithTwoConstants.class); + var arguments = provideArguments(EnumWithFourConstants.class); - assertThat(arguments).containsExactly(new Object[] { FOO }, new Object[] { BAR }); + assertThat(arguments).containsExactly(new Object[] { FOO }, new Object[] { BAR }, new Object[] { BAZ }, + new Object[] { QUX }); } @Test void provideSingleEnumConstant() { - var arguments = provideArguments(EnumWithTwoConstants.class, "FOO"); + var arguments = provideArguments(EnumWithFourConstants.class, "FOO"); assertThat(arguments).containsExactly(new Object[] { FOO }); } @Test void provideAllEnumConstantsWithNamingAll() { - var arguments = provideArguments(EnumWithTwoConstants.class, "FOO", "BAR"); + var arguments = provideArguments(EnumWithFourConstants.class, "FOO", "BAR"); assertThat(arguments).containsExactly(new Object[] { FOO }, new Object[] { BAR }); } @Test void duplicateConstantNameIsDetected() { - Exception exception = assertThrows(PreconditionViolationException.class, - () -> provideArguments(EnumWithTwoConstants.class, "FOO", "BAR", "FOO").findAny()); + var exception = assertThrows(PreconditionViolationException.class, + () -> provideArguments(EnumWithFourConstants.class, "FOO", "BAR", "FOO").findAny()); assertThat(exception).hasMessageContaining("Duplicate enum constant name(s) found"); } @Test void invalidConstantNameIsDetected() { - Exception exception = assertThrows(PreconditionViolationException.class, - () -> provideArguments(EnumWithTwoConstants.class, "FO0", "B4R").findAny()); + var exception = assertThrows(PreconditionViolationException.class, + () -> provideArguments(EnumWithFourConstants.class, "FO0", "B4R").findAny()); assertThat(exception).hasMessageContaining("Invalid enum constant name(s) in"); } @Test void invalidPatternIsDetected() { - Exception exception = assertThrows(PreconditionViolationException.class, - () -> provideArguments(EnumWithTwoConstants.class, Mode.MATCH_ALL, "(", ")").findAny()); + var exception = assertThrows(PreconditionViolationException.class, + () -> provideArguments(EnumWithFourConstants.class, Mode.MATCH_ALL, "(", ")").findAny()); assertThat(exception).hasMessageContaining("Pattern compilation failed"); } @Test void providesEnumConstantsBasedOnTestMethod() throws Exception { when(extensionContext.getRequiredTestMethod()).thenReturn( - TestCase.class.getDeclaredMethod("methodWithCorrectParameter", EnumWithTwoConstants.class)); + TestCase.class.getDeclaredMethod("methodWithCorrectParameter", EnumWithFourConstants.class)); var arguments = provideArguments(NullEnum.class); - assertThat(arguments).containsExactly(new Object[] { FOO }, new Object[] { BAR }); + assertThat(arguments).containsExactly(new Object[] { FOO }, new Object[] { BAR }, new Object[] { BAZ }, + new Object[] { QUX }); } @Test @@ -89,7 +93,7 @@ void incorrectParameterTypeIsDetected() throws Exception { when(extensionContext.getRequiredTestMethod()).thenReturn( TestCase.class.getDeclaredMethod("methodWithIncorrectParameter", Object.class)); - Exception exception = assertThrows(PreconditionViolationException.class, + var exception = assertThrows(PreconditionViolationException.class, () -> provideArguments(NullEnum.class).findAny()); assertThat(exception).hasMessageStartingWith("First parameter must reference an Enum type"); } @@ -99,13 +103,83 @@ void methodsWithoutParametersAreDetected() throws Exception { when(extensionContext.getRequiredTestMethod()).thenReturn( TestCase.class.getDeclaredMethod("methodWithoutParameters")); - Exception exception = assertThrows(PreconditionViolationException.class, + var exception = assertThrows(PreconditionViolationException.class, () -> provideArguments(NullEnum.class).findAny()); assertThat(exception).hasMessageStartingWith("Test method must declare at least one parameter"); } + @Test + void providesEnumConstantsStartingFromBar() { + var arguments = provideArguments(EnumWithFourConstants.class, "BAR", "", Mode.INCLUDE); + + assertThat(arguments).containsExactly(new Object[] { BAR }, new Object[] { BAZ }, new Object[] { QUX }); + } + + @Test + void providesEnumConstantsEndingAtBaz() { + var arguments = provideArguments(EnumWithFourConstants.class, "", "BAZ", Mode.INCLUDE); + + assertThat(arguments).containsExactly(new Object[] { FOO }, new Object[] { BAR }, new Object[] { BAZ }); + } + + @Test + void providesEnumConstantsFromBarToBaz() { + var arguments = provideArguments(EnumWithFourConstants.class, "BAR", "BAZ", Mode.INCLUDE); + + assertThat(arguments).containsExactly(new Object[] { BAR }, new Object[] { BAZ }); + } + + @Test + void providesEnumConstantsFromFooToBazWhileExcludingBar() { + var arguments = provideArguments(EnumWithFourConstants.class, "FOO", "BAZ", Mode.EXCLUDE, "BAR"); + + assertThat(arguments).containsExactly(new Object[] { FOO }, new Object[] { BAZ }); + } + + @Test + void providesNoEnumConstant() { + var arguments = provideArguments(EnumWithNoConstant.class); + + assertThat(arguments).isEmpty(); + } + + @Test + void invalidConstantNameIsDetectedInRange() { + var exception = assertThrows(PreconditionViolationException.class, + () -> provideArguments(EnumWithFourConstants.class, "FOO", "BAZ", Mode.EXCLUDE, "QUX").findAny()); + assertThat(exception).hasMessageContaining("Invalid enum constant name(s) in"); + } + + @Test + void invalidStartingRangeIsDetected() { + var exception = assertThrows(IllegalArgumentException.class, + () -> provideArguments(EnumWithFourConstants.class, "B4R", "", Mode.INCLUDE).findAny()); + assertThat(exception).hasMessageContaining("No enum constant"); + } + + @Test + void invalidEndingRangeIsDetected() { + var exception = assertThrows(IllegalArgumentException.class, + () -> provideArguments(EnumWithFourConstants.class, "", "B4R", Mode.INCLUDE).findAny()); + assertThat(exception).hasMessageContaining("No enum constant"); + } + + @Test + void invalidRangeOrderIsDetected() { + var exception = assertThrows(PreconditionViolationException.class, + () -> provideArguments(EnumWithFourConstants.class, "BAR", "FOO", Mode.INCLUDE).findAny()); + assertThat(exception).hasMessageContaining("Invalid enum range"); + } + + @Test + void invalidRangeIsDetectedWhenEnumWithNoConstantIsProvided() { + var exception = assertThrows(PreconditionViolationException.class, + () -> provideArguments(EnumWithNoConstant.class, "BAR", "FOO", Mode.INCLUDE).findAny()); + assertThat(exception).hasMessageContaining("No enum constant"); + } + static class TestCase { - void methodWithCorrectParameter(EnumWithTwoConstants parameter) { + void methodWithCorrectParameter(EnumWithFourConstants parameter) { } void methodWithIncorrectParameter(Object parameter) { @@ -115,8 +189,11 @@ void methodWithoutParameters() { } } - enum EnumWithTwoConstants { - FOO, BAR + enum EnumWithFourConstants { + FOO, BAR, BAZ, QUX + } + + enum EnumWithNoConstant { } private > Stream provideArguments(Class enumClass, String... names) { @@ -124,12 +201,20 @@ private > Stream provideArguments(Class enumClass } private > Stream provideArguments(Class enumClass, Mode mode, String... names) { + return provideArguments(enumClass, "", "", mode, names); + } + + private > Stream provideArguments(Class enumClass, String from, String to, Mode mode, + String... names) { var annotation = mock(EnumSource.class); - when(annotation.value()).thenAnswer(invocation -> enumClass); - when(annotation.mode()).thenAnswer(invocation -> mode); - when(annotation.names()).thenAnswer(invocation -> names); - when(annotation.toString()).thenReturn(String.format("@EnumSource(value=%s.class, mode=%s, names=%s)", - enumClass.getSimpleName(), mode, Arrays.toString(names))); + when(annotation.value()).thenAnswer(__ -> enumClass); + when(annotation.from()).thenReturn(from); + when(annotation.to()).thenReturn(to); + when(annotation.mode()).thenReturn(mode); + when(annotation.names()).thenReturn(names); + when(annotation.toString()).thenReturn( + String.format("@EnumSource(value=%s.class, from=%s, to=%s, mode=%s, names=%s)", enumClass.getSimpleName(), + from, to, mode, Arrays.toString(names))); var provider = new EnumArgumentsProvider(); provider.accept(annotation); From 3e040d0de5bb551517122e978b1ab2d315b59cf1 Mon Sep 17 00:00:00 2001 From: Yongjun Hong Date: Wed, 8 Jan 2025 19:42:09 +0900 Subject: [PATCH 476/611] Support parallelization in junit-vintage-engine (#4135) Top-level test classes are now executed in parallel if the `junit.vintage.execution.parallel.enabled` configuration parameter is set. The size of the used thread pool can be configured using the `junit.vintage.execution.parallel.pool-size` configuration parameter. It defaults to the number of available processors. Resolves #2229. --------- Co-authored-by: Marc Philipp --- .../release-notes-5.12.0-M1.adoc | 4 +- .../user-guide/migration-from-junit4.adoc | 25 +++++ .../org/junit/vintage/engine/Constants.java | 53 +++++++++ .../vintage/engine/VintageTestEngine.java | 98 +++++++++++++++- .../ParallelExecutionIntegrationTests.java | 106 ++++++++++++++++++ .../junit4/JUnit4ParallelTestCase.java | 67 +++++++++++ 6 files changed, 351 insertions(+), 2 deletions(-) create mode 100644 junit-vintage-engine/src/main/java/org/junit/vintage/engine/Constants.java create mode 100644 junit-vintage-engine/src/test/java/org/junit/vintage/engine/execution/ParallelExecutionIntegrationTests.java create mode 100644 junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4ParallelTestCase.java diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index a0df1b06b7c3..5c15b26ba6fa 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -160,4 +160,6 @@ JUnit repository on GitHub. [[release-notes-5.12.0-M1-junit-vintage-new-features-and-improvements]] ==== New Features and Improvements -* ❓ +* Introduced support for executing top-level test classes in parallel. Please refer to the + <<../user-guide/index.adoc#migrating-from-junit4-parallel-execution, User Guide>> for + more information. diff --git a/documentation/src/docs/asciidoc/user-guide/migration-from-junit4.adoc b/documentation/src/docs/asciidoc/user-guide/migration-from-junit4.adoc index 98e0b056af93..725b113dedc1 100644 --- a/documentation/src/docs/asciidoc/user-guide/migration-from-junit4.adoc +++ b/documentation/src/docs/asciidoc/user-guide/migration-from-junit4.adoc @@ -36,6 +36,31 @@ annotated with `@Category(Example.class)`, it will be tagged with `"com.acme.Exa Similar to the `Categories` runner in JUnit 4, this information can be used to filter the discovered tests before executing them (see <> for details). +[[migrating-from-junit4-parallel-execution]] +=== Parallel Execution + +The JUnit Vintage test engine supports parallel execution of top-level test classes, +allowing existing JUnit 3 and JUnit 4 tests to benefit from improved performance through +concurrent test execution. It can be enabled and configured using the following +<>: + +`junit.vintage.execution.parallel.enabled=true|false`:: + Enable/disable parallel execution (defaults to `false`). + +`junit.vintage.execution.parallel.pool-size=`:: + Specifies the size of the thread pool to be used for parallel execution. By default, the + number of available processors is used. + +Example configuration in `junit-platform.properties`: + +[source,properties] +---- +junit.vintage.execution.parallel.enabled=true +junit.vintage.execution.parallel.pool-size=4 +---- + +With these properties set, the `VintageTestEngine` will execute tests in parallel, +potentially significantly reducing the overall test suite execution time. [[migrating-from-junit4-tips]] === Migration Tips diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/Constants.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/Constants.java new file mode 100644 index 000000000000..abb85e3eb61d --- /dev/null +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/Constants.java @@ -0,0 +1,53 @@ +/* + * Copyright 2015-2025 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.vintage.engine; + +import static org.apiguardian.api.API.Status.EXPERIMENTAL; +import static org.apiguardian.api.API.Status.STABLE; + +import org.apiguardian.api.API; + +/** + * Collection of constants related to the {@link VintageTestEngine}. + * + * @since 5.12 + */ +@API(status = STABLE, since = "5.12") +public final class Constants { + + /** + * Indicates whether parallel execution is enabled for the JUnit Vintage engine. + * + *

    Set this property to {@code true} to enable parallel execution of tests. + * Defaults to {@code false}. + * + * @since 5.12 + */ + @API(status = EXPERIMENTAL, since = "5.12") + public static final String PARALLEL_EXECUTION_ENABLED = "junit.vintage.execution.parallel.enabled"; + + /** + * Specifies the size of the thread pool to be used for parallel execution. + * + *

    Set this property to an integer value to specify the number of threads + * to be used for parallel execution. Defaults to the number of available + * processors. + * + * @since 5.12 + */ + @API(status = EXPERIMENTAL, since = "5.12") + public static final String PARALLEL_POOL_SIZE = "junit.vintage.execution.parallel.pool-size"; + + private Constants() { + /* no-op */ + } + +} diff --git a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/VintageTestEngine.java b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/VintageTestEngine.java index 9d9eb57c280f..3d6840592891 100644 --- a/junit-vintage-engine/src/main/java/org/junit/vintage/engine/VintageTestEngine.java +++ b/junit-vintage-engine/src/main/java/org/junit/vintage/engine/VintageTestEngine.java @@ -12,12 +12,24 @@ import static org.apiguardian.api.API.Status.INTERNAL; import static org.junit.platform.engine.TestExecutionResult.successful; +import static org.junit.vintage.engine.Constants.PARALLEL_EXECUTION_ENABLED; +import static org.junit.vintage.engine.Constants.PARALLEL_POOL_SIZE; import static org.junit.vintage.engine.descriptor.VintageTestDescriptor.ENGINE_ID; +import java.util.ArrayList; import java.util.Iterator; +import java.util.List; import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; import org.apiguardian.api.API; +import org.junit.platform.commons.logging.Logger; +import org.junit.platform.commons.logging.LoggerFactory; +import org.junit.platform.commons.util.ExceptionUtils; import org.junit.platform.engine.EngineDiscoveryRequest; import org.junit.platform.engine.EngineExecutionListener; import org.junit.platform.engine.ExecutionRequest; @@ -37,6 +49,11 @@ @API(status = INTERNAL, since = "4.12") public final class VintageTestEngine implements TestEngine { + private static final Logger logger = LoggerFactory.getLogger(VintageTestEngine.class); + + private static final int DEFAULT_THREAD_POOL_SIZE = Runtime.getRuntime().availableProcessors(); + private static final int SHUTDOWN_TIMEOUT_SECONDS = 30; + @Override public String getId() { return ENGINE_ID; @@ -69,11 +86,73 @@ public void execute(ExecutionRequest request) { EngineExecutionListener engineExecutionListener = request.getEngineExecutionListener(); VintageEngineDescriptor engineDescriptor = (VintageEngineDescriptor) request.getRootTestDescriptor(); engineExecutionListener.executionStarted(engineDescriptor); - executeAllChildren(engineDescriptor, engineExecutionListener); + executeAllChildren(engineDescriptor, engineExecutionListener, request); engineExecutionListener.executionFinished(engineDescriptor, successful()); } private void executeAllChildren(VintageEngineDescriptor engineDescriptor, + EngineExecutionListener engineExecutionListener, ExecutionRequest request) { + boolean parallelExecutionEnabled = getParallelExecutionEnabled(request); + + if (parallelExecutionEnabled) { + if (executeInParallel(engineDescriptor, engineExecutionListener, request)) { + Thread.currentThread().interrupt(); + } + } + else { + executeSequentially(engineDescriptor, engineExecutionListener); + } + } + + private boolean executeInParallel(VintageEngineDescriptor engineDescriptor, + EngineExecutionListener engineExecutionListener, ExecutionRequest request) { + ExecutorService executorService = Executors.newFixedThreadPool(getThreadPoolSize(request)); + RunnerExecutor runnerExecutor = new RunnerExecutor(engineExecutionListener); + + List> futures = new ArrayList<>(); + for (Iterator iterator = engineDescriptor.getModifiableChildren().iterator(); iterator.hasNext();) { + TestDescriptor descriptor = iterator.next(); + CompletableFuture future = CompletableFuture.runAsync(() -> { + runnerExecutor.execute((RunnerTestDescriptor) descriptor); + }, executorService); + + futures.add(future); + iterator.remove(); + } + + CompletableFuture allOf = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])); + boolean wasInterrupted = false; + try { + allOf.get(); + } + catch (InterruptedException e) { + logger.warn(e, () -> "Interruption while waiting for parallel test execution to finish"); + wasInterrupted = true; + } + catch (ExecutionException e) { + throw ExceptionUtils.throwAsUncheckedException(e.getCause()); + } + finally { + shutdownExecutorService(executorService); + } + return wasInterrupted; + } + + private void shutdownExecutorService(ExecutorService executorService) { + try { + executorService.shutdown(); + if (!executorService.awaitTermination(SHUTDOWN_TIMEOUT_SECONDS, TimeUnit.SECONDS)) { + logger.warn(() -> "Executor service did not terminate within the specified timeout"); + executorService.shutdownNow(); + } + } + catch (InterruptedException e) { + logger.warn(e, () -> "Interruption while waiting for executor service to shut down"); + Thread.currentThread().interrupt(); + } + } + + private void executeSequentially(VintageEngineDescriptor engineDescriptor, EngineExecutionListener engineExecutionListener) { RunnerExecutor runnerExecutor = new RunnerExecutor(engineExecutionListener); for (Iterator iterator = engineDescriptor.getModifiableChildren().iterator(); iterator.hasNext();) { @@ -82,4 +161,21 @@ private void executeAllChildren(VintageEngineDescriptor engineDescriptor, } } + private boolean getParallelExecutionEnabled(ExecutionRequest request) { + return request.getConfigurationParameters().getBoolean(PARALLEL_EXECUTION_ENABLED).orElse(false); + } + + private int getThreadPoolSize(ExecutionRequest request) { + Optional poolSize = request.getConfigurationParameters().get(PARALLEL_POOL_SIZE); + if (poolSize.isPresent()) { + try { + return Integer.parseInt(poolSize.get()); + } + catch (NumberFormatException e) { + logger.warn(() -> "Invalid value for parallel pool size: " + poolSize.get()); + } + } + return DEFAULT_THREAD_POOL_SIZE; + } + } diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/execution/ParallelExecutionIntegrationTests.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/execution/ParallelExecutionIntegrationTests.java new file mode 100644 index 000000000000..9f535007ab77 --- /dev/null +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/execution/ParallelExecutionIntegrationTests.java @@ -0,0 +1,106 @@ +/* + * Copyright 2015-2025 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.vintage.engine.execution; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.platform.testkit.engine.EventConditions.container; +import static org.junit.platform.testkit.engine.EventConditions.event; +import static org.junit.platform.testkit.engine.EventConditions.finishedSuccessfully; +import static org.junit.platform.testkit.engine.EventConditions.started; +import static org.junit.vintage.engine.Constants.PARALLEL_EXECUTION_ENABLED; +import static org.junit.vintage.engine.Constants.PARALLEL_POOL_SIZE; +import static org.junit.vintage.engine.descriptor.VintageTestDescriptor.SEGMENT_TYPE_RUNNER; +import static org.junit.vintage.engine.samples.junit4.JUnit4ParallelTestCase.AbstractBlockingTestCase; +import static org.junit.vintage.engine.samples.junit4.JUnit4ParallelTestCase.FirstTestCase; +import static org.junit.vintage.engine.samples.junit4.JUnit4ParallelTestCase.ThirdTestCase; + +import java.time.Instant; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.concurrent.CountDownLatch; + +import org.assertj.core.api.Condition; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestReporter; +import org.junit.platform.engine.discovery.ClassSelector; +import org.junit.platform.engine.discovery.DiscoverySelectors; +import org.junit.platform.launcher.LauncherDiscoveryRequest; +import org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder; +import org.junit.platform.testkit.engine.EngineExecutionResults; +import org.junit.platform.testkit.engine.EngineTestKit; +import org.junit.platform.testkit.engine.Event; +import org.junit.platform.testkit.engine.Events; +import org.junit.vintage.engine.VintageTestEngine; +import org.junit.vintage.engine.samples.junit4.JUnit4ParallelTestCase.SecondTestCase; + +class ParallelExecutionIntegrationTests { + + @Test + void executesTestClassesInParallel(TestReporter reporter) { + AbstractBlockingTestCase.threadNames.clear(); + AbstractBlockingTestCase.countDownLatch = new CountDownLatch(3); + + var events = executeInParallelSuccessfully(3, FirstTestCase.class, SecondTestCase.class, + ThirdTestCase.class).list(); + + var startedTimestamps = getTimestampsFor(events, event(container(SEGMENT_TYPE_RUNNER), started())); + var finishedTimestamps = getTimestampsFor(events, + event(container(SEGMENT_TYPE_RUNNER), finishedSuccessfully())); + var threadNames = new HashSet<>(AbstractBlockingTestCase.threadNames); + + reporter.publishEntry("startedTimestamps", startedTimestamps.toString()); + reporter.publishEntry("finishedTimestamps", finishedTimestamps.toString()); + + assertThat(startedTimestamps).hasSize(3); + assertThat(finishedTimestamps).hasSize(3); + assertThat(startedTimestamps).allMatch(startTimestamp -> finishedTimestamps.stream().noneMatch( + finishedTimestamp -> finishedTimestamp.isBefore(startTimestamp))); + assertThat(threadNames).hasSize(3); + } + + private List getTimestampsFor(List events, Condition condition) { + // @formatter:off + return events.stream() + .filter(condition::matches) + .map(Event::getTimestamp) + .toList(); + // @formatter:on + } + + private Events executeInParallelSuccessfully(int poolSize, Class... testClasses) { + var events = execute(poolSize, testClasses).allEvents(); + try { + return events.assertStatistics(it -> it.failed(0)); + } + catch (AssertionError error) { + events.debug(); + throw error; + } + } + + private static EngineExecutionResults execute(int poolSize, Class... testClass) { + return EngineTestKit.execute(new VintageTestEngine(), request(poolSize, testClass)); + } + + private static LauncherDiscoveryRequest request(int poolSize, Class... testClasses) { + var classSelectors = Arrays.stream(testClasses) // + .map(DiscoverySelectors::selectClass) // + .toArray(ClassSelector[]::new); + + return LauncherDiscoveryRequestBuilder.request() // + .selectors(classSelectors) // + .configurationParameter(PARALLEL_EXECUTION_ENABLED, String.valueOf(true)) // + .configurationParameter(PARALLEL_POOL_SIZE, String.valueOf(poolSize)) // + .build(); + } + +} diff --git a/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4ParallelTestCase.java b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4ParallelTestCase.java new file mode 100644 index 000000000000..4e8e0c62c8c2 --- /dev/null +++ b/junit-vintage-engine/src/testFixtures/java/org/junit/vintage/engine/samples/junit4/JUnit4ParallelTestCase.java @@ -0,0 +1,67 @@ +/* + * Copyright 2015-2025 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.vintage.engine.samples.junit4; + +import static java.util.concurrent.TimeUnit.MILLISECONDS; + +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CountDownLatch; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.experimental.runners.Enclosed; +import org.junit.rules.TestWatcher; +import org.junit.runner.Description; +import org.junit.runner.RunWith; + +@RunWith(Enclosed.class) +public class JUnit4ParallelTestCase { + + public static class AbstractBlockingTestCase { + + public static final Set threadNames = ConcurrentHashMap.newKeySet(); + public static CountDownLatch countDownLatch; + + @Rule + public final TestWatcher testWatcher = new TestWatcher() { + @Override + protected void starting(Description description) { + AbstractBlockingTestCase.threadNames.add(Thread.currentThread().getName()); + } + }; + + @Test + public void test() throws Exception { + countDownAndBlock(countDownLatch); + } + + @SuppressWarnings("ResultOfMethodCallIgnored") + private static void countDownAndBlock(CountDownLatch countDownLatch) throws InterruptedException { + countDownLatch.countDown(); + countDownLatch.await(estimateSimulatedTestDurationInMilliseconds(), MILLISECONDS); + } + + private static long estimateSimulatedTestDurationInMilliseconds() { + var runningInCi = Boolean.parseBoolean(System.getenv("CI")); + return runningInCi ? 1000 : 100; + } + } + + public static class FirstTestCase extends AbstractBlockingTestCase { + } + + public static class SecondTestCase extends AbstractBlockingTestCase { + } + + public static class ThirdTestCase extends AbstractBlockingTestCase { + } +} From 23cf286b1da27ad70b3aae1677c49e40f931c6c4 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 9 Jan 2025 09:22:00 +0100 Subject: [PATCH 477/611] Close milestone early to avoid late failures in the workflow --- .github/workflows/release.yml | 65 ++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 615aa2d61e78..62ba1959e05f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -83,9 +83,41 @@ jobs: - name: Build samples run: java src/Builder.java + close_github_milestone: + name: Close GitHub milestone + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - name: Close GitHub milestone + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 + with: + result-encoding: string + script: | + const openMilestones = await github.rest.issues.listMilestones({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'open' + }); + const [milestone] = openMilestones.data.filter(x => x.title === "${{ github.event.inputs.releaseVersion }}") + if (!milestone) { + throw new Error('Milestone "${{ github.event.inputs.releaseVersion }}" not found'); + } + if (milestone.open_issues > 0) { + throw new Error(`Milestone "${{ github.event.inputs.releaseVersion }}" has ${milestone.open_issues} open issue(s)`); + } + const requestBody = { + owner: context.repo.owner, + repo: context.repo.repo, + milestone_number: milestone.number, + state: 'closed' + }; + console.log(requestBody); + await github.rest.issues.updateMilestone(requestBody); + release_staging_repo: name: Release staging repo - needs: [verify_reproducibility, verify_consumability] + needs: [verify_reproducibility, verify_consumability, close_github_milestone] runs-on: ubuntu-latest steps: - name: Check out repository @@ -142,37 +174,6 @@ jobs: sudo apt-get update && sudo apt-get install --yes poppler-utils pdfinfo /tmp/junit-user-guide.pdf - close_github_milestone: - name: Close GitHub milestone - needs: release_staging_repo - runs-on: ubuntu-latest - permissions: - issues: write - steps: - - name: Find milestone - id: milestoneNumber - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 - with: - result-encoding: string - script: | - const openMilestones = await github.rest.issues.listMilestones({ - owner: context.repo.owner, - repo: context.repo.repo, - state: 'open' - }); - const [milestone] = openMilestones.data.filter(x => x.title === "${{ github.event.inputs.releaseVersion }}") - if (!milestone) { - throw new Error('Milestone "${{ github.event.inputs.releaseVersion }}" not found'); - } - const requestBody = { - owner: context.repo.owner, - repo: context.repo.repo, - milestone_number: milestone.number, - state: 'closed' - }; - console.log(requestBody); - await github.rest.issues.updateMilestone(requestBody); - wait_for_maven_central: name: Wait for Maven Central needs: release_staging_repo From e2e093a64cbf2f5c1962b7879f987ef607f0ba8a Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 9 Jan 2025 10:34:15 +0100 Subject: [PATCH 478/611] Set milestone date when closing --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 62ba1959e05f..9b79bf6b2052 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -110,7 +110,8 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, milestone_number: milestone.number, - state: 'closed' + state: 'closed', + due_on: new Date().toISOString() }; console.log(requestBody); await github.rest.issues.updateMilestone(requestBody); From d01905fe4f94577e2b558b7e4906d9ee9a95bc8d Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 9 Jan 2025 10:36:32 +0100 Subject: [PATCH 479/611] Inject Sonatype credentials --- .github/workflows/release.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9b79bf6b2052..2b0546007916 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -118,7 +118,7 @@ jobs: release_staging_repo: name: Release staging repo - needs: [verify_reproducibility, verify_consumability, close_github_milestone] + needs: [ verify_reproducibility, verify_consumability, close_github_milestone ] runs-on: ubuntu-latest steps: - name: Check out repository @@ -128,6 +128,9 @@ jobs: ref: "refs/tags/${{ env.RELEASE_TAG }}" - name: Release staging repository uses: ./.github/actions/run-gradle + env: + ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} + ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} with: encryptionKey: ${{ secrets.GRADLE_ENCRYPTION_KEY }} arguments: | From 872d95a443aff3785537d4dc3d26e1f2d4640d8f Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 9 Jan 2025 10:42:31 +0100 Subject: [PATCH 480/611] Install Graphviz prior to building documentation --- .github/workflows/release.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2b0546007916..dd4bada44ccb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -147,6 +147,10 @@ jobs: with: fetch-depth: 1 ref: "refs/tags/${{ env.RELEASE_TAG }}" + - name: Install Graphviz and Poppler + run: | + sudo apt-get update + sudo apt-get install --yes graphviz poppler-utils - name: Configure Git run: | git config --global user.name "JUnit Team" @@ -175,7 +179,6 @@ jobs: timeout-minutes: 15 run: | curl --silent --fail --location --output /tmp/junit-user-guide.pdf "${{ steps.pagesDeployment.outputs.pdfUrl }}" - sudo apt-get update && sudo apt-get install --yes poppler-utils pdfinfo /tmp/junit-user-guide.pdf wait_for_maven_central: From 097b7bfc83c926cc1e36d0ae0d17dbe1151bbe01 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 9 Jan 2025 10:42:51 +0100 Subject: [PATCH 481/611] Remove unnecessary timeout --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dd4bada44ccb..8c441ff0ec73 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -176,7 +176,6 @@ jobs: ./.github/scripts/waitForUrl.sh "$URL" echo "pdfUrl=$URL" >> "$GITHUB_OUTPUT" - name: Verify integrity of PDF version of User Guide - timeout-minutes: 15 run: | curl --silent --fail --location --output /tmp/junit-user-guide.pdf "${{ steps.pagesDeployment.outputs.pdfUrl }}" pdfinfo /tmp/junit-user-guide.pdf From 9130f38e823ab123ebd87044bfac27468558e2c6 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 10 Jan 2025 15:28:19 +0100 Subject: [PATCH 482/611] Document release steps as a checklist (#4239) Document the steps involved in doing a release as a checklist. --- RELEASING.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 RELEASING.md diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 000000000000..e22831147713 --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,42 @@ +# Releasing + +## Pre-release steps + +- [ ] Switch or create the release branch for this feature release (e.g. `releases/5.12.x`) +- [ ] Change `version`, `platformVersion`, and `vintageVersion` in `gradle.properties` to the versions about to be released +- [ ] Change release date in Release Notes +- [ ] Change release date in `README.MD` +- [ ] Commit with message "Release ${VERSION}" +- [ ] Execute `./gradlew --no-build-cache --no-configuration-cache clean build publish closeSonatypeStagingRepository` +- [ ] Tag current commit: `git tag -s -m ${VERSION} r${VERSION}` +- [ ] Push release branch and tag to GitHub: `git push --set-upstream --follow-tags origin HEAD` +- [ ] Trigger a [release build](https://github.com/junit-team/junit5/actions/workflows/release.yml): `gh workflow run --ref $(git rev-parse --abbrev-ref HEAD) -f releaseVersion=${VERSION} -f stagingRepoId=orgjunit-1234 release.yml` + - Select the release branch + - Enter the version to be released + - Enter the staging repository ID from the output of above Gradle build + +## Post-release steps + +- [ ] Change `version`, `platformVersion`, and `vintageVersion` properties in `gradle.properties` on release branch to new development versions and commit with message "Back to snapshots for further development" or similar and push to GitHub +- [ ] Post about the new release: + - [ ] [Mastodon](https://fosstodon.org/@junit) + - [ ] [Bluesky](https://bsky.app/profile/junit.org) + - [ ] [Twitter/X](https://x.com/junitteam) + +### Preview releases (milestones and release candidates) + +- [ ] Fast-forward merge the release branch to `main` and push to GitHub +- [ ] Create release notes for the next preview or feature release from the template + +### Feature releases (5.x.0) + +- [ ] Fast-forward merge the release branch to `main` and push to GitHub +- [ ] Update the [security policy](https://github.com/junit-team/junit5/blob/main/SECURITY.md) and commit with message "Update security policy to reflect 5.x release" or similar +- [ ] Create release notes for the next feature release from the template +- [ ] Update [JBang catalog](https://github.com/junit-team/jbang-catalog/blob/main/jbang-catalog.json) + +### Patch releases (5.x.y) + +- [ ] Cherry-pick the tagged commit from the release branch to `main` and resolve the conflict in `gradle.properties` by choosing the version of the `main` branch +- [ ] Include the release notes of the patch release on `main` if not already present +- [ ] Update [JBang catalog](https://github.com/junit-team/jbang-catalog/blob/main/jbang-catalog.json) From 79982756fa8a8f55c7b25e1e3aa43652780d6976 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 18:57:42 +0000 Subject: [PATCH 483/611] Update actions/upload-artifact digest to 65c4c4a --- .github/actions/main-build/action.yml | 2 +- .github/workflows/cross-version.yml | 4 ++-- .github/workflows/ossf-scorecard.yml | 2 +- .github/workflows/release.yml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/actions/main-build/action.yml b/.github/actions/main-build/action.yml index d4e42c6e26bd..ecafefb92517 100644 --- a/.github/actions/main-build/action.yml +++ b/.github/actions/main-build/action.yml @@ -16,7 +16,7 @@ runs: with: arguments: ${{ inputs.arguments }} encryptionKey: ${{ inputs.encryptionKey }} - - uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4 + - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4 if: ${{ always() }} with: name: Open Test Reports (${{ github.job }}) diff --git a/.github/workflows/cross-version.yml b/.github/workflows/cross-version.yml index 6f8c7d040197..5537dc968db4 100644 --- a/.github/workflows/cross-version.yml +++ b/.github/workflows/cross-version.yml @@ -67,7 +67,7 @@ jobs: -Dscan.tag.JDK_${{ matrix.jdk.version }} \ build \ --no-configuration-cache #Disable configuration cache due to https://github.com/diffplug/spotless/issues/2318 - - uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4 + - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4 if: ${{ always() }} with: name: Open Test Reports (${{ github.job }} ${{ matrix.jdk.version }} (${{ matrix.jdk.release || matrix.jdk.type }})) @@ -109,7 +109,7 @@ jobs: -Dscan.tag.OpenJ9 \ build \ --no-configuration-cache # Disable configuration cache due to https://github.com/diffplug/spotless/issues/2318 - - uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4 + - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4 if: ${{ always() }} with: name: Open Test Reports (${{ github.job }}) diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index 85adecb323ac..a00fe401c720 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -48,7 +48,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.pre.node20 + uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.pre.node20 with: name: SARIF file path: results.sarif diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8c441ff0ec73..873723ee9d34 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -55,7 +55,7 @@ jobs: with: subject-path: build/repo/**/*.jar - name: Upload local repository for later jobs - uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4 + uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4 with: name: local-maven-repository path: build/repo From 28a261e1211965ce41d418a0a8bccf17fae9aeec Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 11 Jan 2025 08:41:12 +0000 Subject: [PATCH 484/611] Update github/codeql-action digest to b6a472f --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/ossf-scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6bdcd3958901..e5050471788c 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -34,7 +34,7 @@ jobs: - name: Check out repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Initialize CodeQL - uses: github/codeql-action/init@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3 + uses: github/codeql-action/init@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3 with: languages: ${{ matrix.language }} tools: linked @@ -47,4 +47,4 @@ jobs: -Dscan.tag.CodeQL \ allMainClasses - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3 + uses: github/codeql-action/analyze@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3 diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index a00fe401c720..83eb112f1b21 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard (optional). # Commenting out will disable upload of results to your repo's Code Scanning dashboard - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3 + uses: github/codeql-action/upload-sarif@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3 with: sarif_file: results.sarif From 86a64bbf3de8e3ef29203824f228afbea37293d3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 14 Jan 2025 17:15:48 +0000 Subject: [PATCH 485/611] Update dependency gg.jte:jte to v3.1.16 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 349db4973b86..9ab8ce3c6a7f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -46,7 +46,7 @@ jimfs = { module = "com.google.jimfs:jimfs", version = "1.3.0" } jmh-core = { module = "org.openjdk.jmh:jmh-core", version.ref = "jmh" } jmh-generator-annprocess = { module = "org.openjdk.jmh:jmh-generator-annprocess", version.ref = "jmh" } joox = { module = "org.jooq:joox", version = "2.0.1" } -jte = { module = "gg.jte:jte", version = "3.1.15" } +jte = { module = "gg.jte:jte", version = "3.1.16" } junit4 = { module = "junit:junit", version = { require = "[4.12,)", prefer = "4.13.2" } } kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.10.1" } log4j-core = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j" } From 1a03531f9e95d6d27bfef0401b80d3d359488afc Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Wed, 15 Jan 2025 09:27:48 +0100 Subject: [PATCH 486/611] Check for classpath alignment on LinkageErrors (#4244) The Launcher now checks for classpath alignment in case a LinkageError such as a ClassNotFoundError is thrown from one of the methods of the Launcher or TestEngine interfaces. If it finds unaligned versions, it wraps the LinkageError in a JUnitException with a message listing the detected versions and a link to the User Guide. Resolves #3935. --- .../docs/asciidoc/user-guide/appendix.adoc | 20 ++++ .../core/ClasspathAlignmentChecker.java | 110 ++++++++++++++++++ ...hAlignmentCheckingLauncherInterceptor.java | 40 +++++++ .../core/EngineDiscoveryOrchestrator.java | 10 +- .../core/EngineExecutionOrchestrator.java | 11 +- .../launcher/core/LauncherFactory.java | 7 +- platform-tests/platform-tests.gradle.kts | 7 +- .../core/ClasspathAlignmentCheckerTests.java | 85 ++++++++++++++ .../projects/maven-starter/pom.xml | 7 ++ .../support/tests/JavaVersionsTests.java | 3 +- .../tooling/support/tests/MavenEnvVars.java | 15 +-- .../support/tests/MultiReleaseJarTests.java | 3 +- .../tests/UnalignedClasspathTests.java | 75 ++++++++++++ 13 files changed, 375 insertions(+), 18 deletions(-) create mode 100644 junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ClasspathAlignmentChecker.java create mode 100644 junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ClasspathAlignmentCheckingLauncherInterceptor.java create mode 100644 platform-tests/src/test/java/org/junit/platform/launcher/core/ClasspathAlignmentCheckerTests.java create mode 100644 platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/UnalignedClasspathTests.java diff --git a/documentation/src/docs/asciidoc/user-guide/appendix.adoc b/documentation/src/docs/asciidoc/user-guide/appendix.adoc index 2f3ae2bf5e93..ab63a5a90b3b 100644 --- a/documentation/src/docs/asciidoc/user-guide/appendix.adoc +++ b/documentation/src/docs/asciidoc/user-guide/appendix.adoc @@ -21,6 +21,26 @@ Artifacts for final releases and milestones are deployed to {Maven_Central}, and artifacts are deployed to Sonatype's {snapshot-repo}[snapshots repository] under {snapshot-repo}/org/junit/[/org/junit]. +The sections below list all artifacts with their versions for the three groups: +<>, +<>, and +<>. +The <> contains a list of all +of the above artifacts and their versions. + +[TIP] +.Aligning dependency versions +==== +To ensure that all JUnit artifacts are compatible with each other, their versions should +be aligned. +If you rely on <> for dependency management, +please see the corresponding section. +Otherwise, instead of managing individual versions of the JUnit artifacts, it is +recommended to apply the <> to your project. +Please refer to the corresponding sections for <> or +<>. +==== + [[dependency-metadata-junit-platform]] ==== JUnit Platform diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ClasspathAlignmentChecker.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ClasspathAlignmentChecker.java new file mode 100644 index 000000000000..3b95f7153e6a --- /dev/null +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ClasspathAlignmentChecker.java @@ -0,0 +1,110 @@ +/* + * Copyright 2015-2025 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.launcher.core; + +import static java.util.Collections.unmodifiableList; +import static java.util.Comparator.comparing; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.function.Function; + +import org.junit.platform.commons.JUnitException; +import org.junit.platform.commons.support.ReflectionSupport; +import org.junit.platform.commons.util.ClassLoaderUtils; + +/** + * @since 1.12 + */ +class ClasspathAlignmentChecker { + + // VisibleForTesting + static final List WELL_KNOWN_PACKAGES = unmodifiableList(Arrays.asList( // + "org.junit.jupiter.api", // + "org.junit.jupiter.engine", // + "org.junit.jupiter.migrationsupport", // + "org.junit.jupiter.params", // + "org.junit.platform.commons", // + "org.junit.platform.console", // + "org.junit.platform.engine", // + "org.junit.platform.jfr", // + "org.junit.platform.launcher", // + "org.junit.platform.reporting", // + "org.junit.platform.runner", // + "org.junit.platform.suite.api", // + "org.junit.platform.suite.commons", // + "org.junit.platform.suite.engine", // + "org.junit.platform.testkit", // + "org.junit.vintage.engine" // + )); + + static Optional check(LinkageError error) { + ClassLoader classLoader = ClassLoaderUtils.getClassLoader(ClasspathAlignmentChecker.class); + Function packageLookup = name -> ReflectionSupport.findMethod(ClassLoader.class, + "getDefinedPackage", String.class) // + .map(m -> (Package) ReflectionSupport.invokeMethod(m, classLoader, name)) // + .orElseGet(() -> getPackage(name)); + return check(error, packageLookup); + } + + // VisibleForTesting + static Optional check(LinkageError error, Function packageLookup) { + Map> packagesByVersions = new HashMap<>(); + WELL_KNOWN_PACKAGES.stream() // + .map(packageLookup) // + .filter(Objects::nonNull) // + .forEach(pkg -> { + String version = pkg.getImplementationVersion(); + if (version != null) { + if (pkg.getName().startsWith("org.junit.platform") && version.contains(".")) { + version = platformToJupiterVersion(version); + } + packagesByVersions.computeIfAbsent(version, __ -> new ArrayList<>()).add(pkg); + } + }); + if (packagesByVersions.size() > 1) { + StringBuilder message = new StringBuilder(); + String lineBreak = System.lineSeparator(); + message.append("The wrapped ").append(error.getClass().getSimpleName()) // + .append(" is likely caused by the versions of JUnit jars on the classpath/module path ") // + .append("not being properly aligned. ") // + .append(lineBreak) // + .append("Please ensure consistent versions are used (see https://junit.org/junit5/docs/") // + .append(platformToJupiterVersion( + ClasspathAlignmentChecker.class.getPackage().getImplementationVersion())) // + .append("/user-guide/#dependency-metadata).") // + .append(lineBreak) // + .append("The following conflicting versions were detected:").append(lineBreak); + packagesByVersions.values().stream() // + .flatMap(List::stream) // + .sorted(comparing(Package::getName)) // + .map(pkg -> String.format("- %s: %s%n", pkg.getName(), pkg.getImplementationVersion())) // + .forEach(message::append); + return Optional.of(new JUnitException(message.toString(), error)); + } + return Optional.empty(); + } + + private static String platformToJupiterVersion(String version) { + int majorVersion = Integer.parseInt(version.substring(0, version.indexOf("."))) + 4; + return majorVersion + version.substring(version.indexOf(".")); + } + + @SuppressWarnings({ "deprecation", "RedundantSuppression" }) // only called when running on JDK 8 + private static Package getPackage(String name) { + return Package.getPackage(name); + } +} diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ClasspathAlignmentCheckingLauncherInterceptor.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ClasspathAlignmentCheckingLauncherInterceptor.java new file mode 100644 index 000000000000..4bef73ba35d7 --- /dev/null +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/ClasspathAlignmentCheckingLauncherInterceptor.java @@ -0,0 +1,40 @@ +/* + * Copyright 2015-2025 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.launcher.core; + +import java.util.Optional; + +import org.junit.platform.commons.JUnitException; +import org.junit.platform.launcher.LauncherInterceptor; + +class ClasspathAlignmentCheckingLauncherInterceptor implements LauncherInterceptor { + + static final LauncherInterceptor INSTANCE = new ClasspathAlignmentCheckingLauncherInterceptor(); + + @Override + public T intercept(Invocation invocation) { + try { + return invocation.proceed(); + } + catch (LinkageError e) { + Optional exception = ClasspathAlignmentChecker.check(e); + if (exception.isPresent()) { + throw exception.get(); + } + throw e; + } + } + + @Override + public void close() { + // do nothing + } +} diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineDiscoveryOrchestrator.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineDiscoveryOrchestrator.java index 862d7bb28ddf..09c895a69684 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineDiscoveryOrchestrator.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineDiscoveryOrchestrator.java @@ -156,8 +156,14 @@ private TestDescriptor discoverEngineRoot(TestEngine testEngine, LauncherDiscove } catch (Throwable throwable) { UnrecoverableExceptions.rethrowIfUnrecoverable(throwable); - String message = String.format("TestEngine with ID '%s' failed to discover tests", testEngine.getId()); - JUnitException cause = new JUnitException(message, throwable); + JUnitException cause = null; + if (throwable instanceof LinkageError) { + cause = ClasspathAlignmentChecker.check((LinkageError) throwable).orElse(null); + } + if (cause == null) { + String message = String.format("TestEngine with ID '%s' failed to discover tests", testEngine.getId()); + cause = new JUnitException(message, throwable); + } listener.engineDiscoveryFinished(uniqueEngineId, EngineDiscoveryResult.failed(cause)); return new EngineDiscoveryErrorDescriptor(uniqueEngineId, testEngine, cause); } diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineExecutionOrchestrator.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineExecutionOrchestrator.java index 90fa40d97dc8..c726d87eea01 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineExecutionOrchestrator.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineExecutionOrchestrator.java @@ -200,8 +200,15 @@ private void execute(TestDescriptor engineDescriptor, EngineExecutionListener li } catch (Throwable throwable) { UnrecoverableExceptions.rethrowIfUnrecoverable(throwable); - delayingListener.reportEngineFailure(new JUnitException( - String.format("TestEngine with ID '%s' failed to execute tests", testEngine.getId()), throwable)); + JUnitException cause = null; + if (throwable instanceof LinkageError) { + cause = ClasspathAlignmentChecker.check((LinkageError) throwable).orElse(null); + } + if (cause == null) { + String message = String.format("TestEngine with ID '%s' failed to execute tests", testEngine.getId()); + cause = new JUnitException(message, throwable); + } + delayingListener.reportEngineFailure(cause); } } } diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherFactory.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherFactory.java index d0dfae7c8a7d..c756f27351f0 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherFactory.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/LauncherFactory.java @@ -10,7 +10,6 @@ package org.junit.platform.launcher.core; -import static java.util.Collections.emptyList; import static org.apiguardian.api.API.Status.STABLE; import static org.junit.platform.launcher.LauncherConstants.DEACTIVATE_LISTENERS_PATTERN_PROPERTY_NAME; import static org.junit.platform.launcher.LauncherConstants.ENABLE_LAUNCHER_INTERCEPTORS; @@ -145,12 +144,12 @@ private static DefaultLauncher createDefaultLauncher(LauncherConfig config, private static List collectLauncherInterceptors( LauncherConfigurationParameters configurationParameters) { + List interceptors = new ArrayList<>(); if (configurationParameters.getBoolean(ENABLE_LAUNCHER_INTERCEPTORS).orElse(false)) { - List interceptors = new ArrayList<>(); ServiceLoaderRegistry.load(LauncherInterceptor.class).forEach(interceptors::add); - return interceptors; } - return emptyList(); + interceptors.add(ClasspathAlignmentCheckingLauncherInterceptor.INSTANCE); + return interceptors; } private static Set collectTestEngines(LauncherConfig config) { diff --git a/platform-tests/platform-tests.gradle.kts b/platform-tests/platform-tests.gradle.kts index 2da1a0dbb08a..dd8508f495c4 100644 --- a/platform-tests/platform-tests.gradle.kts +++ b/platform-tests/platform-tests.gradle.kts @@ -47,6 +47,7 @@ dependencies { testImplementation(projects.junitJupiterEngine) testImplementation(testFixtures(projects.junitJupiterEngine)) testImplementation(libs.apiguardian) + testImplementation(libs.classgraph) testImplementation(libs.jfrunit) { exclude(group = "org.junit.vintage") } @@ -63,7 +64,11 @@ dependencies { } // --- Test run-time dependencies --------------------------------------------- - testRuntimeOnly(projects.junitVintageEngine) + val mavenizedProjects: List by rootProject + mavenizedProjects.filter { it.path != projects.junitPlatformConsoleStandalone.path }.forEach { + // Add all projects to the classpath for tests using classpath scanning + testRuntimeOnly(it) + } testRuntimeOnly(libs.groovy4) { because("`ReflectionUtilsTests.findNestedClassesWithInvalidNestedClassFile` needs it") } diff --git a/platform-tests/src/test/java/org/junit/platform/launcher/core/ClasspathAlignmentCheckerTests.java b/platform-tests/src/test/java/org/junit/platform/launcher/core/ClasspathAlignmentCheckerTests.java new file mode 100644 index 000000000000..c15ad7aa543f --- /dev/null +++ b/platform-tests/src/test/java/org/junit/platform/launcher/core/ClasspathAlignmentCheckerTests.java @@ -0,0 +1,85 @@ +/* + * Copyright 2015-2025 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.platform.launcher.core; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.platform.launcher.core.ClasspathAlignmentChecker.WELL_KNOWN_PACKAGES; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.nio.file.Path; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Function; +import java.util.regex.Pattern; + +import io.github.classgraph.ClassGraph; +import io.github.classgraph.PackageInfo; + +import org.junit.jupiter.api.Test; + +class ClasspathAlignmentCheckerTests { + + @Test + void classpathIsAligned() { + assertThat(ClasspathAlignmentChecker.check(new LinkageError())).isEmpty(); + } + + @Test + void wrapsLinkageErrorForUnalignedClasspath() { + var cause = new LinkageError(); + AtomicInteger counter = new AtomicInteger(); + Function packageLookup = name -> { + var pkg = mock(Package.class); + when(pkg.getName()).thenReturn(name); + when(pkg.getImplementationVersion()).thenReturn(counter.incrementAndGet() + ".0.0"); + return pkg; + }; + + var result = ClasspathAlignmentChecker.check(cause, packageLookup); + + assertThat(result).isPresent(); + assertThat(result.get()) // + .hasMessageStartingWith("The wrapped LinkageError is likely caused by the versions of " + + "JUnit jars on the classpath/module path not being properly aligned.") // + .hasMessageContaining("Please ensure consistent versions are used") // + .hasMessageFindingMatch("https://junit\\.org/junit5/docs/.*/user-guide/#dependency-metadata") // + .hasMessageContaining("The following conflicting versions were detected:") // + .hasMessageContaining("- org.junit.jupiter.api: 1.0.0") // + .hasMessageContaining("- org.junit.jupiter.engine: 2.0.0") // + .cause().isSameAs(cause); + } + + @Test + void allRootPackagesAreChecked() { + var allowedFileNames = Pattern.compile("junit-(?:platform|jupiter|vintage)-.+[\\d.]+(?:-SNAPSHOT)?\\.jar"); + var classGraph = new ClassGraph() // + .acceptPackages("org.junit.platform", "org.junit.jupiter", "org.junit.vintage") // + .rejectPackages("org.junit.platform.reporting.shadow", "org.junit.jupiter.params.shadow") // + .filterClasspathElements(e -> { + var path = Path.of(e); + var fileName = path.getFileName().toString(); + return allowedFileNames.matcher(fileName).matches(); + }); + + try (var scanResult = classGraph.scan()) { + var foundPackages = scanResult.getPackageInfo().stream() // + .filter(it -> !it.getClassInfo().isEmpty()) // + .map(PackageInfo::getName) // + .sorted() // + .toList(); + + assertThat(foundPackages) // + .allMatch(name -> WELL_KNOWN_PACKAGES.stream().anyMatch(name::startsWith)); + assertThat(WELL_KNOWN_PACKAGES) // + .allMatch(name -> foundPackages.stream().anyMatch(it -> it.startsWith(name))); + } + } +} diff --git a/platform-tooling-support-tests/projects/maven-starter/pom.xml b/platform-tooling-support-tests/projects/maven-starter/pom.xml index 4f1552a66cab..c03e69a3277c 100644 --- a/platform-tooling-support-tests/projects/maven-starter/pom.xml +++ b/platform-tooling-support-tests/projects/maven-starter/pom.xml @@ -11,9 +11,16 @@ UTF-8 1.8 ${maven.compiler.source} + ${junit.platform.version} + + org.junit.platform + junit-platform-commons + ${junit.platform.commons.version} + test + org.junit.jupiter junit-jupiter diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java index 8cbe4e3ea29b..4a7cce72c99e 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java @@ -21,6 +21,7 @@ import java.util.Map; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.JRE; import org.junit.jupiter.api.io.TempDir; import org.junit.platform.tests.process.OutputFiles; @@ -50,7 +51,7 @@ void java_8(@FilePrefix("maven") OutputFiles outputFiles) throws Exception { @Test void java_default(@FilePrefix("maven") OutputFiles outputFiles) throws Exception { - var actualLines = execute(currentJdkHome(), outputFiles, MavenEnvVars.FOR_JDK24_AND_LATER); + var actualLines = execute(currentJdkHome(), outputFiles, MavenEnvVars.forJre(JRE.currentVersion())); assertTrue(actualLines.contains("[WARNING] Tests run: 2, Failures: 0, Errors: 0, Skipped: 1")); } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenEnvVars.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenEnvVars.java index f502c6120acd..115ea298e815 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenEnvVars.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenEnvVars.java @@ -16,14 +16,15 @@ final class MavenEnvVars { - static final Map FOR_JDK24_AND_LATER = JRE.currentVersion().compareTo(JRE.JAVA_24) >= 0 // - ? Map.of("MAVEN_OPTS", String.join(" ", // - "--enable-native-access=ALL-UNNAMED", // https://issues.apache.org/jira/browse/MNG-8248 - "--sun-misc-unsafe-memory-access=allow" // https://issues.apache.org/jira/browse/MNG-8399 - )) // - : Map.of(); + private static final Map FOR_JDK24_AND_LATER = Map.of("MAVEN_OPTS", String.join(" ", // + "--enable-native-access=ALL-UNNAMED", // https://issues.apache.org/jira/browse/MNG-8248 + "--sun-misc-unsafe-memory-access=allow" // https://issues.apache.org/jira/browse/MNG-8399 + )); - private MavenEnvVars() { + static Map forJre(JRE jre) { + return jre.compareTo(JRE.JAVA_24) >= 0 ? FOR_JDK24_AND_LATER : Map.of(); } + private MavenEnvVars() { + } } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java index 27f3c2a762b9..c07954ac5c5e 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java @@ -21,6 +21,7 @@ import java.util.List; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.JRE; import org.junit.jupiter.api.io.TempDir; import org.junit.platform.tests.process.OutputFiles; @@ -76,7 +77,7 @@ void checkDefault(@TempDir Path workspace, @FilePrefix("maven") OutputFiles outp .addArguments("-Dsnapshot.repo.url=" + mavenRepoProxy.getBaseUri()) // .addArguments("--update-snapshots", "--show-version", "--errors", "--batch-mode") // .addArguments("test") // - .putEnvironment(MavenEnvVars.FOR_JDK24_AND_LATER) // + .putEnvironment(MavenEnvVars.forJre(JRE.currentVersion())) // .redirectOutput(outputFiles) // .startAndWait(); diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/UnalignedClasspathTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/UnalignedClasspathTests.java new file mode 100644 index 000000000000..a6467c511564 --- /dev/null +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/UnalignedClasspathTests.java @@ -0,0 +1,75 @@ +/* + * Copyright 2015-2025 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package platform.tooling.support.tests; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.parallel.ExecutionMode.SAME_THREAD; +import static platform.tooling.support.ProcessStarters.currentJdkHome; +import static platform.tooling.support.tests.Projects.copyToWorkspace; + +import java.nio.file.Path; +import java.util.stream.Stream; + +import org.junit.jupiter.api.condition.JRE; +import org.junit.jupiter.api.io.TempDir; +import org.junit.jupiter.api.parallel.Execution; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.junit.platform.tests.process.OutputFiles; + +import platform.tooling.support.Helper; +import platform.tooling.support.MavenRepo; +import platform.tooling.support.ProcessStarters; + +/** + * @since 1.3 + */ +class UnalignedClasspathTests { + + @GlobalResource + LocalMavenRepo localMavenRepo; + + @GlobalResource + MavenRepoProxy mavenRepoProxy; + + @ParameterizedTest + @MethodSource("javaVersions") + @Execution(SAME_THREAD) + void verifyErrorMessageForUnalignedClasspath(JRE jre, Path javaHome, @TempDir Path workspace, + @FilePrefix("maven") OutputFiles outputFiles) throws Exception { + var starter = ProcessStarters.maven(javaHome) // + .workingDir(copyToWorkspace(Projects.MAVEN_STARTER, workspace)) // + .addArguments(localMavenRepo.toCliArgument(), "-Dmaven.repo=" + MavenRepo.dir()) // + .addArguments("-Dsnapshot.repo.url=" + mavenRepoProxy.getBaseUri()) // + .addArguments("-Djunit.platform.commons.version=1.11.4").addArguments("--update-snapshots", + "--batch-mode", "verify") // + .putEnvironment(MavenEnvVars.forJre(jre)) // + .redirectOutput(outputFiles); + var result = starter.startAndWait(); + + assertEquals(1, result.exitCode()); + assertEquals("", result.stdErr()); + assertTrue(result.stdOutLines().contains("[INFO] BUILD FAILURE")); + assertThat(result.stdOut()) // + .contains("The wrapped NoClassDefFoundError is likely caused by the versions of JUnit jars " + + "on the classpath/module path not being properly aligned"); + } + + static Stream javaVersions() { + return Stream.concat( // + Helper.getJavaHome("8").map(path -> Arguments.of(JRE.JAVA_8, path)).stream(), // + Stream.of(Arguments.of(JRE.currentVersion(), currentJdkHome())) // + ); + } +} From f07e3ffb5967f54392ba3b72e72f489dfd4acead Mon Sep 17 00:00:00 2001 From: Yongjun Hong Date: Thu, 16 Jan 2025 19:09:25 +0900 Subject: [PATCH 487/611] Document that `AnnotationSupport.isAnnotated()` does not find repeatable annotations (#4243) Resolves #4058. --------- Co-authored-by: Sam Brannen <104798+sbrannen@users.noreply.github.com> --- .../src/docs/asciidoc/user-guide/extensions.adoc | 3 +++ .../jupiter/api/extension/AnnotatedElementContext.java | 4 ++++ .../platform/commons/support/AnnotationSupport.java | 10 ++++++++++ 3 files changed, 17 insertions(+) diff --git a/documentation/src/docs/asciidoc/user-guide/extensions.adoc b/documentation/src/docs/asciidoc/user-guide/extensions.adoc index 7ccbf96c4df2..11185fe05019 100644 --- a/documentation/src/docs/asciidoc/user-guide/extensions.adoc +++ b/documentation/src/docs/asciidoc/user-guide/extensions.adoc @@ -871,6 +871,9 @@ and fields in a class or interface. Some of these methods search on implemented interfaces and within class hierarchies to find annotations. Consult the Javadoc for `{AnnotationSupport}` for further details. +NOTE: The `isAnnotated()` methods do not find repeatable annotations. To check for repeatable annotations, +use one of the `findRepeatableAnnotations()` methods and verify that the returned list is not empty. + NOTE: See also: <> [[extensions-supported-utilities-classes]] diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/AnnotatedElementContext.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/AnnotatedElementContext.java index 0c12f33c1765..19ad328fb7a4 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/AnnotatedElementContext.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/AnnotatedElementContext.java @@ -55,6 +55,10 @@ public interface AnnotatedElementContext { * present or meta-present on the {@link AnnotatedElement} for * this context. * + *

    Note: This method does not find repeatable annotations. + * To check for repeatable annotations, use {@link #findRepeatableAnnotations(Class)} + * and verify that the returned list is not empty. + * *

    WARNING

    *

    Favor the use of this method over directly invoking * {@link AnnotatedElement#isAnnotationPresent(Class)} due to a bug in {@code javac} diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/AnnotationSupport.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/AnnotationSupport.java index 2ef21ac9d0c3..3066916f3503 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/AnnotationSupport.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/AnnotationSupport.java @@ -54,6 +54,10 @@ private AnnotationSupport() { * present or meta-present on the supplied optional * {@code element}. * + *

    Note: This method does not find repeatable annotations. + * To check for repeatable annotations, use {@link #findRepeatableAnnotations(Optional, Class)} + * and verify that the returned list is not empty. + * * @param element an {@link Optional} containing the element on which to * search for the annotation; may be {@code null} or empty * @param annotationType the annotation type to search for; never {@code null} @@ -61,6 +65,7 @@ private AnnotationSupport() { * @since 1.3 * @see #isAnnotated(AnnotatedElement, Class) * @see #findAnnotation(Optional, Class) + * @see #findRepeatableAnnotations(Optional, Class) */ @API(status = MAINTAINED, since = "1.3") public static boolean isAnnotated(Optional element, @@ -74,12 +79,17 @@ public static boolean isAnnotated(Optional element, * present or meta-present on the supplied * {@code element}. * + *

    Note: This method does not find repeatable annotations. + * To check for repeatable annotations, use {@link #findRepeatableAnnotations(AnnotatedElement, Class)} + * and verify that the returned list is not empty. + * * @param element the element on which to search for the annotation; may be * {@code null} * @param annotationType the annotation type to search for; never {@code null} * @return {@code true} if the annotation is present or meta-present * @see #isAnnotated(Optional, Class) * @see #findAnnotation(AnnotatedElement, Class) + * @see #findRepeatableAnnotations(AnnotatedElement, Class) */ public static boolean isAnnotated(AnnotatedElement element, Class annotationType) { return AnnotationUtils.isAnnotated(element, annotationType); From 4130009a1672877a03b13679847731ab315699ec Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 17 Jan 2025 01:40:59 +0000 Subject: [PATCH 488/611] Update graalvm/setup-graalvm digest to c09e29b (#4247) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c68ca19203a9..84861342054a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,7 @@ jobs: with: fetch-depth: 1 - name: Install GraalVM - uses: graalvm/setup-graalvm@4a200f28cd70d1940b5e33bd00830b7dc71a7e2b # v1 + uses: graalvm/setup-graalvm@c09e29bb115a83bd4b7c7e99bb46e2e8a1c50466 # v1 with: distribution: graalvm-community version: 'latest' From f3536d335bee202e4f05383786d2223074482ede Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 18 Jan 2025 13:11:33 +0000 Subject: [PATCH 489/611] Update dependency org.assertj:assertj-core to v3.27.3 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9ab8ce3c6a7f..4f3aea0ac55d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,7 +3,7 @@ ant = "1.10.15" apiguardian = "1.1.2" asciidoctorj-pdf = "2.3.19" asciidoctor-plugins = "4.0.4" # Check if workaround in documentation.gradle.kts can be removed when upgrading -assertj = "3.27.2" +assertj = "3.27.3" bnd = "7.1.0" checkstyle = "10.21.1" eclipse = "4.34.0" From 72d668a7e42d3770e2f7cdbb450baaeb69d2bb5e Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sat, 18 Jan 2025 17:46:36 +0100 Subject: [PATCH 490/611] Make OutputDirectoryProvider available via ExecutionRequest --- .../platform/engine/ExecutionRequest.java | 81 ++++++++++++++++--- .../core/EngineExecutionOrchestrator.java | 10 ++- .../testkit/engine/EngineTestKit.java | 2 +- .../junit-vintage-engine.gradle.kts | 1 + .../VintageTestEngineExecutionTests.java | 5 +- .../HierarchicalTestExecutorTests.java | 5 +- 6 files changed, 84 insertions(+), 20 deletions(-) diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/ExecutionRequest.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/ExecutionRequest.java index affe5464a184..3d320a0d1c74 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/ExecutionRequest.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/ExecutionRequest.java @@ -10,19 +10,25 @@ package org.junit.platform.engine; +import static org.apiguardian.api.API.Status.DEPRECATED; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.INTERNAL; import static org.apiguardian.api.API.Status.STABLE; import org.apiguardian.api.API; +import org.junit.platform.commons.PreconditionViolationException; +import org.junit.platform.commons.util.Preconditions; +import org.junit.platform.engine.reporting.OutputDirectoryProvider; /** * Provides a single {@link TestEngine} access to the information necessary to * execute its tests. * *

    A request contains an engine's root {@link TestDescriptor}, the - * {@link EngineExecutionListener} to be notified of test execution events, and + * {@link EngineExecutionListener} to be notified of test execution events, the * {@link ConfigurationParameters} that the engine may use to influence test - * execution. + * execution, and an {@link OutputDirectoryProvider} for writing reports and + * other output files. * * @since 1.0 * @see TestEngine @@ -33,13 +39,23 @@ public class ExecutionRequest { private final TestDescriptor rootTestDescriptor; private final EngineExecutionListener engineExecutionListener; private final ConfigurationParameters configurationParameters; + private final OutputDirectoryProvider outputDirectoryProvider; - @API(status = INTERNAL, since = "1.0") + @Deprecated + @API(status = DEPRECATED, since = "1.11") public ExecutionRequest(TestDescriptor rootTestDescriptor, EngineExecutionListener engineExecutionListener, ConfigurationParameters configurationParameters) { - this.rootTestDescriptor = rootTestDescriptor; - this.engineExecutionListener = engineExecutionListener; - this.configurationParameters = configurationParameters; + this(rootTestDescriptor, engineExecutionListener, configurationParameters, null); + } + + private ExecutionRequest(TestDescriptor rootTestDescriptor, EngineExecutionListener engineExecutionListener, + ConfigurationParameters configurationParameters, OutputDirectoryProvider outputDirectoryProvider) { + this.rootTestDescriptor = Preconditions.notNull(rootTestDescriptor, "rootTestDescriptor must not be null"); + this.engineExecutionListener = Preconditions.notNull(engineExecutionListener, + "engineExecutionListener must not be null"); + this.configurationParameters = Preconditions.notNull(configurationParameters, + "configurationParameters must not be null"); + this.outputDirectoryProvider = outputDirectoryProvider; } /** @@ -52,16 +68,41 @@ public ExecutionRequest(TestDescriptor rootTestDescriptor, EngineExecutionListen * engine may use to influence test execution * @return a new {@code ExecutionRequest}; never {@code null} * @since 1.9 + * @deprecated Use {@link #create(TestDescriptor, EngineExecutionListener, ConfigurationParameters, OutputDirectoryProvider)} */ - @API(status = STABLE, since = "1.9") + @Deprecated + @API(status = DEPRECATED, since = "1.11") public static ExecutionRequest create(TestDescriptor rootTestDescriptor, EngineExecutionListener engineExecutionListener, ConfigurationParameters configurationParameters) { return new ExecutionRequest(rootTestDescriptor, engineExecutionListener, configurationParameters); } /** - * Get the root {@link TestDescriptor} of the engine that processes this - * request. + * Factory for creating an execution request. + * + * @param rootTestDescriptor the engine's root {@link TestDescriptor}; never + * {@code null} + * @param engineExecutionListener the {@link EngineExecutionListener} to be + * notified of test execution events; never {@code null} + * @param configurationParameters {@link ConfigurationParameters} that the + * engine may use to influence test execution; never {@code null} + * @param outputDirectoryProvider {@link OutputDirectoryProvider} for + * writing reports and other output files; never {@code null} + * @return a new {@code ExecutionRequest}; never {@code null} + * @since 1.12 + */ + @API(status = INTERNAL, since = "1.12") + public static ExecutionRequest create(TestDescriptor rootTestDescriptor, + EngineExecutionListener engineExecutionListener, ConfigurationParameters configurationParameters, + OutputDirectoryProvider outputDirectoryProvider) { + + return new ExecutionRequest(rootTestDescriptor, engineExecutionListener, configurationParameters, + Preconditions.notNull(outputDirectoryProvider, "outputDirectoryProvider must not be null")); + } + + /** + * {@return the root {@link TestDescriptor} of the engine that processes this + * request} * *

    Note: the root descriptor is the * {@code TestDescriptor} returned by @@ -72,19 +113,33 @@ public TestDescriptor getRootTestDescriptor() { } /** - * Get the {@link EngineExecutionListener} to be notified of test execution - * events. + * {@return the {@link EngineExecutionListener} to be notified of test execution + * events} */ public EngineExecutionListener getEngineExecutionListener() { return this.engineExecutionListener; } /** - * Get the {@link ConfigurationParameters} that the engine may use to - * influence test execution. + * {@return the {@link ConfigurationParameters} that the engine may use to + * influence test execution} */ public ConfigurationParameters getConfigurationParameters() { return this.configurationParameters; } + /** + * {@return the {@link OutputDirectoryProvider} for this request for writing + * reports and other output files} + * + * @throws PreconditionViolationException if the output directory provider + * is not available + * @since 1.12 + */ + @API(status = EXPERIMENTAL, since = "1.12") + public OutputDirectoryProvider getOutputDirectoryProvider() { + return Preconditions.notNull(outputDirectoryProvider, + "No OutputDirectoryProvider was configured for this request"); + } + } diff --git a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineExecutionOrchestrator.java b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineExecutionOrchestrator.java index c726d87eea01..aedf22950cc1 100644 --- a/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineExecutionOrchestrator.java +++ b/junit-platform-launcher/src/main/java/org/junit/platform/launcher/core/EngineExecutionOrchestrator.java @@ -28,6 +28,7 @@ import org.junit.platform.engine.TestDescriptor; import org.junit.platform.engine.TestEngine; import org.junit.platform.engine.TestExecutionResult; +import org.junit.platform.engine.reporting.OutputDirectoryProvider; import org.junit.platform.launcher.TestExecutionListener; import org.junit.platform.launcher.TestIdentifier; import org.junit.platform.launcher.TestPlan; @@ -166,7 +167,8 @@ public void execute(LauncherDiscoveryResult discoveryResult, EngineExecutionList TestExecutionResult.failed(((EngineDiscoveryErrorDescriptor) engineDescriptor).getCause())); } else { - execute(engineDescriptor, listener, configurationParameters, testEngine); + execute(engineDescriptor, listener, configurationParameters, testEngine, + discoveryResult.getOutputDirectoryProvider()); } } } @@ -190,12 +192,14 @@ private ListenerRegistry buildListenerRegistryForExecutio } private void execute(TestDescriptor engineDescriptor, EngineExecutionListener listener, - ConfigurationParameters configurationParameters, TestEngine testEngine) { + ConfigurationParameters configurationParameters, TestEngine testEngine, + OutputDirectoryProvider outputDirectoryProvider) { OutcomeDelayingEngineExecutionListener delayingListener = new OutcomeDelayingEngineExecutionListener(listener, engineDescriptor); try { - testEngine.execute(ExecutionRequest.create(engineDescriptor, delayingListener, configurationParameters)); + testEngine.execute(ExecutionRequest.create(engineDescriptor, delayingListener, configurationParameters, + outputDirectoryProvider)); delayingListener.reportEngineOutcome(); } catch (Throwable throwable) { diff --git a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EngineTestKit.java b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EngineTestKit.java index 7e5e6fae3f5e..ba8b7caf0d32 100644 --- a/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EngineTestKit.java +++ b/junit-platform-testkit/src/main/java/org/junit/platform/testkit/engine/EngineTestKit.java @@ -254,7 +254,7 @@ private static void executeDirectly(TestEngine testEngine, EngineDiscoveryReques UniqueId engineUniqueId = UniqueId.forEngine(testEngine.getId()); TestDescriptor engineTestDescriptor = testEngine.discover(discoveryRequest, engineUniqueId); ExecutionRequest request = ExecutionRequest.create(engineTestDescriptor, listener, - discoveryRequest.getConfigurationParameters()); + discoveryRequest.getConfigurationParameters(), discoveryRequest.getOutputDirectoryProvider()); testEngine.execute(request); } diff --git a/junit-vintage-engine/junit-vintage-engine.gradle.kts b/junit-vintage-engine/junit-vintage-engine.gradle.kts index d2b22d6b711f..3d1231829fac 100644 --- a/junit-vintage-engine/junit-vintage-engine.gradle.kts +++ b/junit-vintage-engine/junit-vintage-engine.gradle.kts @@ -24,6 +24,7 @@ dependencies { testImplementation(projects.junitPlatformSuiteEngine) testImplementation(projects.junitPlatformTestkit) testImplementation(testFixtures(projects.junitJupiterApi)) + testImplementation(testFixtures(projects.junitPlatformLauncher)) testImplementation(testFixtures(projects.junitPlatformReporting)) osgiVerification(projects.junitPlatformLauncher) diff --git a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineExecutionTests.java b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineExecutionTests.java index d73a8809c6a9..4d47f228f241 100644 --- a/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineExecutionTests.java +++ b/junit-vintage-engine/src/test/java/org/junit/vintage/engine/VintageTestEngineExecutionTests.java @@ -16,6 +16,7 @@ import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectMethod; import static org.junit.platform.engine.discovery.DiscoverySelectors.selectUniqueId; +import static org.junit.platform.launcher.core.OutputDirectoryProviders.dummyOutputDirectoryProvider; import static org.junit.platform.testkit.engine.EventConditions.abortedWithReason; import static org.junit.platform.testkit.engine.EventConditions.container; import static org.junit.platform.testkit.engine.EventConditions.displayName; @@ -923,8 +924,8 @@ private static void execute(Class testClass, EngineExecutionListener listener TestEngine testEngine = new VintageTestEngine(); var discoveryRequest = request(testClass); var engineTestDescriptor = testEngine.discover(discoveryRequest, UniqueId.forEngine(testEngine.getId())); - testEngine.execute( - ExecutionRequest.create(engineTestDescriptor, listener, discoveryRequest.getConfigurationParameters())); + testEngine.execute(ExecutionRequest.create(engineTestDescriptor, listener, + discoveryRequest.getConfigurationParameters(), dummyOutputDirectoryProvider())); } private static LauncherDiscoveryRequest request(Class testClass) { diff --git a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestExecutorTests.java b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestExecutorTests.java index 1b520dc5f30f..09c83e273e60 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestExecutorTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/support/hierarchical/HierarchicalTestExecutorTests.java @@ -18,6 +18,7 @@ import static org.junit.platform.engine.TestExecutionResult.Status.FAILED; import static org.junit.platform.engine.TestExecutionResult.Status.SUCCESSFUL; import static org.junit.platform.engine.TestExecutionResult.successful; +import static org.junit.platform.launcher.core.OutputDirectoryProviders.dummyOutputDirectoryProvider; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doThrow; @@ -37,6 +38,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.function.ThrowingConsumer; +import org.junit.platform.engine.ConfigurationParameters; import org.junit.platform.engine.EngineExecutionListener; import org.junit.platform.engine.ExecutionRequest; import org.junit.platform.engine.TestDescriptor; @@ -77,7 +79,8 @@ void init() { private HierarchicalTestExecutor createExecutor( HierarchicalTestExecutorService executorService) { - var request = ExecutionRequest.create(root, listener, null); + var request = ExecutionRequest.create(root, listener, mock(ConfigurationParameters.class), + dummyOutputDirectoryProvider()); return new HierarchicalTestExecutor<>(request, rootContext, executorService, OpenTest4JAwareThrowableCollector::new); } From 4fa576f7311d98043f67c4592693780292b96981 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Sun, 19 Jan 2025 16:56:25 +0100 Subject: [PATCH 491/611] Remove logging to SYS_ERR in test --- .../org/junit/platform/commons/util/ReflectionUtilsTests.java | 1 - 1 file changed, 1 deletion(-) diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java index b001ee14bd76..2a2256ddcfc1 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java @@ -1596,7 +1596,6 @@ void findMethodsWithoutStaticHidingUsingHierarchyDownMode() throws Exception { var methods = findMethods(child, method -> true, TOP_DOWN); assertEquals(9, methods.size()); - methods.forEach(System.err::println); assertThat(methods.subList(0, 2)).containsOnly(ifcMethod1, ifcMethod2); assertThat(methods.subList(2, 6)).containsOnly(parentMethod1, parentMethod2, parentMethod4, parentMethod5); assertThat(methods.subList(6, 9)).containsOnly(childMethod1, childMethod4, childMethod5); From 57e20cd46e6ca9e5387fef860e6cdb0d3b3ec675 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Sun, 19 Jan 2025 17:42:05 +0100 Subject: [PATCH 492/611] Revise Javadoc and release notes regarding void lookups See #4048 --- .../release-notes/release-notes-5.12.0-M1.adoc | 6 ++++-- .../platform/commons/util/ReflectionUtils.java | 17 +++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 5c15b26ba6fa..eb7d9240fb50 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -42,8 +42,10 @@ JUnit repository on GitHub. `addClassContainerSelectorResolver()`. * Introduce `ReflectionSupport.makeAccessible(Field)` for third-party use rather than calling the internal `ReflectionUtils.makeAccessible(Field)` method directly. -* Support both the primitive type `void` and the wrapper type `Void` in the internal - `ReflectionUtils` to allow `String` to `Class` conversion in parameterized tests. +* The `ReflectionSupport.tryToLoadClass(...)` utility methods now support lookups for the + `"void"` pseudo-type, which indirectly supports `String` to `Class` conversion for + `"void"` in parameterized tests in JUnit Jupiter. +* `ReflectionUtils` now treats `Void` as a _wrapper_ type for the `void` pseudo-type. * New `--exclude-methodname` and `--include-methodname` options added to the `ConsoleLauncher` to include or exclude methods based on fully qualified method names without parameters. For example, `--exclude-methodname=^org\.example\..+#methodname` diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java index 53dc2fbc213d..7b4a70d3ae27 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java @@ -418,9 +418,9 @@ public static boolean isMultidimensionalArray(Object obj) { * supplied target type for the purpose of reflective method invocations. * *

    In contrast to {@link Class#isAssignableFrom(Class)}, this method - * returns {@code true} if the target type represents a primitive type whose - * wrapper matches the supplied source type. In addition, this method - * also supports + * returns {@code true} if the target type represents a primitive type (or + * {@code void}) whose wrapper matches the supplied source type. In addition, + * this method also supports * * widening conversions for primitive target types. * @@ -454,8 +454,8 @@ public static boolean isAssignableTo(Class sourceType, Class targetType) { * type for the purpose of reflective method invocations. * *

    In contrast to {@link Class#isInstance(Object)}, this method returns - * {@code true} if the target type represents a primitive type whose - * wrapper matches the supplied object's type. In addition, this method + * {@code true} if the target type represents a primitive type (or {@code void}) + * whose wrapper matches the supplied object's type. In addition, this method * also supports * * widening conversions for primitive types and their corresponding @@ -550,11 +550,12 @@ static boolean isWideningConversion(Class sourceType, Class targetType) { } /** - * Get the wrapper type for the supplied primitive type. + * Get the wrapper type for the supplied primitive type (or {@code void}). * - * @param type the primitive type for which to retrieve the wrapper type + * @param type the primitive type (or {@code void}) for which to retrieve the + * wrapper type * @return the corresponding wrapper type or {@code null} if the - * supplied type is {@code null} or not a primitive type + * supplied type is {@code null} or not a primitive type or {@code void} */ public static Class getWrapperType(Class type) { return primitiveToWrapperMap.get(type); From 30cbe62814d46251e36c0fa6dfc762728dac42f1 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Sun, 19 Jan 2025 17:44:11 +0100 Subject: [PATCH 493/611] Move Kotlin contracts release note to correct section --- .../docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index eb7d9240fb50..6900df74ec8b 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -71,7 +71,6 @@ JUnit repository on GitHub. in the XML report. * Output written to `System.out` and `System.err` from non-test threads is now attributed to the most recent test or container that was started or has written output. -* Introduced contracts for Kotlin-specific assertion methods. * New public interface `ClasspathScanner` allowing third parties to provide a custom implementation for scanning the classpath for classes and resources. @@ -102,6 +101,7 @@ JUnit repository on GitHub. [[release-notes-5.12.0-M1-junit-jupiter-new-features-and-improvements]] ==== New Features and Improvements +* Introduced contracts for Kotlin-specific assertion methods. * In a `@ParameterizedTest` method, a `null` value can now be supplied for Java Date/Time types such as `LocalDate` if the new `nullable` attribute in `@JavaTimeConversionPattern` is set to `true`. From 254ca623d60534be222e404ccaccd621ac3fa14a Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Sun, 19 Jan 2025 18:37:02 +0100 Subject: [PATCH 494/611] =?UTF-8?q?Revise=20recent=20changes=20to=20@?= =?UTF-8?q?=E2=81=A0ResourceLock=20and=20related=20APIs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jupiter/api/parallel/ResourceLock.java | 78 +++++++-------- .../api/parallel/ResourceLockTarget.java | 20 ++-- .../api/parallel/ResourceLocksProvider.java | 97 +++++++++---------- 3 files changed, 89 insertions(+), 106 deletions(-) diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLock.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLock.java index e2d3af554630..24c85cb268c8 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLock.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLock.java @@ -21,16 +21,14 @@ import java.lang.annotation.Target; import org.apiguardian.api.API; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; /** * {@code @ResourceLock} is used to declare that the annotated test class or test * method requires access to a shared resource identified by a key. * - *

    The resource key is specified via {@link #value}. In addition, - * {@link #mode} allows you to specify whether the annotated test class or test - * method requires {@link ResourceAccessMode#READ_WRITE READ_WRITE} or only + *

    The resource key is specified via {@link #value}. In addition, {@link #mode} + * allows one to specify whether the annotated test class or test method requires + * {@link ResourceAccessMode#READ_WRITE READ_WRITE} or * {@link ResourceAccessMode#READ READ} access to the resource. In the former case, * execution of the annotated element will occur while no other test class or * test method that uses the shared resource is being executed. In the latter case, @@ -39,46 +37,38 @@ * other test that requires {@code READ_WRITE} access. * *

    This guarantee extends to lifecycle methods of a test class or method. For - * example, if a test method is annotated with a {@code @ResourceLock} - * annotation the "lock" will be acquired before any - * {@link BeforeEach @BeforeEach} methods are executed and released after all - * {@link AfterEach @AfterEach} methods have been executed. + * example, if a test method is annotated with {@code @ResourceLock} the lock + * will be acquired before any {@link org.junit.jupiter.api.BeforeEach @BeforeEach} + * methods are executed and released after all + * {@link org.junit.jupiter.api.AfterEach @AfterEach} methods have been executed. * *

    This annotation can be repeated to declare the use of multiple shared resources. * - *

    Uniqueness of a shared resource is identified by both {@link #value()} and - * {@link #mode()}. Duplicated shared resources do not cause errors. + *

    Uniqueness of a shared resource is determined by both the {@link #value()} + * and the {@link #mode()}. Duplicated shared resources do not cause errors. * *

    Since JUnit Jupiter 5.4, this annotation is {@linkplain Inherited inherited} * within class hierarchies. * *

    Since JUnit Jupiter 5.12, this annotation supports adding shared resources - * dynamically at runtime via {@link #providers}. - * - *

    Resources declared "statically" using {@link #value()} and {@link #mode()} - * are combined with "dynamic" resources added via {@link #providers()}. - * For example, declaring resource "A" via {@code @ResourceLock("A")} - * and resource "B" via a provider returning {@code new Lock("B")} will result - * in two shared resources "A" and "B". + * dynamically at runtime via {@link #providers}. Resources declared "statically" + * using {@link #value()} and {@link #mode()} are combined with "dynamic" resources + * added via {@link #providers()}. For example, declaring resource "A" via + * {@code @ResourceLock("A")} and resource "B" via a provider returning + * {@code new Lock("B")} will result in two shared resources "A" and "B". * *

    Since JUnit Jupiter 5.12, this annotation supports declaring "static" * shared resources for direct child nodes via the {@link #target()} - * attribute. - * - *

    Using the {@link ResourceLockTarget#CHILDREN} in a class-level - * annotation has the same semantics as adding an annotation with the same - * {@link #value()} and {@link #mode()} to each test method and nested test - * class declared in this class. - * - *

    This may improve parallelization when a test class declares a + * attribute. Using {@link ResourceLockTarget#CHILDREN} in a class-level annotation + * has the same semantics as adding an annotation with the same {@link #value()} + * and {@link #mode()} to each test method and nested test class declared in the + * annotated class. This may improve parallelization when a test class declares a * {@link ResourceAccessMode#READ READ} lock, but only a few methods hold - * {@link ResourceAccessMode#READ_WRITE READ_WRITE} lock. - * - *

    Note that the {@code target = CHILDREN} means that - * {@link #value()} and {@link #mode()} no longer apply to a node - * declaring the annotation. However, the {@link #providers()} attribute - * remains applicable, and the target of "dynamic" shared resources - * added via implementations of {@link ResourceLocksProvider} is not changed. + * {@link ResourceAccessMode#READ_WRITE READ_WRITE} lock. Note that + * {@code target = CHILDREN} means that {@link #value()} and {@link #mode()} no + * longer apply to a node declaring the annotation. However, the {@link #providers()} + * attribute remains applicable, and the target of "dynamic" shared resources added + * via implementations of {@link ResourceLocksProvider} is not changed. * * @see Isolated * @see Resources @@ -116,28 +106,28 @@ ResourceAccessMode mode() default ResourceAccessMode.READ_WRITE; /** - * The target of a resource created from {@link #value()} and {@link #mode()}. - * - *

    Defaults to {@link ResourceLockTarget#SELF SELF}. + * An array of one or more classes implementing {@link ResourceLocksProvider}. * - *

    Note that using {@link ResourceLockTarget#CHILDREN} in - * a method-level annotation results in an exception. + *

    Defaults to an empty array. * - * @see ResourceLockTarget + * @see ResourceLocksProvider.Lock * @since 5.12 */ @API(status = EXPERIMENTAL, since = "5.12") - ResourceLockTarget target() default ResourceLockTarget.SELF; + Class[] providers() default {}; /** - * An array of one or more classes implementing {@link ResourceLocksProvider}. + * The target of a resource created from {@link #value()} and {@link #mode()}. * - *

    Defaults to an empty array. + *

    Defaults to {@link ResourceLockTarget#SELF SELF}. * - * @see ResourceLocksProvider.Lock + *

    Note that using {@link ResourceLockTarget#CHILDREN} in a method-level + * annotation results in an exception. + * + * @see ResourceLockTarget * @since 5.12 */ @API(status = EXPERIMENTAL, since = "5.12") - Class[] providers() default {}; + ResourceLockTarget target() default ResourceLockTarget.SELF; } diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLockTarget.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLockTarget.java index 883869134d48..94a7a0bf7d68 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLockTarget.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLockTarget.java @@ -31,17 +31,17 @@ public enum ResourceLockTarget { /** * Add a shared resource to the direct children of the current node. * - *

    Examples of "parent - child" relationship in the context of - * {@link ResourceLockTarget}: + *

    Examples of "parent - child" relationships in the context of + * {@code ResourceLockTarget}: *

      - *
    • a test class - * - test methods and nested test classes declared in the class.
    • - *
    • a nested test class - * - test methods and nested test classes declared in the nested class. - *
    • - *
    • a test method - * - considered to have no children. Using {@code CHILDREN} for - * a test method results in an exception.
    • + *
    • test class: test methods and nested test classes + * declared in the test class are children of the test class.
    • + *
    • nested test class: test methods and nested test + * classes declared in the nested class are children of the nested test class. + *
    • + *
    • test method: test methods are not considered to have + * children. Using {@code CHILDREN} for a test method results in an + * exception.
    • *
    */ CHILDREN diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocksProvider.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocksProvider.java index 6e531c478d4f..be30638bb43d 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocksProvider.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocksProvider.java @@ -18,20 +18,18 @@ import java.util.Set; import org.apiguardian.api.API; -import org.junit.jupiter.api.Nested; import org.junit.platform.commons.util.Preconditions; import org.junit.platform.commons.util.ToStringBuilder; /** - * {@code @ResourceLocksProvider} is used to add shared resources - * to a test class and / or its test methods dynamically at runtime. + * A {@code ResourceLocksProvider} is used to programmatically add shared resources + * to a test class or its test methods dynamically at runtime. * *

    Each shared resource is represented by an instance of {@link Lock}. * - *

    Adding shared resources using this interface has the same semantics - * as declaring them via {@code @ResourceLock(value, mode)} annotation - * but for some cases may be a more flexible and less verbose alternative - * since it allows to add resources programmatically. + *

    Adding shared resources via this API has the same semantics as declaring + * them declaratively via {@link ResouceLock @ResourceLock(value, mode)}, but for + * some use cases the programmatic approach may be more flexible and less verbose. * *

    Implementations must provide a no-args constructor. * @@ -47,14 +45,14 @@ public interface ResourceLocksProvider { /** * Add shared resources to a test class. * - *

    Invoked in case a test class or its parent class - * is annotated with {@code @ResourceLock(providers)}. + *

    Invoked in case a test class or its parent class is annotated with + * {@code @ResourceLock(providers)}. * - * @apiNote Adding {@linkplain Lock a shared resource} with this method - * has the same semantics as annotating a test class - * with analogous {@code @ResourceLock(value, mode)}. + * @apiNote Adding {@linkplain Lock a shared resource} via this method has + * the same semantics as annotating a test class with an analogous + * {@code @ResourceLock(value, mode)} declaration. * - * @param testClass a test class to add shared resources + * @param testClass a test class for which to add shared resources * @return a set of {@link Lock}; may be empty */ default Set provideForClass(Class testClass) { @@ -62,25 +60,22 @@ default Set provideForClass(Class testClass) { } /** - * Add shared resources to a {@linkplain Nested nested} test class. + * Add shared resources to a {@linkplain org.junit.jupiter.api.Nested @Nested} + * test class. * *

    Invoked in case: *

      - *
    • an enclosing test class of any level or its parent class - * is annotated with {@code @ResourceLock(providers)}.
    • - *
    • a nested test class or its parent class - * is annotated with {@code @ResourceLock(providers)}.
    • + *
    • an enclosing test class of any level or its parent class is + * annotated with {@code @ResourceLock(providers = ...)}.
    • + *
    • a nested test class or its parent class is annotated with + * {@code @ResourceLock(providers = ...)}.
    • *
    * - *

    Invoked for a nested test class - * annotated with {@code @ResourceLock(providers)} - * and for its child classes. - * - * @apiNote Adding {@linkplain Lock a shared resource} with this method - * has the same semantics as annotating a nested test class - * with analogous {@code @ResourceLock(value, mode)}. + * @apiNote Adding {@linkplain Lock a shared resource} via this method has + * the same semantics as annotating a nested test class with an analogous + * {@code @ResourceLock(value, mode)} declaration. * - * @param testClass a nested test class to add shared resources + * @param testClass a nested test class for which to add shared resources * @return a set of {@link Lock}; may be empty * @see Nested */ @@ -93,19 +88,18 @@ default Set provideForNestedClass(Class testClass) { * *

    Invoked in case: *

      - *
    • an enclosing test class of any level or its parent class - * is annotated with {@code @ResourceLock(providers)}.
    • - *
    • a test method - * is annotated with {@code @ResourceLock(providers)}.
    • + *
    • an enclosing test class of any level or its parent class is + * annotated with {@code @ResourceLock(providers)}.
    • + *
    • a test method is annotated with {@code @ResourceLock(providers)}.
    • *
    * * @apiNote Adding {@linkplain Lock a shared resource} with this method * has the same semantics as annotating a test method * with analogous {@code @ResourceLock(value, mode)}. * - * @param testClass a test class - * or {@linkplain Nested nested} test class containing the {@code testMethod} - * @param testMethod a test method to add shared resources + * @param testClass the test class or {@code @Nested} test class that contains + * the {@code testMethod} + * @param testMethod a test method for which to add shared resources * @return a set of {@link Lock}; may be empty */ default Set provideForMethod(Class testClass, Method testMethod) { @@ -113,16 +107,14 @@ default Set provideForMethod(Class testClass, Method testMethod) { } /** + * {@code Lock} represents a shared resource. * - *

    {@link Lock} represents a shared resource. - * - *

    Each resource is identified by a {@link #key}. - * In addition, the {@link #accessMode} allows to specify - * whether a test class or test - * method requires {@link ResourceAccessMode#READ_WRITE READ_WRITE} - * or only {@link ResourceAccessMode#READ READ} access to the resource. + *

    Each resource is identified by a {@linkplain #getKey() key}. In addition, + * the {@linkplain #getAccessMode() access mode} allows one to specify whether + * a test class or test method requires {@link ResourceAccessMode#READ_WRITE + * READ_WRITE} or {@link ResourceAccessMode#READ READ} access to the resource. * - * @apiNote {@link Lock#key} and {@link Lock#accessMode} have the same + * @apiNote {@link #getKey()} and {@link #getAccessMode()} have the same * semantics as {@link ResourceLock#value()} and {@link ResourceLock#mode()} * respectively. * @@ -140,7 +132,7 @@ final class Lock { private final ResourceAccessMode accessMode; /** - * Create a new {@code Lock} with {@code accessMode = READ_WRITE}. + * Create a new {@code Lock} with {@link ResourceAccessMode#READ_WRITE}. * * @param key the identifier of the resource; never {@code null} or blank * @see ResourceLock#value() @@ -153,7 +145,8 @@ public Lock(String key) { * Create a new {@code Lock}. * * @param key the identifier of the resource; never {@code null} or blank - * @param accessMode the lock mode to use to synchronize access to the resource; never {@code null} + * @param accessMode the lock mode to use to synchronize access to the + * resource; never {@code null} * @see ResourceLock#value() * @see ResourceLock#mode() */ @@ -163,21 +156,21 @@ public Lock(String key, ResourceAccessMode accessMode) { } /** - * Get the key of this lock. + * Get the key for this lock. * * @see ResourceLock#value() */ public String getKey() { - return key; + return this.key; } /** - * Get the access mode of this lock. + * Get the access mode for this lock. * * @see ResourceLock#mode() */ public ResourceAccessMode getAccessMode() { - return accessMode; + return this.accessMode; } @Override @@ -188,20 +181,20 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - Lock lock = (Lock) o; - return Objects.equals(key, lock.key) && accessMode == lock.accessMode; + Lock that = (Lock) o; + return this.key.equals(that.key) && this.accessMode == that.accessMode; } @Override public int hashCode() { - return Objects.hash(key, accessMode); + return Objects.hash(this.key, this.accessMode); } @Override public String toString() { return new ToStringBuilder(this) // - .append("key", key) // - .append("accessMode", accessMode) // + .append("key", this.key) // + .append("accessMode", this.accessMode) // .toString(); } } From 2e14b3d200d79af948872156768ff966255694ec Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Sun, 19 Jan 2025 18:37:56 +0100 Subject: [PATCH 495/611] Revise release notes for 5.12 M1 --- .../release-notes-5.12.0-M1.adoc | 97 ++++++++++--------- 1 file changed, 50 insertions(+), 47 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 6900df74ec8b..185878c45198 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -37,24 +37,27 @@ JUnit repository on GitHub. [[release-notes-5.12.0-M1-junit-platform-new-features-and-improvements]] ==== New Features and Improvements -* New `addResourceContainerSelectorResolver()` in `EngineDiscoveryRequestResolver.Builder` to - support the discovery of class path resource based tests, analogous to the - `addClassContainerSelectorResolver()`. -* Introduce `ReflectionSupport.makeAccessible(Field)` for third-party use rather than - calling the internal `ReflectionUtils.makeAccessible(Field)` method directly. +* `ConsoleLauncher` now accepts multiple values for all `--select` options. +* `ConsoleLauncher` now supports a `--select-unique-id` option to select containers and + tests by unique ID. +* `ConsoleLauncher` supports new `--exclude-methodname` and `--include-methodname` options + to include or exclude methods based on fully qualified method names without parameters. + For example, `--exclude-methodname=^org\.example\..+#methodname` will exclude all + methods called `methodName` under package `org.example`. +* The `--select-file` and `--select-resource` options for the `ConsoleLauncher` now + support line and column numbers. +* New `ReflectionSupport.makeAccessible(Field)` public utility method to be used by third + parties instead of calling the internal `ReflectionUtils.makeAccessible(Field)` method + directly. * The `ReflectionSupport.tryToLoadClass(...)` utility methods now support lookups for the `"void"` pseudo-type, which indirectly supports `String` to `Class` conversion for `"void"` in parameterized tests in JUnit Jupiter. * `ReflectionUtils` now treats `Void` as a _wrapper_ type for the `void` pseudo-type. -* New `--exclude-methodname` and `--include-methodname` options added to the - `ConsoleLauncher` to include or exclude methods based on fully qualified method names - without parameters. For example, `--exclude-methodname=^org\.example\..+#methodname` - will exclude all methods called `methodName` under package `org.example`. -* Add support for passing line and column number to `ConsoleLauncher` via - `--select-file` and `--select-resource`. -* `ConsoleLauncher` now accepts multiple values for all `--select` options. -* Add `--select-unique-id` support to ConsoleLauncher. -* Add `getOutputDirectoryProvider()` method to `EngineDiscoveryRequest` and `TestPlan` to +* New `addResourceContainerSelectorResolver()` method in + `EngineDiscoveryRequestResolver.Builder` which supports the discovery of class path + resource based tests, analogous to the existing `addClassContainerSelectorResolver()` + method. +* New `getOutputDirectoryProvider()` method in `EngineDiscoveryRequest` and `TestPlan` to allow test engines to publish/attach files to containers and tests by calling `EngineExecutionListener.fileEntryPublished(...)`. Registered `TestExecutionListeners` can then access these files by overriding the `fileEntryPublished(...)` method. @@ -86,61 +89,61 @@ JUnit repository on GitHub. [[release-notes-5.12.0-M1-junit-jupiter-deprecations-and-breaking-changes]] ==== Deprecations and Breaking Changes -* When injecting `TestInfo` into test class constructors it now contains data of the test - method the test class instance is being created for unless the test instance lifecycle - is set to `PER_CLASS` (in which case it continues to contain the data of the test - class). If you require the `TestInfo` of the test class, you can implement a class-level - lifecycle method (e.g., `@BeforeAll`) and inject `TestInfo` into that method. +* When injecting `TestInfo` into test class constructors, the `TestInfo` now contains data + for the test method for which the test class instance is being created, unless the test + instance lifecycle is set to `PER_CLASS` (in which case it continues to contain the data + for the test class). If you require the `TestInfo` of the test class, you can implement + a `@BeforeAll` lifecycle method and inject `TestInfo` into that method. * When injecting `TestReporter` into test class constructors the published report entries - are now associated with the test method rather than the test class unless the test - instance lifecycle is set to `PER_CLASS` (in which case they will continue to be - associated with the test class). If you want to publish report entries for the test - class, you can implement a class-level lifecycle method (e.g., `@BeforeAll`) and inject + are now associated with the test method rather than the test class, unless the test + instance lifecycle is set to `PER_CLASS` (in which case the published report entries + will continue to be associated with the test class). If you want to publish report + entries for the test class, you can implement a `@BeforeAll` lifecycle method and inject `TestReporter` into that method. [[release-notes-5.12.0-M1-junit-jupiter-new-features-and-improvements]] ==== New Features and Improvements -* Introduced contracts for Kotlin-specific assertion methods. +* Kotlin contracts for Kotlin-specific assertion methods in `Assertions`. +* `@TempDir` is now supported on test class constructors. +* Shared resource locks may now be determined programmatically at runtime via the new + `@ResourceLock#providers` attribute that accepts implementations of + `ResourceLocksProvider`. +* Shared resource locks for _direct_ child nodes may now be configured via the new + `@ResourceLock(target = CHILDREN)` attribute. This may improve parallelization when + a test class declares a `READ` lock, but only a few methods hold a `READ_WRITE` lock. +* `@EnumSource` has new `from` and `to` attributes that support the selection of enum + constants within the specified range. * In a `@ParameterizedTest` method, a `null` value can now be supplied for Java Date/Time types such as `LocalDate` if the new `nullable` attribute in `@JavaTimeConversionPattern` is set to `true`. +* The new `@ParameterizedTest(allowZeroInvocations = true)` attribute allows to specify that + the absence of invocations is expected in some cases and should not cause a test failure. +* Parameterized tests now support argument count validation. If the + `junit.jupiter.params.argumentCountValidation=strict` configuration parameter or the + `@ParameterizedTest(argumentCountValidation = STRICT)` attribute is set, any mismatch + between the declared number of arguments and the number of arguments provided by the + arguments source will result in an error. By default, it is still only an error if there + are fewer arguments provided than declared. * `ArgumentsProvider` (declared via `@ArgumentsSource`), `ArgumentConverter` (declared via `@ConvertWith`), and `ArgumentsAggregator` (declared via `@AggregateWith`) implementations can now use constructor injection from registered `ParameterResolver` extensions. -* Extensions based on `TestTemplateInvocationContextProvider` can now allow returning zero - invocation contexts by overriding the new `mayReturnZeroTestTemplateInvocationContexts` - method. -* The new `@ParameterizedTest(allowZeroInvocations = true)` attribute allows to specify that - the absence of invocations is expected in some cases and should not cause a test failure. -* Allow determining "shared resources" at runtime via the new `@ResourceLock#providers` - attribute that accepts implementations of `ResourceLocksProvider`. -* Allow declaring "shared resources" for _direct_ child nodes via the new - `@ResourceLock(target = CHILDREN)` attribute. This may improve parallelization when - a test class declares a `READ` lock, but only a few methods hold a `READ_WRITE` lock. +* `TestTemplateInvocationContextProvider` extensions can now signal that they may + potentially return zero invocation contexts by overriding the new + `mayReturnZeroTestTemplateInvocationContexts()` method. * Extensions that implement `TestInstancePreConstructCallback`, `TestInstanceFactory`, `TestInstancePostProcessor`, `ParameterResolver`, or `InvocationInterceptor` may override the `getTestInstantiationExtensionContextScope()` method to enable receiving a test-scoped `ExtensionContext` in `Extension` methods called during test class instantiation. This behavior will become the default in future versions of JUnit. -* `@TempDir` is now supported on test class constructors. -* Parameterized tests now support argument count validation. - If the `junit.jupiter.params.argumentCountValidation=strict` configuration parameter - or the `@ParameterizedTest(argumentCountValidation = STRICT)` attribute is set, any - mismatch between the declared number of arguments and the number of arguments provided - by the arguments source will result in an error. By default, it's still only an error if - there are fewer arguments provided than declared. -* The new `PreInterruptCallback` extension point defines the API for `Extensions` that - wish to be called prior to invocations of `Thread#interrupt()` by the `@Timeout` - extension. +* The new `PreInterruptCallback` interface defines the API for `Extensions` that wish to + be called prior to invocations of `Thread#interrupt()` by the `@Timeout` extension. * When enabled via the `junit.jupiter.execution.timeout.threaddump.enabled` configuration parameter, an implementation of `PreInterruptCallback` is registered that writes a thread dump to `System.out` prior to interrupting a test thread due to a timeout. * `TestReporter` now allows publishing files for a test method or test class which can be used to include them in test reports, such as the Open Test Reporting format. -* New `from` and `to` attributes added to `@EnumSource` to support range selection of - enum constants. * Auto-registered extensions can now be <<../user-guide/index.adoc#extensions-registration-automatic-filtering, filtered>> using include and exclude patterns that can be specified as configuration parameters. @@ -162,6 +165,6 @@ JUnit repository on GitHub. [[release-notes-5.12.0-M1-junit-vintage-new-features-and-improvements]] ==== New Features and Improvements -* Introduced support for executing top-level test classes in parallel. Please refer to the +* Support for executing top-level test classes in parallel. Please refer to the <<../user-guide/index.adoc#migrating-from-junit4-parallel-execution, User Guide>> for more information. From d583ab0ed06c26fe5e2a9d2def6cae3848d09f74 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Sun, 19 Jan 2025 22:53:06 +0100 Subject: [PATCH 496/611] Fix Javadoc errors --- .../jupiter/api/parallel/ResourceLocksProvider.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocksProvider.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocksProvider.java index be30638bb43d..d94024d99f3b 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocksProvider.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocksProvider.java @@ -28,7 +28,7 @@ *

    Each shared resource is represented by an instance of {@link Lock}. * *

    Adding shared resources via this API has the same semantics as declaring - * them declaratively via {@link ResouceLock @ResourceLock(value, mode)}, but for + * them declaratively via {@link ResourceLock @ResourceLock(value, mode)}, but for * some use cases the programmatic approach may be more flexible and less verbose. * *

    Implementations must provide a no-args constructor. @@ -77,7 +77,7 @@ default Set provideForClass(Class testClass) { * * @param testClass a nested test class for which to add shared resources * @return a set of {@link Lock}; may be empty - * @see Nested + * @see org.junit.jupiter.api.Nested @Nested */ default Set provideForNestedClass(Class testClass) { return emptySet(); @@ -97,10 +97,11 @@ default Set provideForNestedClass(Class testClass) { * has the same semantics as annotating a test method * with analogous {@code @ResourceLock(value, mode)}. * - * @param testClass the test class or {@code @Nested} test class that contains - * the {@code testMethod} + * @param testClass the test class or {@link org.junit.jupiter.api.Nested @Nested} + * test class that contains the {@code testMethod} * @param testMethod a test method for which to add shared resources * @return a set of {@link Lock}; may be empty + * @see org.junit.jupiter.api.Nested @Nested */ default Set provideForMethod(Class testClass, Method testMethod) { return emptySet(); From f6eff608283c935d35a373ca7cf1107f2771bfcd Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Mon, 20 Jan 2025 11:58:51 +0100 Subject: [PATCH 497/611] Polish Javadoc in TestTemplateInvocationContextProvider --- .../TestTemplateInvocationContextProvider.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java index a6a79b881513..31076236ecae 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/extension/TestTemplateInvocationContextProvider.java @@ -93,19 +93,19 @@ public interface TestTemplateInvocationContextProvider extends Extension { /** * Signal that this provider may provide zero - * {@linkplain TestTemplateInvocationContext invocation contexts} in the - * supplied {@code context}. + * {@linkplain TestTemplateInvocationContext invocation contexts} for the test + * template method represented by the supplied {@code context}. * *

    If this method returns {@code false} (which is the default) and the * provider returns an empty stream from * {@link #provideTestTemplateInvocationContexts}, this will be considered - * an execution error. Override this method to ignore the absence of - * invocation contexts for this provider. + * an execution error. Override this method to return {@code true} to ignore + * the absence of invocation contexts for this provider. * * @param context the extension context for the test template method about * to be invoked; never {@code null} * @return {@code true} to allow zero contexts, {@code false} to fail - * execution in case of zero contexts. + * execution in case of zero contexts * * @since 5.12 */ From dde72a9a2df24592e8dc44452d4a7f1871339464 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Mon, 20 Jan 2025 13:01:46 +0100 Subject: [PATCH 498/611] Polishing --- .../org/junit/platform/commons/util/ReflectionUtilsTests.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java index 2a2256ddcfc1..e6411d5a3b5a 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java @@ -816,6 +816,10 @@ void tryToLoadClassTrimsClassName() { void tryToLoadClassForPrimitive() { assertThat(ReflectionUtils.tryToLoadClass(int.class.getName())).isEqualTo(success(int.class)); assertThat(ReflectionUtils.tryToLoadClass(void.class.getName())).isEqualTo(success(void.class)); + + // The following should be equivalent to the above, but just to be sure... + assertThat(ReflectionUtils.tryToLoadClass("int")).isEqualTo(success(int.class)); + assertThat(ReflectionUtils.tryToLoadClass("void")).isEqualTo(success(void.class)); } @Test From 5fd9e88d07a333f1e41360281bbdd98b6d4754df Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Mon, 20 Jan 2025 13:01:03 +0100 Subject: [PATCH 499/611] Remove Void wrapper registration in ReflectionUtils Closes #4048 --- .../docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc | 1 - .../java/org/junit/platform/commons/util/ReflectionUtils.java | 1 - .../org/junit/platform/commons/util/ReflectionUtilsTests.java | 4 +++- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 185878c45198..5d6ceaea5dc0 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -52,7 +52,6 @@ JUnit repository on GitHub. * The `ReflectionSupport.tryToLoadClass(...)` utility methods now support lookups for the `"void"` pseudo-type, which indirectly supports `String` to `Class` conversion for `"void"` in parameterized tests in JUnit Jupiter. -* `ReflectionUtils` now treats `Void` as a _wrapper_ type for the `void` pseudo-type. * New `addResourceContainerSelectorResolver()` method in `EngineDiscoveryRequestResolver.Builder` which supports the discovery of class path resource based tests, analogous to the existing `addClassContainerSelectorResolver()` diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java index 7b4a70d3ae27..dd4116d73938 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java @@ -263,7 +263,6 @@ public enum HierarchyTraversalMode { primitivesToWrappers.put(long.class, Long.class); primitivesToWrappers.put(float.class, Float.class); primitivesToWrappers.put(double.class, Double.class); - primitivesToWrappers.put(void.class, Void.class); primitiveToWrapperMap = Collections.unmodifiableMap(primitivesToWrappers); } diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java index e6411d5a3b5a..7195f25ab14a 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java @@ -561,7 +561,9 @@ void isAssignableTo() { // Wrappers to Primitives assertTrue(ReflectionUtils.isAssignableTo(Integer.class, int.class)); assertTrue(ReflectionUtils.isAssignableTo(Boolean.class, boolean.class)); - assertTrue(ReflectionUtils.isAssignableTo(Void.class, void.class)); + + // Void to void + assertFalse(ReflectionUtils.isAssignableTo(Void.class, void.class)); // Widening Conversions from Wrappers to Primitives assertTrue(ReflectionUtils.isAssignableTo(Integer.class, long.class)); From 3f40a7ea47dbbbee7bd2d086a6f72cd040b18679 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Mon, 20 Jan 2025 13:19:24 +0100 Subject: [PATCH 500/611] =?UTF-8?q?Update=20@=E2=81=A0since/@=E2=81=A0API?= =?UTF-8?q?=20versions=20in=20Reflection[Support|Utils]=20plus=20polishing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/support/ReflectionSupport.java | 20 +++++++++---------- .../commons/util/ReflectionUtils.java | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ReflectionSupport.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ReflectionSupport.java index 700fcb3d53fc..5f8d2cbeffc4 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ReflectionSupport.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/support/ReflectionSupport.java @@ -116,7 +116,7 @@ public static Try> tryToLoadClass(String name, ClassLoader classLoader) } /** - * Tries to get the {@linkplain Resource resources} for the supplied classpath + * Try to get the {@linkplain Resource resources} for the supplied classpath * resource name. * *

    The name of a classpath resource must follow the semantics @@ -130,7 +130,8 @@ public static Try> tryToLoadClass(String name, ClassLoader classLoader) * @return a successful {@code Try} containing the loaded resources or a failed * {@code Try} containing the exception if no such resources could be loaded; * never {@code null} - * @since 1.11 + * @since 1.12 + * @see #tryToGetResources(String, ClassLoader) */ @API(status = EXPERIMENTAL, since = "1.12") public static Try> tryToGetResources(String classpathResourceName) { @@ -138,7 +139,7 @@ public static Try> tryToGetResources(String classpathResourceName) } /** - * Tries to load the {@linkplain Resource resources} for the supplied classpath + * Try to load the {@linkplain Resource resources} for the supplied classpath * resource name, using the supplied {@link ClassLoader}. * *

    The name of a classpath resource must follow the semantics @@ -153,7 +154,8 @@ public static Try> tryToGetResources(String classpathResourceName) * @return a successful {@code Try} containing the loaded resources or a failed * {@code Try} containing the exception if no such resources could be loaded; * never {@code null} - * @since 1.11 + * @since 1.12 + * @see #tryToGetResources(String) */ @API(status = EXPERIMENTAL, since = "1.12") public static Try> tryToGetResources(String classpathResourceName, ClassLoader classLoader) { @@ -201,7 +203,6 @@ public static List> findAllClassesInClasspathRoot(URI root, Predicate findAllResourcesInClasspathRoot(URI root, Predicate resourceFilter) { - return ReflectionUtils.findAllResourcesInClasspathRoot(root, resourceFilter); } @@ -248,7 +249,6 @@ public static Stream> streamAllClassesInClasspathRoot(URI root, Predica */ @API(status = EXPERIMENTAL, since = "1.11") public static Stream streamAllResourcesInClasspathRoot(URI root, Predicate resourceFilter) { - return ReflectionUtils.streamAllResourcesInClasspathRoot(root, resourceFilter); } @@ -296,7 +296,6 @@ public static List> findAllClassesInPackage(String basePackageName, Pre */ @API(status = EXPERIMENTAL, since = "1.11") public static List findAllResourcesInPackage(String basePackageName, Predicate resourceFilter) { - return ReflectionUtils.findAllResourcesInPackage(basePackageName, resourceFilter); } @@ -370,6 +369,7 @@ public static Stream streamAllResourcesInPackage(String basePackageNam * @see #findAllClassesInClasspathRoot(URI, Predicate, Predicate) * @see #findAllClassesInPackage(String, Predicate, Predicate) */ + @API(status = MAINTAINED, since = "1.1.1") public static List> findAllClassesInModule(String moduleName, Predicate> classFilter, Predicate classNameFilter) { @@ -394,7 +394,6 @@ public static List> findAllClassesInModule(String moduleName, Predicate */ @API(status = EXPERIMENTAL, since = "1.11") public static List findAllResourcesInModule(String moduleName, Predicate resourceFilter) { - return ReflectionUtils.findAllResourcesInModule(moduleName, resourceFilter); } @@ -441,7 +440,6 @@ public static Stream> streamAllClassesInModule(String moduleName, Predi */ @API(status = EXPERIMENTAL, since = "1.11") public static Stream streamAllResourcesInModule(String moduleName, Predicate resourceFilter) { - return ReflectionUtils.streamAllResourcesInModule(moduleName, resourceFilter); } @@ -711,10 +709,10 @@ public static Stream> streamNestedClasses(Class clazz, Predicate T makeAccessible(T executable) { return executable; } - @API(status = INTERNAL, since = "1.11") + @API(status = INTERNAL, since = "1.12") @SuppressWarnings("deprecation") // "AccessibleObject.isAccessible()" is deprecated in Java 9 public static Field makeAccessible(Field field) { if ((!isPublic(field) || !isPublic(field.getDeclaringClass()) || isFinal(field)) && !field.isAccessible()) { From 9bddac83d69633057a39bd75989f623dd0c8d6c1 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Mon, 20 Jan 2025 13:29:50 +0100 Subject: [PATCH 501/611] Update Javadoc due to changes in 5fd9e88d07 See #4048 --- .../platform/commons/util/ReflectionUtils.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java index 4751db08ecc9..bcecb4f096e5 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java @@ -417,9 +417,8 @@ public static boolean isMultidimensionalArray(Object obj) { * supplied target type for the purpose of reflective method invocations. * *

    In contrast to {@link Class#isAssignableFrom(Class)}, this method - * returns {@code true} if the target type represents a primitive type (or - * {@code void}) whose wrapper matches the supplied source type. In addition, - * this method also supports + * returns {@code true} if the target type represents a primitive type whose + * wrapper matches the supplied source type. In addition, this method also supports * * widening conversions for primitive target types. * @@ -453,9 +452,8 @@ public static boolean isAssignableTo(Class sourceType, Class targetType) { * type for the purpose of reflective method invocations. * *

    In contrast to {@link Class#isInstance(Object)}, this method returns - * {@code true} if the target type represents a primitive type (or {@code void}) - * whose wrapper matches the supplied object's type. In addition, this method - * also supports + * {@code true} if the target type represents a primitive type whose wrapper + * matches the supplied object's type. In addition, this method also supports * * widening conversions for primitive types and their corresponding * wrapper types. @@ -549,12 +547,11 @@ static boolean isWideningConversion(Class sourceType, Class targetType) { } /** - * Get the wrapper type for the supplied primitive type (or {@code void}). + * Get the wrapper type for the supplied primitive type. * - * @param type the primitive type (or {@code void}) for which to retrieve the - * wrapper type + * @param type the primitive type for which to retrieve the wrapper type * @return the corresponding wrapper type or {@code null} if the - * supplied type is {@code null} or not a primitive type or {@code void} + * supplied type is {@code null} or not a primitive type */ public static Class getWrapperType(Class type) { return primitiveToWrapperMap.get(type); From 0fe36c757530559f599bb8ee6739c54f980acd1b Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Mon, 20 Jan 2025 14:39:42 +0100 Subject: [PATCH 502/611] Increase test coverage for ReflectionUtils.tryToLoadClass() This is a prerequisite for #4250. --- .../commons/util/ReflectionUtilsTests.java | 122 +++++++++++++----- 1 file changed, 88 insertions(+), 34 deletions(-) diff --git a/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java b/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java index 7195f25ab14a..fb45c4835725 100644 --- a/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java +++ b/platform-tests/src/test/java/org/junit/platform/commons/util/ReflectionUtilsTests.java @@ -23,7 +23,6 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.platform.commons.function.Try.success; import static org.junit.platform.commons.util.ReflectionUtils.HierarchyTraversalMode.BOTTOM_UP; import static org.junit.platform.commons.util.ReflectionUtils.HierarchyTraversalMode.TOP_DOWN; import static org.junit.platform.commons.util.ReflectionUtils.findFields; @@ -804,77 +803,132 @@ void loadClass() { @Test void tryToLoadClass() { - assertThat(ReflectionUtils.tryToLoadClass(Integer.class.getName())).isEqualTo(success(Integer.class)); - assertThat(ReflectionUtils.tryToLoadClass(Void.class.getName())).isEqualTo(success(Void.class)); + assertTryToLoadClass(getClass().getName(), getClass()); + assertTryToLoadClass(Integer.class.getName(), Integer.class); + assertTryToLoadClass(Void.class.getName(), Void.class); } @Test void tryToLoadClassTrimsClassName() { - assertThat(ReflectionUtils.tryToLoadClass(" " + Integer.class.getName() + "\t"))// - .isEqualTo(success(Integer.class)); + assertTryToLoadClass(" " + Integer.class.getName() + "\t", Integer.class); } @Test - void tryToLoadClassForPrimitive() { - assertThat(ReflectionUtils.tryToLoadClass(int.class.getName())).isEqualTo(success(int.class)); - assertThat(ReflectionUtils.tryToLoadClass(void.class.getName())).isEqualTo(success(void.class)); + void tryToLoadClassForVoidPseudoPrimitiveType() { + assertTryToLoadClass("void", void.class); + } - // The following should be equivalent to the above, but just to be sure... - assertThat(ReflectionUtils.tryToLoadClass("int")).isEqualTo(success(int.class)); - assertThat(ReflectionUtils.tryToLoadClass("void")).isEqualTo(success(void.class)); + @Test + void tryToLoadClassForPrimitiveType() { + assertTryToLoadClass("boolean", boolean.class); + assertTryToLoadClass("char", char.class); + assertTryToLoadClass("byte", byte.class); + assertTryToLoadClass("short", short.class); + assertTryToLoadClass("int", int.class); + assertTryToLoadClass("long", long.class); + assertTryToLoadClass("float", float.class); + assertTryToLoadClass("double", double.class); } @Test - void tryToLoadClassForPrimitiveArray() { - assertThat(ReflectionUtils.tryToLoadClass(int[].class.getName())).isEqualTo(success(int[].class)); + void tryToLoadClassForBinaryPrimitiveArrayName() { + assertTryToLoadClass("[Z", boolean[].class); + assertTryToLoadClass("[C", char[].class); + assertTryToLoadClass("[B", byte[].class); + assertTryToLoadClass("[S", short[].class); + assertTryToLoadClass("[I", int[].class); + assertTryToLoadClass("[J", long[].class); + assertTryToLoadClass("[F", float[].class); + assertTryToLoadClass("[D", double[].class); } @Test - void tryToLoadClassForPrimitiveArrayUsingSourceCodeSyntax() { - assertThat(ReflectionUtils.tryToLoadClass("int[]")).isEqualTo(success(int[].class)); + void tryToLoadClassForCanonicalPrimitiveArrayName() { + assertTryToLoadClass("boolean[]", boolean[].class); + assertTryToLoadClass("char[]", char[].class); + assertTryToLoadClass("byte[]", byte[].class); + assertTryToLoadClass("short[]", short[].class); + assertTryToLoadClass("int[]", int[].class); + assertTryToLoadClass("long[]", long[].class); + assertTryToLoadClass("float[]", float[].class); + assertTryToLoadClass("double[]", double[].class); } @Test - void tryToLoadClassForObjectArray() { - assertThat(ReflectionUtils.tryToLoadClass(String[].class.getName())).isEqualTo(success(String[].class)); + void tryToLoadClassForBinaryObjectArrayName() { + assertTryToLoadClass(String[].class.getName(), String[].class); } @Test - void tryToLoadClassForObjectArrayUsingSourceCodeSyntax() { - assertThat(ReflectionUtils.tryToLoadClass("java.lang.String[]")).isEqualTo(success(String[].class)); + void tryToLoadClassForCanonicalObjectArrayName() { + assertTryToLoadClass("java.lang.String[]", String[].class); } @Test - void tryToLoadClassForTwoDimensionalPrimitiveArray() { - assertThat(ReflectionUtils.tryToLoadClass(int[][].class.getName())).isEqualTo(success(int[][].class)); + void tryToLoadClassForBinaryTwoDimensionalPrimitiveArrayName() { + assertTryToLoadClass("[[Z", boolean[][].class); + assertTryToLoadClass("[[C", char[][].class); + assertTryToLoadClass("[[B", byte[][].class); + assertTryToLoadClass("[[S", short[][].class); + assertTryToLoadClass("[[I", int[][].class); + assertTryToLoadClass("[[J", long[][].class); + assertTryToLoadClass("[[F", float[][].class); + assertTryToLoadClass("[[D", double[][].class); } @Test - void tryToLoadClassForTwoDimensionaldimensionalPrimitiveArrayUsingSourceCodeSyntax() { - assertThat(ReflectionUtils.tryToLoadClass("int[][]")).isEqualTo(success(int[][].class)); + void tryToLoadClassForCanonicalTwoDimensionalPrimitiveArrayName() { + assertTryToLoadClass("boolean[][]", boolean[][].class); + assertTryToLoadClass("char[][]", char[][].class); + assertTryToLoadClass("byte[][]", byte[][].class); + assertTryToLoadClass("short[][]", short[][].class); + assertTryToLoadClass("int[][]", int[][].class); + assertTryToLoadClass("long[][]", long[][].class); + assertTryToLoadClass("float[][]", float[][].class); + assertTryToLoadClass("double[][]", double[][].class); } @Test - void tryToLoadClassForMultidimensionalPrimitiveArray() { - assertThat(ReflectionUtils.tryToLoadClass(int[][][][][].class.getName()))// - .isEqualTo(success(int[][][][][].class)); + void tryToLoadClassForBinaryMultidimensionalPrimitiveArrayName() { + assertTryToLoadClass("[[[[[Z", boolean[][][][][].class); + assertTryToLoadClass("[[[[[C", char[][][][][].class); + assertTryToLoadClass("[[[[[B", byte[][][][][].class); + assertTryToLoadClass("[[[[[S", short[][][][][].class); + assertTryToLoadClass("[[[[[I", int[][][][][].class); + assertTryToLoadClass("[[[[[J", long[][][][][].class); + assertTryToLoadClass("[[[[[F", float[][][][][].class); + assertTryToLoadClass("[[[[[D", double[][][][][].class); } @Test - void tryToLoadClassForMultidimensionalPrimitiveArrayUsingSourceCodeSyntax() { - assertThat(ReflectionUtils.tryToLoadClass("int[][][][][]")).isEqualTo(success(int[][][][][].class)); + void tryToLoadClassForCanonicalMultidimensionalPrimitiveArrayName() { + assertTryToLoadClass("boolean[][][][][]", boolean[][][][][].class); + assertTryToLoadClass("char[][][][][]", char[][][][][].class); + assertTryToLoadClass("byte[][][][][]", byte[][][][][].class); + assertTryToLoadClass("short[][][][][]", short[][][][][].class); + assertTryToLoadClass("int[][][][][]", int[][][][][].class); + assertTryToLoadClass("long[][][][][]", long[][][][][].class); + assertTryToLoadClass("float[][][][][]", float[][][][][].class); + assertTryToLoadClass("double[][][][][]", double[][][][][].class); } @Test - void tryToLoadClassForMultidimensionalObjectArray() { - assertThat(ReflectionUtils.tryToLoadClass(String[][][][][].class.getName()))// - .isEqualTo(success(String[][][][][].class)); + void tryToLoadClassForBinaryMultidimensionalObjectArrayName() { + assertTryToLoadClass(String[][][][][].class.getName(), String[][][][][].class); } @Test - void tryToLoadClassForMultidimensionalObjectArrayUsingSourceCodeSyntax() { - assertThat(ReflectionUtils.tryToLoadClass("java.lang.String[][][][][]"))// - .isEqualTo(success(String[][][][][].class)); + void tryToLoadClassForCanonicalMultidimensionalObjectArrayName() { + assertTryToLoadClass("java.lang.String[][][][][]", String[][][][][].class); + } + + private static void assertTryToLoadClass(String name, Class type) { + try { + assertThat(ReflectionUtils.tryToLoadClass(name).get()).as(name).isEqualTo(type); + } + catch (Exception ex) { + ExceptionUtils.throwAsUncheckedException(ex); + } } } From 2bae68b1861285b8de6dffabbdf860eaa01a9b6f Mon Sep 17 00:00:00 2001 From: Christian Stein Date: Fri, 17 Jan 2025 19:04:53 +0100 Subject: [PATCH 503/611] Delete cases covered by `Class.forName()` `Class.forName()` from `java.base/java.lang` has already built-in support for type names matching: - _Primitive arrays such as "[I", "[[[[D", etc._ and - _Object arrays such as "[Ljava.lang.String;", etc._ This commit deletes the redundant implementation from JUnit's internal `ReflectionUtils` helper. --- .../commons/util/ReflectionUtils.java | 41 +------------------ 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java index bcecb4f096e5..d0c9921d92e3 100644 --- a/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java +++ b/junit-platform-commons/src/main/java/org/junit/platform/commons/util/ReflectionUtils.java @@ -129,21 +129,6 @@ public enum HierarchyTraversalMode { BOTTOM_UP } - // Pattern: "[Ljava.lang.String;", "[[[[Ljava.lang.String;", etc. - private static final Pattern VM_INTERNAL_OBJECT_ARRAY_PATTERN = Pattern.compile("^(\\[+)L(.+);$"); - - /** - * Pattern: "[x", "[[[[x", etc., where x is Z, B, C, D, F, I, J, S, etc. - * - *

    The pattern intentionally captures the last bracket with the - * capital letter so that the combination can be looked up via - * {@link #classNameToTypeMap}. For example, the last matched group - * will contain {@code "[I"} instead of {@code "I"}. - * - * @see Class#getName() - */ - private static final Pattern VM_INTERNAL_PRIMITIVE_ARRAY_PATTERN = Pattern.compile("^(\\[+)(\\[[ZBCDFIJS])$"); - // Pattern: "java.lang.String[]", "int[]", "int[][][][]", etc. // ?> => non-capturing atomic group // ++ => possessive quantifier @@ -855,32 +840,8 @@ public static Try> tryToLoadClass(String name, ClassLoader classLoader) } return Try.call(() -> { - Matcher matcher; - - // Primitive arrays such as "[I", "[[[[D", etc. - matcher = VM_INTERNAL_PRIMITIVE_ARRAY_PATTERN.matcher(trimmedName); - if (matcher.matches()) { - String brackets = matcher.group(1); - String componentTypeName = matcher.group(2); - // Calculate dimensions by counting brackets. - int dimensions = brackets.length(); - - return loadArrayType(classLoader, componentTypeName, dimensions); - } - - // Object arrays such as "[Ljava.lang.String;", "[[[[Ljava.lang.String;", etc. - matcher = VM_INTERNAL_OBJECT_ARRAY_PATTERN.matcher(trimmedName); - if (matcher.matches()) { - String brackets = matcher.group(1); - String componentTypeName = matcher.group(2); - // Calculate dimensions by counting brackets. - int dimensions = brackets.length(); - - return loadArrayType(classLoader, componentTypeName, dimensions); - } - // Arrays such as "java.lang.String[]", "int[]", "int[][][][]", etc. - matcher = SOURCE_CODE_SYNTAX_ARRAY_PATTERN.matcher(trimmedName); + Matcher matcher = SOURCE_CODE_SYNTAX_ARRAY_PATTERN.matcher(trimmedName); if (matcher.matches()) { String componentTypeName = matcher.group(1); String bracketPairs = matcher.group(2); From 5ca0ced086abc1efe4c7d2c8aeeb40e09ada2aaa Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Tue, 21 Jan 2025 12:23:00 +0100 Subject: [PATCH 504/611] Fix grammar in Javadoc for NestedMethodSelector --- .../engine/discovery/NestedMethodSelector.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/NestedMethodSelector.java b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/NestedMethodSelector.java index e359547a0e30..25f17d67ca92 100644 --- a/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/NestedMethodSelector.java +++ b/junit-platform-engine/src/main/java/org/junit/platform/engine/discovery/NestedMethodSelector.java @@ -29,15 +29,14 @@ import org.junit.platform.engine.DiscoverySelectorIdentifier; /** - * A {@link DiscoverySelector} that selects a nested {@link Method} - * or a combination of enclosing classes names, class name, method - * name, and parameter types so that - * {@link org.junit.platform.engine.TestEngine TestEngines} can discover - * tests or containers based on methods. + * A {@link DiscoverySelector} that selects a nested {@link Method} or a + * combination of enclosing class names, class name, method name, and parameter + * types so that {@link org.junit.platform.engine.TestEngine TestEngines} can + * discover tests or containers based on methods. * *

    If a Java {@link Method} is provided, the selector will return that * {@linkplain #getMethod() method} and its method name, class name, enclosing - * classes names, and parameter types accordingly. If class names or method names + * class names, and parameter types accordingly. If class names or method names * are provided, this selector will only attempt to lazily load a class or method * if {@link #getEnclosingClasses()}, {@link #getNestedClass()}, * {@link #getMethod()}, or {@link #getParameterTypes()} is invoked. From aec4ad9b95650390da02a3a3a30408fdb5ea2b1f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 22 Jan 2025 01:11:18 +0000 Subject: [PATCH 505/611] Update plugin commonCustomUserData to v2.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4f3aea0ac55d..a5458248e85d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -90,7 +90,7 @@ asciidoctorConvert = { id = "org.asciidoctor.jvm.convert", version.ref = "asciid asciidoctorPdf = { id = "org.asciidoctor.jvm.pdf", version.ref = "asciidoctor-plugins" } bnd = { id = "biz.aQute.bnd", version.ref = "bnd" } buildParameters = { id = "org.gradlex.build-parameters", version = "1.4.4" } -commonCustomUserData = { id = "com.gradle.common-custom-user-data-gradle-plugin", version = "2.0.2" } +commonCustomUserData = { id = "com.gradle.common-custom-user-data-gradle-plugin", version = "2.1" } develocity = { id = "com.gradle.develocity", version = "3.19" } foojayResolver = { id = "org.gradle.toolchains.foojay-resolver", version = "0.9.0" } gitPublish = { id = "org.ajoberstar.git-publish", version = "5.1.0" } From ba3a4ff895b08f28b3d3157f6ea8ff1877bcf8b6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 22 Jan 2025 12:44:43 +0000 Subject: [PATCH 506/611] Update actions/stale digest to 5bef64f (#4253) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/close-inactive-issues.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/close-inactive-issues.yml b/.github/workflows/close-inactive-issues.yml index 5952a1e8c3aa..a443402a9720 100644 --- a/.github/workflows/close-inactive-issues.yml +++ b/.github/workflows/close-inactive-issues.yml @@ -11,7 +11,7 @@ jobs: issues: write pull-requests: write steps: - - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9 + - uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9 with: only-labels: "status: waiting-for-feedback" days-before-stale: 14 From 10eeeda7c9e1852a1ed5bca0fedd7c81da7f8e4d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 22 Jan 2025 17:20:46 +0000 Subject: [PATCH 507/611] Update github/codeql-action digest to d68b2d4 (#4255) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/ossf-scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e5050471788c..3422dfa64945 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -34,7 +34,7 @@ jobs: - name: Check out repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Initialize CodeQL - uses: github/codeql-action/init@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3 + uses: github/codeql-action/init@d68b2d4edb4189fd2a5366ac14e72027bd4b37dd # v3 with: languages: ${{ matrix.language }} tools: linked @@ -47,4 +47,4 @@ jobs: -Dscan.tag.CodeQL \ allMainClasses - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3 + uses: github/codeql-action/analyze@d68b2d4edb4189fd2a5366ac14e72027bd4b37dd # v3 diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index 83eb112f1b21..dca435703147 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard (optional). # Commenting out will disable upload of results to your repo's Code Scanning dashboard - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3 + uses: github/codeql-action/upload-sarif@d68b2d4edb4189fd2a5366ac14e72027bd4b37dd # v3 with: sarif_file: results.sarif From ab41b23d747c2d9a09cbb321c783fe17734139fb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 22 Jan 2025 22:15:15 +0000 Subject: [PATCH 508/611] Update codecov/codecov-action digest to 5a605bd (#4257) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 84861342054a..a93ed4327422 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,7 +39,7 @@ jobs: jacocoRootReport \ --no-configuration-cache # Disable configuration cache due to https://github.com/diffplug/spotless/issues/2318 - name: Upload to Codecov.io - uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5 + uses: codecov/codecov-action@5a605bd92782ce0810fa3b8acc235c921b497052 # v5 with: token: ${{ secrets.CODECOV_TOKEN }} From 15539b0594ed72e4961ffe22ad9e381e0f6857ef Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 00:26:19 +0000 Subject: [PATCH 509/611] Update graalvm/setup-graalvm digest to aafbedb (#4254) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a93ed4327422..1388a8e7979c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,7 @@ jobs: with: fetch-depth: 1 - name: Install GraalVM - uses: graalvm/setup-graalvm@c09e29bb115a83bd4b7c7e99bb46e2e8a1c50466 # v1 + uses: graalvm/setup-graalvm@aafbedb8d382ed0ca6167d3a051415f20c859274 # v1 with: distribution: graalvm-community version: 'latest' From 5cb4571846906f835e5cef7a3eb3cf5edfcc1084 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 05:24:48 +0000 Subject: [PATCH 510/611] Update actions/attest-build-provenance action to v2.2.0 (#4258) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/main.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1388a8e7979c..d4060075cdc7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -91,7 +91,7 @@ jobs: publish -x check \ prepareGitHubAttestation - name: Generate build provenance attestations - uses: actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0 + uses: actions/attest-build-provenance@520d128f165991a6c774bcb264f323e3d70747f4 # v2.2.0 with: subject-path: documentation/build/attestation/*.jar diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 873723ee9d34..c1dad08c57a5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,7 +51,7 @@ jobs: :verifyArtifactsInStagingRepositoryAreReproducible \ --remote-repo-url=${{ env.STAGING_REPO_URL }} - name: Generate build provenance attestations - uses: actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0 + uses: actions/attest-build-provenance@520d128f165991a6c774bcb264f323e3d70747f4 # v2.2.0 with: subject-path: build/repo/**/*.jar - name: Upload local repository for later jobs From 21bb094971d0d3a266bec69e9a516c1906b8ea62 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 10:11:05 +0000 Subject: [PATCH 511/611] Update github/codeql-action digest to dd196fa (#4260) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/ossf-scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 3422dfa64945..a39b266456ff 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -34,7 +34,7 @@ jobs: - name: Check out repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Initialize CodeQL - uses: github/codeql-action/init@d68b2d4edb4189fd2a5366ac14e72027bd4b37dd # v3 + uses: github/codeql-action/init@dd196fa9ce80b6bacc74ca1c32bd5b0ba22efca7 # v3 with: languages: ${{ matrix.language }} tools: linked @@ -47,4 +47,4 @@ jobs: -Dscan.tag.CodeQL \ allMainClasses - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@d68b2d4edb4189fd2a5366ac14e72027bd4b37dd # v3 + uses: github/codeql-action/analyze@dd196fa9ce80b6bacc74ca1c32bd5b0ba22efca7 # v3 diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index dca435703147..e9a4100dac19 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard (optional). # Commenting out will disable upload of results to your repo's Code Scanning dashboard - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@d68b2d4edb4189fd2a5366ac14e72027bd4b37dd # v3 + uses: github/codeql-action/upload-sarif@dd196fa9ce80b6bacc74ca1c32bd5b0ba22efca7 # v3 with: sarif_file: results.sarif From 544c3b2eb483ecc350784f853d13ddfc1193bff3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 10:11:36 +0000 Subject: [PATCH 512/611] Update plugin plantuml to v8.12 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a5458248e85d..7a4286a5bda5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -96,7 +96,7 @@ foojayResolver = { id = "org.gradle.toolchains.foojay-resolver", version = "0.9. gitPublish = { id = "org.ajoberstar.git-publish", version = "5.1.0" } jmh = { id = "me.champeau.jmh", version = "0.7.2" } nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" } -plantuml = { id = "io.freefair.plantuml", version = "8.11" } +plantuml = { id = "io.freefair.plantuml", version = "8.12" } shadow = { id = "com.gradleup.shadow", version = "8.3.5" } spotless = { id = "com.diffplug.spotless", version = "6.25.0" } versions = { id = "com.github.ben-manes.versions", version = "0.51.0" } From 3583e013109051d4965d6756c24966515da06607 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 23 Jan 2025 11:29:19 +0100 Subject: [PATCH 513/611] Use separate local Maven repos when file system type is NTFS (#4259) Prior to this commit, Maven builds triggered from integration tests sometimes failed because another concurrent build was writing to the same file in the temporary local Maven repo. --- .../support/tests/JavaVersionsTests.java | 2 +- .../tooling/support/tests/LocalMavenRepo.java | 33 ++++++++++++++++ ...obalResource.java => ManagedResource.java} | 39 ++++++++++++++++--- .../support/tests/MavenStarterTests.java | 4 +- .../MavenSurefireCompatibilityTests.java | 2 +- .../support/tests/MultiReleaseJarTests.java | 4 +- .../tests/UnalignedClasspathTests.java | 4 +- .../tests/VintageMavenIntegrationTests.java | 2 +- 8 files changed, 76 insertions(+), 14 deletions(-) rename platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/{GlobalResource.java => ManagedResource.java} (75%) diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java index 4a7cce72c99e..417bb8119906 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/JavaVersionsTests.java @@ -34,7 +34,7 @@ */ class JavaVersionsTests { - @GlobalResource + @ManagedResource LocalMavenRepo localMavenRepo; @TempDir diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/LocalMavenRepo.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/LocalMavenRepo.java index dc9b99e58a8d..cb3eb217fa75 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/LocalMavenRepo.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/LocalMavenRepo.java @@ -10,14 +10,47 @@ package platform.tooling.support.tests; +import static platform.tooling.support.tests.ManagedResource.Scope.GLOBAL; +import static platform.tooling.support.tests.ManagedResource.Scope.PER_CONTEXT; + import java.io.IOException; import java.io.UncheckedIOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.Comparator; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.ExtensionContext.Namespace; + +@ManagedResource.Scoped(LocalMavenRepo.ScopeProvider.class) public class LocalMavenRepo implements AutoCloseable { + public static class ScopeProvider implements ManagedResource.Scoped.Provider { + + private static final Namespace NAMESPACE = Namespace.create(LocalMavenRepo.class); + + @Override + public ManagedResource.Scope determineScope(ExtensionContext extensionContext) { + var store = extensionContext.getRoot().getStore(NAMESPACE); + var fileSystemType = store.getOrComputeIfAbsent("tempFileSystemType", key -> { + var type = getFileSystemType(Path.of(System.getProperty("java.io.tmpdir"))); + extensionContext.getRoot().publishReportEntry("tempFileSystemType", type); + return type; + }, String.class); + // Writing to the same file from multiple Maven processes may fail the build on Windows + return "NTFS".equalsIgnoreCase(fileSystemType) ? PER_CONTEXT : GLOBAL; + } + + private static String getFileSystemType(Path path) { + try { + return Files.getFileStore(path).type(); + } + catch (IOException e) { + throw new UncheckedIOException(e); + } + } + } + private final Path tempDir; public LocalMavenRepo() { diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GlobalResource.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ManagedResource.java similarity index 75% rename from platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GlobalResource.java rename to platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ManagedResource.java index 8774adbda241..c278f0a8c0e8 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/GlobalResource.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/ManagedResource.java @@ -32,15 +32,30 @@ @Target({ ElementType.PARAMETER, ElementType.FIELD }) @Retention(RUNTIME) -@ExtendWith(GlobalResource.Extension.class) -public @interface GlobalResource { +@ExtendWith(ManagedResource.Extension.class) +public @interface ManagedResource { + + @Target(ElementType.TYPE) + @Retention(RUNTIME) + @interface Scoped { + + Class value(); + + interface Provider { + Scope determineScope(ExtensionContext extensionContext); + } + } + + enum Scope { + GLOBAL, PER_CONTEXT + } class Extension implements ParameterResolver, TestInstancePostProcessor { @Override public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { - return parameterContext.isAnnotated(GlobalResource.class); + return parameterContext.isAnnotated(ManagedResource.class); } @Override @@ -50,9 +65,14 @@ public Object resolveParameter(ParameterContext parameterContext, ExtensionConte return getOrCreateResource(extensionContext, type).get(); } + @Override + public ExtensionContextScope getTestInstantiationExtensionContextScope(ExtensionContext rootContext) { + return ExtensionContextScope.TEST_METHOD; + } + @Override public void postProcessTestInstance(Object testInstance, ExtensionContext extensionContext) { - streamFields(testInstance.getClass(), field -> AnnotationSupport.isAnnotated(field, GlobalResource.class), + streamFields(testInstance.getClass(), field -> AnnotationSupport.isAnnotated(field, ManagedResource.class), HierarchyTraversalMode.BOTTOM_UP) // .forEach(field -> { try { @@ -66,7 +86,16 @@ public void postProcessTestInstance(Object testInstance, ExtensionContext extens @SuppressWarnings("unchecked") private Resource getOrCreateResource(ExtensionContext extensionContext, Class type) { - return extensionContext.getRoot().getStore(Namespace.GLOBAL) // + var scope = AnnotationSupport.findAnnotation(type, Scoped.class) // + .map(Scoped::value) // + .map(ReflectionSupport::newInstance) // + .map(provider -> provider.determineScope(extensionContext)) // + .orElse(Scope.GLOBAL); + var storingContext = switch (scope) { + case GLOBAL -> extensionContext.getRoot(); + case PER_CONTEXT -> extensionContext; + }; + return storingContext.getStore(Namespace.GLOBAL) // .getOrComputeIfAbsent(type, Resource::new, Resource.class); } } diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java index 9faf699942ea..5a795087abae 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenStarterTests.java @@ -32,10 +32,10 @@ */ class MavenStarterTests { - @GlobalResource + @ManagedResource LocalMavenRepo localMavenRepo; - @GlobalResource + @ManagedResource MavenRepoProxy mavenRepoProxy; @Test diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java index a59d90ecbf53..3a62853d52aa 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MavenSurefireCompatibilityTests.java @@ -33,7 +33,7 @@ */ class MavenSurefireCompatibilityTests { - @GlobalResource + @ManagedResource LocalMavenRepo localMavenRepo; @ParameterizedTest diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java index c07954ac5c5e..4326fa6fa7c9 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/MultiReleaseJarTests.java @@ -33,10 +33,10 @@ */ class MultiReleaseJarTests { - @GlobalResource + @ManagedResource LocalMavenRepo localMavenRepo; - @GlobalResource + @ManagedResource MavenRepoProxy mavenRepoProxy; @Test diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/UnalignedClasspathTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/UnalignedClasspathTests.java index a6467c511564..7869a3d59186 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/UnalignedClasspathTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/UnalignedClasspathTests.java @@ -37,10 +37,10 @@ */ class UnalignedClasspathTests { - @GlobalResource + @ManagedResource LocalMavenRepo localMavenRepo; - @GlobalResource + @ManagedResource MavenRepoProxy mavenRepoProxy; @ParameterizedTest diff --git a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java index 7f735753f009..2b95c5b891d5 100644 --- a/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java +++ b/platform-tooling-support-tests/src/test/java/platform/tooling/support/tests/VintageMavenIntegrationTests.java @@ -29,7 +29,7 @@ class VintageMavenIntegrationTests { - @GlobalResource + @ManagedResource LocalMavenRepo localMavenRepo; @TempDir From 292f6a09fef591b3cb945cb7fcd8f7b48000f80b Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Thu, 23 Jan 2025 11:42:01 +0100 Subject: [PATCH 514/611] Revert "Use Gradle's new daemon JVM criteria feature" This causes problems on IntelliJ IDEA's 2025.1 EAP version which picks the IDE's own JetBrains JDK rather than one specified using the `JDK21` env var. Since JetBrains' JDK does not contain tools like `jar` this causes builds to break when the Gradle daemon is started via IntelliJ IDEA. This reverts commit 1e29d8e623eb019ae1463637f42c23aae2ff8765. --- gradle/gradle-daemon-jvm.properties | 2 -- gradle/plugins/settings.gradle.kts | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-) delete mode 100644 gradle/gradle-daemon-jvm.properties diff --git a/gradle/gradle-daemon-jvm.properties b/gradle/gradle-daemon-jvm.properties deleted file mode 100644 index 63e5bbdf4845..000000000000 --- a/gradle/gradle-daemon-jvm.properties +++ /dev/null @@ -1,2 +0,0 @@ -#This file is generated by updateDaemonJvm -toolchainVersion=21 diff --git a/gradle/plugins/settings.gradle.kts b/gradle/plugins/settings.gradle.kts index 41935db0aa36..163866db2805 100644 --- a/gradle/plugins/settings.gradle.kts +++ b/gradle/plugins/settings.gradle.kts @@ -1,3 +1,9 @@ +val expectedJavaVersion = JavaVersion.VERSION_21 +val actualJavaVersion = JavaVersion.current() +require(actualJavaVersion == expectedJavaVersion) { + "The JUnit 5 build must be executed with Java ${expectedJavaVersion.majorVersion}. Currently executing with Java ${actualJavaVersion.majorVersion}." +} + dependencyResolutionManagement { versionCatalogs { create("libs") { From 9d45d42b18ab9218244e38e945ea343c0a24169c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 12:14:46 +0100 Subject: [PATCH 515/611] Update plugin versions to v0.52.0 (#4262) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7a4286a5bda5..138ca6578ec6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -99,4 +99,4 @@ nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" plantuml = { id = "io.freefair.plantuml", version = "8.12" } shadow = { id = "com.gradleup.shadow", version = "8.3.5" } spotless = { id = "com.diffplug.spotless", version = "6.25.0" } -versions = { id = "com.github.ben-manes.versions", version = "0.51.0" } +versions = { id = "com.github.ben-manes.versions", version = "0.52.0" } From e78ca1d999ba8017a4a445a030bbc20b9c579c6a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 12:55:08 +0000 Subject: [PATCH 516/611] Update plugin develocity to v3.19.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 138ca6578ec6..44c5fa83a9d9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -91,7 +91,7 @@ asciidoctorPdf = { id = "org.asciidoctor.jvm.pdf", version.ref = "asciidoctor-pl bnd = { id = "biz.aQute.bnd", version.ref = "bnd" } buildParameters = { id = "org.gradlex.build-parameters", version = "1.4.4" } commonCustomUserData = { id = "com.gradle.common-custom-user-data-gradle-plugin", version = "2.1" } -develocity = { id = "com.gradle.develocity", version = "3.19" } +develocity = { id = "com.gradle.develocity", version = "3.19.1" } foojayResolver = { id = "org.gradle.toolchains.foojay-resolver", version = "0.9.0" } gitPublish = { id = "org.ajoberstar.git-publish", version = "5.1.0" } jmh = { id = "me.champeau.jmh", version = "0.7.2" } From 73d7f125992630dba1c13debf4672164a4b6cf56 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 17:57:05 +0000 Subject: [PATCH 517/611] Update github/codeql-action digest to ee117c9 --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/ossf-scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index a39b266456ff..0d4067fe42a2 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -34,7 +34,7 @@ jobs: - name: Check out repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Initialize CodeQL - uses: github/codeql-action/init@dd196fa9ce80b6bacc74ca1c32bd5b0ba22efca7 # v3 + uses: github/codeql-action/init@ee117c905ab18f32fa0f66c2fe40ecc8013f3e04 # v3 with: languages: ${{ matrix.language }} tools: linked @@ -47,4 +47,4 @@ jobs: -Dscan.tag.CodeQL \ allMainClasses - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@dd196fa9ce80b6bacc74ca1c32bd5b0ba22efca7 # v3 + uses: github/codeql-action/analyze@ee117c905ab18f32fa0f66c2fe40ecc8013f3e04 # v3 diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index e9a4100dac19..bcd9ff22a8a2 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard (optional). # Commenting out will disable upload of results to your repo's Code Scanning dashboard - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@dd196fa9ce80b6bacc74ca1c32bd5b0ba22efca7 # v3 + uses: github/codeql-action/upload-sarif@ee117c905ab18f32fa0f66c2fe40ecc8013f3e04 # v3 with: sarif_file: results.sarif From bf08ea2ad4ab89791eac91c49a4a2197af9b1f94 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 24 Jan 2025 09:37:41 +0000 Subject: [PATCH 518/611] Update codecov/codecov-action digest to 0da7aa6 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d4060075cdc7..3a2e2893437a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,7 +39,7 @@ jobs: jacocoRootReport \ --no-configuration-cache # Disable configuration cache due to https://github.com/diffplug/spotless/issues/2318 - name: Upload to Codecov.io - uses: codecov/codecov-action@5a605bd92782ce0810fa3b8acc235c921b497052 # v5 + uses: codecov/codecov-action@0da7aa657d958d32c117fc47e1f977e7524753c7 # v5 with: token: ${{ secrets.CODECOV_TOKEN }} From 6d260dadaa8416305fb2d80104827e916bc1f617 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Fri, 24 Jan 2025 13:28:12 +0100 Subject: [PATCH 519/611] Remove Twitter/X --- RELEASING.md | 1 - 1 file changed, 1 deletion(-) diff --git a/RELEASING.md b/RELEASING.md index e22831147713..641960cd0f8f 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -21,7 +21,6 @@ - [ ] Post about the new release: - [ ] [Mastodon](https://fosstodon.org/@junit) - [ ] [Bluesky](https://bsky.app/profile/junit.org) - - [ ] [Twitter/X](https://x.com/junitteam) ### Preview releases (milestones and release candidates) From a1a53537e329dd60da32eebbbbedc4b88b497fd7 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 26 Jan 2025 08:30:54 +0000 Subject: [PATCH 520/611] Update codecov/codecov-action digest to 13ce06b --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3a2e2893437a..97645a94623b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,7 +39,7 @@ jobs: jacocoRootReport \ --no-configuration-cache # Disable configuration cache due to https://github.com/diffplug/spotless/issues/2318 - name: Upload to Codecov.io - uses: codecov/codecov-action@0da7aa657d958d32c117fc47e1f977e7524753c7 # v5 + uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5 with: token: ${{ secrets.CODECOV_TOKEN }} From 9149fb82bca09606690d4dbbc018083d9add3a2e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 26 Jan 2025 08:30:58 +0000 Subject: [PATCH 521/611] Update github/codeql-action digest to f6091c0 --- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/ossf-scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 0d4067fe42a2..e7d55f0dd380 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -34,7 +34,7 @@ jobs: - name: Check out repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - name: Initialize CodeQL - uses: github/codeql-action/init@ee117c905ab18f32fa0f66c2fe40ecc8013f3e04 # v3 + uses: github/codeql-action/init@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # v3 with: languages: ${{ matrix.language }} tools: linked @@ -47,4 +47,4 @@ jobs: -Dscan.tag.CodeQL \ allMainClasses - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@ee117c905ab18f32fa0f66c2fe40ecc8013f3e04 # v3 + uses: github/codeql-action/analyze@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # v3 diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index bcd9ff22a8a2..0900c1a0d83f 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -57,6 +57,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard (optional). # Commenting out will disable upload of results to your repo's Code Scanning dashboard - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@ee117c905ab18f32fa0f66c2fe40ecc8013f3e04 # v3 + uses: github/codeql-action/upload-sarif@f6091c0113d1dcf9b98e269ee48e8a7e51b7bdd4 # v3 with: sarif_file: results.sarif From 4c382d0e7d44c775c5c75fab3fb2b489de825220 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 26 Jan 2025 09:54:12 +0000 Subject: [PATCH 522/611] Update dependency gradle to v8.12.1 --- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e1b837a19c22..d71047787f80 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=7a00d51fb93147819aab76024feece20b6b84e420694101f276be952e08bef03 -distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip +distributionSha256Sum=8d97a97984f6cbd2b85fe4c60a743440a347544bf18818048e611f5288d46c94 +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME From 80a22b6262353634c434e6476622e4df6f9f601c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 26 Jan 2025 13:08:14 +0000 Subject: [PATCH 523/611] Update dependency org.apache.groovy:groovy to v4.0.25 (#4273) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 44c5fa83a9d9..7002f24e7a02 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -35,7 +35,7 @@ bndlib = { module = "biz.aQute.bnd:biz.aQute.bndlib", version.ref = "bnd" } checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checkstyle" } classgraph = { module = "io.github.classgraph:classgraph", version = "4.8.179" } commons-io = { module = "commons-io:commons-io", version = "2.18.0" } -groovy4 = { module = "org.apache.groovy:groovy", version = "4.0.24" } +groovy4 = { module = "org.apache.groovy:groovy", version = "4.0.25" } groovy2-bom = { module = "org.codehaus.groovy:groovy-bom", version = "2.5.23" } hamcrest = { module = "org.hamcrest:hamcrest", version = "3.0" } jackson-dataformat-yaml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml", version.ref = "jackson" } From 7b4b972115f800e90a8cf1afa98ae97edc778377 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sun, 26 Jan 2025 17:50:39 +0100 Subject: [PATCH 524/611] Revert to older Eclipse version to fix Spotless issue on CI --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7002f24e7a02..cfd4ea914cef 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ asciidoctor-plugins = "4.0.4" # Check if workaround in documentation.gradle.kts assertj = "3.27.3" bnd = "7.1.0" checkstyle = "10.21.1" -eclipse = "4.34.0" +eclipse = "4.32.0" jackson = "2.18.2" jacoco = "0.8.12" jmh = "1.37" From ca7bb8022fdd81546a1e053d050c5954e8679591 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sun, 26 Jan 2025 18:44:44 +0100 Subject: [PATCH 525/611] Revert "Revert to older Eclipse version to fix Spotless issue on CI" This reverts commit 7b4b972115f800e90a8cf1afa98ae97edc778377. --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index cfd4ea914cef..7002f24e7a02 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ asciidoctor-plugins = "4.0.4" # Check if workaround in documentation.gradle.kts assertj = "3.27.3" bnd = "7.1.0" checkstyle = "10.21.1" -eclipse = "4.32.0" +eclipse = "4.34.0" jackson = "2.18.2" jacoco = "0.8.12" jmh = "1.37" From 060f4db0e03f032ea4b39c042d75052deb4a5486 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sun, 26 Jan 2025 18:58:01 +0100 Subject: [PATCH 526/611] Pass enclosing instance types to `DisplayNameGenerators` (#4266) Prior to this commit, a `DisplayNameGenerator` could access the type of a `@Nested` test class as well as the enclosing class in which a `@Nested` test class is declared, but it could not access the concrete runtime type of the enclosing instance for a `@Nested` test class. When a `DisplayNameGenerator` is used to build hierarchical display names, this could lead to confusing results or even conflicting results depending on the structure of the test classes used, "conflicting" in the sense that two nested test classes may have identical display names that do not represent the runtime structure of the test classes. Now, each `DisplayNameGenerator` receives the list of enclosing instance types when computing the display name of a nested test class or test method. Resolves #4130. --------- Co-authored-by: Sam Brannen <104798+sbrannen@users.noreply.github.com> --- .../release-notes-5.12.0-M1.adoc | 5 +- .../jupiter/api/DisplayNameGenerator.java | 131 +++++++++++++++--- .../engine/descriptor/DisplayNameUtils.java | 19 +-- .../descriptor/MethodBasedTestDescriptor.java | 7 +- .../descriptor/NestedClassTestDescriptor.java | 13 +- .../descriptor/TestFactoryTestDescriptor.java | 5 +- .../descriptor/TestMethodTestDescriptor.java | 6 +- .../TestTemplateTestDescriptor.java | 5 +- .../discovery/ClassSelectorResolver.java | 7 +- .../discovery/MethodSelectorResolver.java | 26 ++-- .../api/DisplayNameGenerationTests.java | 23 ++- ...ntimeEnclosingTypeScenarioOneTestCase.java | 19 +++ ...ntimeEnclosingTypeScenarioTwoTestCase.java | 19 +++ ...SentencesRuntimeEnclosingTypeTestCase.java | 33 +++++ .../parallel/ResourceLockAnnotationTests.java | 5 +- .../CustomDisplayNameGenerator.java | 6 +- .../descriptor/DisplayNameUtilsTests.java | 30 ++-- .../descriptor/ExtensionContextTests.java | 6 +- .../JupiterTestDescriptorTests.java | 24 ++-- .../TestFactoryTestDescriptorTests.java | 3 +- ...TemplateInvocationTestDescriptorTests.java | 3 +- .../TestTemplateTestDescriptorTests.java | 7 +- 22 files changed, 305 insertions(+), 97 deletions(-) create mode 100644 jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesRuntimeEnclosingTypeScenarioOneTestCase.java create mode 100644 jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesRuntimeEnclosingTypeScenarioTwoTestCase.java create mode 100644 jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesRuntimeEnclosingTypeTestCase.java diff --git a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc index 5d6ceaea5dc0..0abbde8c9af2 100644 --- a/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc +++ b/documentation/src/docs/asciidoc/release-notes/release-notes-5.12.0-M1.adoc @@ -83,7 +83,10 @@ JUnit repository on GitHub. [[release-notes-5.12.0-M1-junit-jupiter-bug-fixes]] ==== Bug Fixes -* ❓ +* Provide _runtime_ enclosing types of `@Nested` test classes and contained test methods + to `DisplayNameGenerator` implementations. Prior to this change, such generators were + only able to access the enclosing class in which `@Nested` was declared, but they could + not access the concrete runtime type of the enclosing instance. [[release-notes-5.12.0-M1-junit-jupiter-deprecations-and-breaking-changes]] ==== Deprecations and Breaking Changes diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayNameGenerator.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayNameGenerator.java index 810d180e3da8..89f7784d8c57 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayNameGenerator.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/DisplayNameGenerator.java @@ -10,11 +10,15 @@ package org.junit.jupiter.api; +import static java.util.Collections.emptyList; +import static org.apiguardian.api.API.Status.DEPRECATED; +import static org.apiguardian.api.API.Status.EXPERIMENTAL; import static org.apiguardian.api.API.Status.STABLE; import static org.junit.platform.commons.support.AnnotationSupport.findAnnotation; import static org.junit.platform.commons.support.ModifierSupport.isStatic; import java.lang.reflect.Method; +import java.util.List; import java.util.Optional; import java.util.function.Predicate; @@ -74,7 +78,8 @@ public interface DisplayNameGenerator { /** * Generate a display name for the given top-level or {@code static} nested test class. * - *

    If it returns {@code null}, the default display name generator will be used instead. + *

    If this method returns {@code null}, the default display name + * generator will be used instead. * * @param testClass the class to generate a name for; never {@code null} * @return the display name for the class; never blank @@ -82,19 +87,52 @@ public interface DisplayNameGenerator { String generateDisplayNameForClass(Class testClass); /** - * Generate a display name for the given {@link Nested @Nested} inner test class. + * Generate a display name for the given {@link Nested @Nested} inner test + * class. * - *

    If it returns {@code null}, the default display name generator will be used instead. + *

    If this method returns {@code null}, the default display name + * generator will be used instead. * * @param nestedClass the class to generate a name for; never {@code null} * @return the display name for the nested class; never blank + * @deprecated in favor of {@link #generateDisplayNameForNestedClass(List, Class)} */ - String generateDisplayNameForNestedClass(Class nestedClass); + @API(status = DEPRECATED, since = "5.12") + @Deprecated + default String generateDisplayNameForNestedClass(Class nestedClass) { + throw new UnsupportedOperationException( + "Implement generateDisplayNameForNestedClass(List>, Class) instead"); + } + + /** + * Generate a display name for the given {@link Nested @Nested} inner test + * class. + * + *

    If this method returns {@code null}, the default display name + * generator will be used instead. + * + * @implNote The classes supplied as {@code enclosingInstanceTypes} may + * differ from the classes returned from invocations of + * {@link Class#getEnclosingClass()} — for example, when a nested test + * class is inherited from a superclass. + * + * @param enclosingInstanceTypes the runtime types of the enclosing + * instances for the test class, ordered from outermost to innermost, + * excluding {@code nestedClass}; never {@code null} + * @param nestedClass the class to generate a name for; never {@code null} + * @return the display name for the nested class; never blank + * @since 5.12 + */ + @API(status = EXPERIMENTAL, since = "5.12") + default String generateDisplayNameForNestedClass(List> enclosingInstanceTypes, Class nestedClass) { + return generateDisplayNameForNestedClass(nestedClass); + } /** * Generate a display name for the given method. * - *

    If it returns {@code null}, the default display name generator will be used instead. + *

    If this method returns {@code null}, the default display name + * generator will be used instead. * * @implNote The class instance supplied as {@code testClass} may differ from * the class returned by {@code testMethod.getDeclaringClass()} — for @@ -103,8 +141,42 @@ public interface DisplayNameGenerator { * @param testClass the class the test method is invoked on; never {@code null} * @param testMethod method to generate a display name for; never {@code null} * @return the display name for the test; never blank + * @deprecated in favor of {@link #generateDisplayNameForMethod(List, Class, Method)} */ - String generateDisplayNameForMethod(Class testClass, Method testMethod); + @API(status = DEPRECATED, since = "5.12") + @Deprecated + default String generateDisplayNameForMethod(Class testClass, Method testMethod) { + throw new UnsupportedOperationException( + "Implement generateDisplayNameForMethod(List>, Class, Method) instead"); + } + + /** + * Generate a display name for the given method. + * + *

    If this method returns {@code null}, the default display name + * generator will be used instead. + * + * @implNote The classes supplied as {@code enclosingInstanceTypes} may + * differ from the classes returned from invocations of + * {@link Class#getEnclosingClass()} — for example, when a nested test + * class is inherited from a superclass. Similarly, the class instance + * supplied as {@code testClass} may differ from the class returned by + * {@code testMethod.getDeclaringClass()} — for example, when a test + * method is inherited from a superclass. + * + * @param enclosingInstanceTypes the runtime types of the enclosing + * instances for the test class, ordered from outermost to innermost, + * excluding {@code testClass}; never {@code null} + * @param testClass the class the test method is invoked on; never {@code null} + * @param testMethod method to generate a display name for; never {@code null} + * @return the display name for the test; never blank + * @since 5.12 + */ + @API(status = EXPERIMENTAL, since = "5.12") + default String generateDisplayNameForMethod(List> enclosingInstanceTypes, Class testClass, + Method testMethod) { + return generateDisplayNameForMethod(testClass, testMethod); + } /** * Generate a string representation of the formal parameters of the supplied @@ -142,12 +214,13 @@ public String generateDisplayNameForClass(Class testClass) { } @Override - public String generateDisplayNameForNestedClass(Class nestedClass) { + public String generateDisplayNameForNestedClass(List> enclosingInstanceTypes, Class nestedClass) { return nestedClass.getSimpleName(); } @Override - public String generateDisplayNameForMethod(Class testClass, Method testMethod) { + public String generateDisplayNameForMethod(List> enclosingInstanceTypes, Class testClass, + Method testMethod) { return testMethod.getName() + parameterTypesAsString(testMethod); } } @@ -168,7 +241,8 @@ public Simple() { } @Override - public String generateDisplayNameForMethod(Class testClass, Method testMethod) { + public String generateDisplayNameForMethod(List> enclosingInstanceTypes, Class testClass, + Method testMethod) { String displayName = testMethod.getName(); if (hasParameters(testMethod)) { displayName += ' ' + parameterTypesAsString(testMethod); @@ -202,13 +276,15 @@ public String generateDisplayNameForClass(Class testClass) { } @Override - public String generateDisplayNameForNestedClass(Class nestedClass) { - return replaceUnderscores(super.generateDisplayNameForNestedClass(nestedClass)); + public String generateDisplayNameForNestedClass(List> enclosingInstanceTypes, Class nestedClass) { + return replaceUnderscores(super.generateDisplayNameForNestedClass(enclosingInstanceTypes, nestedClass)); } @Override - public String generateDisplayNameForMethod(Class testClass, Method testMethod) { - return replaceUnderscores(super.generateDisplayNameForMethod(testClass, testMethod)); + public String generateDisplayNameForMethod(List> enclosingInstanceTypes, Class testClass, + Method testMethod) { + return replaceUnderscores( + super.generateDisplayNameForMethod(enclosingInstanceTypes, testClass, testMethod)); } private static String replaceUnderscores(String name) { @@ -243,18 +319,21 @@ public String generateDisplayNameForClass(Class testClass) { } @Override - public String generateDisplayNameForNestedClass(Class nestedClass) { - return getSentenceBeginning(nestedClass); + public String generateDisplayNameForNestedClass(List> enclosingInstanceTypes, Class nestedClass) { + return getSentenceBeginning(enclosingInstanceTypes, nestedClass); } @Override - public String generateDisplayNameForMethod(Class testClass, Method testMethod) { - return getSentenceBeginning(testClass) + getFragmentSeparator(testClass) - + getGeneratorFor(testClass).generateDisplayNameForMethod(testClass, testMethod); + public String generateDisplayNameForMethod(List> enclosingInstanceTypes, Class testClass, + Method testMethod) { + return getSentenceBeginning(enclosingInstanceTypes, testClass) + getFragmentSeparator(testClass) + + getGeneratorFor(testClass).generateDisplayNameForMethod(enclosingInstanceTypes, testClass, + testMethod); } - private String getSentenceBeginning(Class testClass) { - Class enclosingClass = testClass.getEnclosingClass(); + private String getSentenceBeginning(List> enclosingInstanceTypes, Class testClass) { + Class enclosingClass = enclosingInstanceTypes.isEmpty() ? null + : enclosingInstanceTypes.get(enclosingInstanceTypes.size() - 1); boolean topLevelTestClass = (enclosingClass == null || isStatic(testClass)); Optional displayName = findAnnotation(testClass, DisplayName.class)// .map(DisplayName::value).map(String::trim); @@ -280,10 +359,16 @@ private String getSentenceBeginning(Class testClass) { .filter(IndicativeSentences.class::equals)// .isPresent(); - String prefix = (buildPrefix ? getSentenceBeginning(enclosingClass) + getFragmentSeparator(testClass) : ""); + List> remainingEnclosingInstanceTypes = enclosingInstanceTypes.isEmpty() ? emptyList() + : enclosingInstanceTypes.subList(0, enclosingInstanceTypes.size() - 1); + + String prefix = (buildPrefix + ? getSentenceBeginning(remainingEnclosingInstanceTypes, enclosingClass) + + getFragmentSeparator(testClass) + : ""); - return prefix + displayName.orElseGet( - () -> getGeneratorFor(testClass).generateDisplayNameForNestedClass(testClass)); + return prefix + displayName.orElseGet(() -> getGeneratorFor(testClass).generateDisplayNameForNestedClass( + remainingEnclosingInstanceTypes, testClass)); } /** diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DisplayNameUtils.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DisplayNameUtils.java index ebe3d127bf0c..76b65ef5e49a 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DisplayNameUtils.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/DisplayNameUtils.java @@ -14,6 +14,7 @@ import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; +import java.util.List; import java.util.Optional; import java.util.function.Function; import java.util.function.Supplier; @@ -89,10 +90,10 @@ static String determineDisplayName(AnnotatedElement element, Supplier di return displayNameSupplier.get(); } - static String determineDisplayNameForMethod(Class testClass, Method testMethod, - JupiterConfiguration configuration) { + static String determineDisplayNameForMethod(Supplier>> enclosingInstanceTypes, Class testClass, + Method testMethod, JupiterConfiguration configuration) { return determineDisplayName(testMethod, - createDisplayNameSupplierForMethod(testClass, testMethod, configuration)); + createDisplayNameSupplierForMethod(enclosingInstanceTypes, testClass, testMethod, configuration)); } static Supplier createDisplayNameSupplierForClass(Class testClass, JupiterConfiguration configuration) { @@ -100,16 +101,16 @@ static Supplier createDisplayNameSupplierForClass(Class testClass, Ju generator -> generator.generateDisplayNameForClass(testClass)); } - static Supplier createDisplayNameSupplierForNestedClass(Class testClass, - JupiterConfiguration configuration) { + static Supplier createDisplayNameSupplierForNestedClass(Supplier>> enclosingInstanceTypes, + Class testClass, JupiterConfiguration configuration) { return createDisplayNameSupplier(testClass, configuration, - generator -> generator.generateDisplayNameForNestedClass(testClass)); + generator -> generator.generateDisplayNameForNestedClass(enclosingInstanceTypes.get(), testClass)); } - private static Supplier createDisplayNameSupplierForMethod(Class testClass, Method testMethod, - JupiterConfiguration configuration) { + private static Supplier createDisplayNameSupplierForMethod(Supplier>> enclosingInstanceTypes, + Class testClass, Method testMethod, JupiterConfiguration configuration) { return createDisplayNameSupplier(testClass, configuration, - generator -> generator.generateDisplayNameForMethod(testClass, testMethod)); + generator -> generator.generateDisplayNameForMethod(enclosingInstanceTypes.get(), testClass, testMethod)); } private static Supplier createDisplayNameSupplier(Class testClass, JupiterConfiguration configuration, diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodBasedTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodBasedTestDescriptor.java index 525b58293709..52bf3c4ef8b9 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodBasedTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/MethodBasedTestDescriptor.java @@ -21,6 +21,7 @@ import java.util.Optional; import java.util.Set; import java.util.function.Consumer; +import java.util.function.Supplier; import org.apiguardian.api.API; import org.junit.jupiter.api.extension.ExtensionContext; @@ -59,9 +60,9 @@ public abstract class MethodBasedTestDescriptor extends JupiterTestDescriptor im private final Set tags; MethodBasedTestDescriptor(UniqueId uniqueId, Class testClass, Method testMethod, - JupiterConfiguration configuration) { - this(uniqueId, determineDisplayNameForMethod(testClass, testMethod, configuration), testClass, testMethod, - configuration); + Supplier>> enclosingInstanceTypes, JupiterConfiguration configuration) { + this(uniqueId, determineDisplayNameForMethod(enclosingInstanceTypes, testClass, testMethod, configuration), + testClass, testMethod, configuration); } MethodBasedTestDescriptor(UniqueId uniqueId, String displayName, Class testClass, Method testMethod, diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/NestedClassTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/NestedClassTestDescriptor.java index 6d4dc1e2d088..72d11ce5b09e 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/NestedClassTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/NestedClassTestDescriptor.java @@ -19,6 +19,7 @@ import java.util.List; import java.util.Optional; import java.util.Set; +import java.util.function.Supplier; import org.apiguardian.api.API; import org.junit.jupiter.api.extension.TestInstances; @@ -46,8 +47,10 @@ public class NestedClassTestDescriptor extends ClassBasedTestDescriptor { public static final String SEGMENT_TYPE = "nested-class"; - public NestedClassTestDescriptor(UniqueId uniqueId, Class testClass, JupiterConfiguration configuration) { - super(uniqueId, testClass, createDisplayNameSupplierForNestedClass(testClass, configuration), configuration); + public NestedClassTestDescriptor(UniqueId uniqueId, Class testClass, + Supplier>> enclosingInstanceTypes, JupiterConfiguration configuration) { + super(uniqueId, testClass, + createDisplayNameSupplierForNestedClass(enclosingInstanceTypes, testClass, configuration), configuration); } // --- TestDescriptor ------------------------------------------------------ @@ -62,7 +65,11 @@ public final Set getTags() { @Override public List> getEnclosingTestClasses() { - TestDescriptor parent = getParent().orElse(null); + return getEnclosingTestClasses(getParent().orElse(null)); + } + + @API(status = INTERNAL, since = "5.12") + public static List> getEnclosingTestClasses(TestDescriptor parent) { if (parent instanceof ClassBasedTestDescriptor) { ClassBasedTestDescriptor parentClassDescriptor = (ClassBasedTestDescriptor) parent; List> result = new ArrayList<>(parentClassDescriptor.getEnclosingTestClasses()); diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestFactoryTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestFactoryTestDescriptor.java index e4643baa54de..f0d37814bbf2 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestFactoryTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestFactoryTestDescriptor.java @@ -18,6 +18,7 @@ import java.lang.reflect.Method; import java.net.URI; import java.util.Iterator; +import java.util.List; import java.util.Optional; import java.util.function.Supplier; import java.util.stream.Stream; @@ -63,8 +64,8 @@ public class TestFactoryTestDescriptor extends TestMethodTestDescriptor implemen private final DynamicDescendantFilter dynamicDescendantFilter = new DynamicDescendantFilter(); public TestFactoryTestDescriptor(UniqueId uniqueId, Class testClass, Method testMethod, - JupiterConfiguration configuration) { - super(uniqueId, testClass, testMethod, configuration); + Supplier>> enclosingInstanceTypes, JupiterConfiguration configuration) { + super(uniqueId, testClass, testMethod, enclosingInstanceTypes, configuration); } // --- Filterable ---------------------------------------------------------- diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestMethodTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestMethodTestDescriptor.java index 423f2e3b9013..67fa136a52d1 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestMethodTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestMethodTestDescriptor.java @@ -17,6 +17,8 @@ import static org.junit.platform.commons.util.CollectionUtils.forEachInReverseOrder; import java.lang.reflect.Method; +import java.util.List; +import java.util.function.Supplier; import org.apiguardian.api.API; import org.junit.jupiter.api.TestInstance.Lifecycle; @@ -75,8 +77,8 @@ public class TestMethodTestDescriptor extends MethodBasedTestDescriptor { private final ReflectiveInterceptorCall interceptorCall; public TestMethodTestDescriptor(UniqueId uniqueId, Class testClass, Method testMethod, - JupiterConfiguration configuration) { - super(uniqueId, testClass, testMethod, configuration); + Supplier>> enclosingInstanceTypes, JupiterConfiguration configuration) { + super(uniqueId, testClass, testMethod, enclosingInstanceTypes, configuration); this.interceptorCall = defaultInterceptorCall; } diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java index f89c17b26a32..e592ba3a6326 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptor.java @@ -18,6 +18,7 @@ import java.util.List; import java.util.Optional; import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Supplier; import java.util.stream.Stream; import org.apiguardian.api.API; @@ -46,8 +47,8 @@ public class TestTemplateTestDescriptor extends MethodBasedTestDescriptor implem private final DynamicDescendantFilter dynamicDescendantFilter = new DynamicDescendantFilter(); public TestTemplateTestDescriptor(UniqueId uniqueId, Class testClass, Method templateMethod, - JupiterConfiguration configuration) { - super(uniqueId, testClass, templateMethod, configuration); + Supplier>> enclosingInstanceTypes, JupiterConfiguration configuration) { + super(uniqueId, testClass, templateMethod, enclosingInstanceTypes, configuration); } // --- Filterable ---------------------------------------------------------- diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassSelectorResolver.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassSelectorResolver.java index 46d97088c358..0f809dcbde47 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassSelectorResolver.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/ClassSelectorResolver.java @@ -12,6 +12,7 @@ import static java.util.function.Predicate.isEqual; import static java.util.stream.Collectors.toCollection; +import static org.junit.jupiter.engine.descriptor.NestedClassTestDescriptor.getEnclosingTestClasses; import static org.junit.jupiter.engine.discovery.predicates.IsTestClassWithTests.isTestOrTestFactoryOrTestTemplateMethod; import static org.junit.platform.commons.support.HierarchyTraversalMode.TOP_DOWN; import static org.junit.platform.commons.support.ReflectionSupport.findMethods; @@ -122,9 +123,9 @@ private ClassTestDescriptor newClassTestDescriptor(TestDescriptor parent, Class< } private NestedClassTestDescriptor newNestedClassTestDescriptor(TestDescriptor parent, Class testClass) { - return new NestedClassTestDescriptor( - parent.getUniqueId().append(NestedClassTestDescriptor.SEGMENT_TYPE, testClass.getSimpleName()), testClass, - configuration); + UniqueId uniqueId = parent.getUniqueId().append(NestedClassTestDescriptor.SEGMENT_TYPE, + testClass.getSimpleName()); + return new NestedClassTestDescriptor(uniqueId, testClass, () -> getEnclosingTestClasses(parent), configuration); } private Resolution toResolution(Optional testDescriptor) { diff --git a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodSelectorResolver.java b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodSelectorResolver.java index 7f76e2d30fce..9d5af96aa103 100644 --- a/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodSelectorResolver.java +++ b/junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/discovery/MethodSelectorResolver.java @@ -166,8 +166,8 @@ private enum MethodType { TEST(new IsTestMethod(), TestMethodTestDescriptor.SEGMENT_TYPE) { @Override protected TestDescriptor createTestDescriptor(UniqueId uniqueId, Class testClass, Method method, - JupiterConfiguration configuration) { - return new TestMethodTestDescriptor(uniqueId, testClass, method, configuration); + Supplier>> enclosingInstanceTypes, JupiterConfiguration configuration) { + return new TestMethodTestDescriptor(uniqueId, testClass, method, enclosingInstanceTypes, configuration); } }, @@ -176,8 +176,9 @@ protected TestDescriptor createTestDescriptor(UniqueId uniqueId, Class testCl TestFactoryTestDescriptor.DYNAMIC_TEST_SEGMENT_TYPE) { @Override protected TestDescriptor createTestDescriptor(UniqueId uniqueId, Class testClass, Method method, - JupiterConfiguration configuration) { - return new TestFactoryTestDescriptor(uniqueId, testClass, method, configuration); + Supplier>> enclosingInstanceTypes, JupiterConfiguration configuration) { + return new TestFactoryTestDescriptor(uniqueId, testClass, method, enclosingInstanceTypes, + configuration); } }, @@ -185,8 +186,9 @@ protected TestDescriptor createTestDescriptor(UniqueId uniqueId, Class testCl TestTemplateInvocationTestDescriptor.SEGMENT_TYPE) { @Override protected TestDescriptor createTestDescriptor(UniqueId uniqueId, Class testClass, Method method, - JupiterConfiguration configuration) { - return new TestTemplateTestDescriptor(uniqueId, testClass, method, configuration); + Supplier>> enclosingInstanceTypes, JupiterConfiguration configuration) { + return new TestTemplateTestDescriptor(uniqueId, testClass, method, enclosingInstanceTypes, + configuration); } }; @@ -207,7 +209,7 @@ private Optional resolve(List> enclosingClasses, Class< } return context.addToParent(() -> selectClass(enclosingClasses, testClass), // parent -> Optional.of( - createTestDescriptor(createUniqueId(method, parent), testClass, method, configuration))); + createTestDescriptor((ClassBasedTestDescriptor) parent, testClass, method, configuration))); } private DiscoverySelector selectClass(List> enclosingClasses, Class testClass) { @@ -227,7 +229,7 @@ private Optional resolveUniqueIdIntoTestDescriptor(UniqueId uniq // @formatter:off return methodFinder.findMethod(methodSpecPart, testClass) .filter(methodPredicate) - .map(method -> createTestDescriptor(createUniqueId(method, parent), testClass, method, configuration)); + .map(method -> createTestDescriptor((ClassBasedTestDescriptor) parent, testClass, method, configuration)); // @formatter:on }); } @@ -237,6 +239,12 @@ private Optional resolveUniqueIdIntoTestDescriptor(UniqueId uniq return Optional.empty(); } + private TestDescriptor createTestDescriptor(ClassBasedTestDescriptor parent, Class testClass, Method method, + JupiterConfiguration configuration) { + UniqueId uniqueId = createUniqueId(method, parent); + return createTestDescriptor(uniqueId, testClass, method, parent::getEnclosingTestClasses, configuration); + } + private UniqueId createUniqueId(Method method, TestDescriptor parent) { String methodId = String.format("%s(%s)", method.getName(), ClassUtils.nullSafeToString(method.getParameterTypes())); @@ -244,7 +252,7 @@ private UniqueId createUniqueId(Method method, TestDescriptor parent) { } protected abstract TestDescriptor createTestDescriptor(UniqueId uniqueId, Class testClass, Method method, - JupiterConfiguration configuration); + Supplier>> enclosingInstanceTypes, JupiterConfiguration configuration); } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationTests.java index 8dbea0cdb42d..c7a1fe90efc6 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/DisplayNameGenerationTests.java @@ -20,6 +20,7 @@ import java.lang.reflect.Method; import java.util.EmptyStackException; +import java.util.List; import java.util.Stack; import org.junit.jupiter.engine.AbstractJupiterTestEngineTests; @@ -197,6 +198,23 @@ void indicativeSentencesGenerationInheritance() { ); } + @Test + void indicativeSentencesRuntimeEnclosingType() { + check(IndicativeSentencesRuntimeEnclosingTypeScenarioOneTestCase.class, // + "CONTAINER: Scenario 1", // + "CONTAINER: Scenario 1 -> Level 1", // + "CONTAINER: Scenario 1 -> Level 1 -> Level 2", // + "TEST: Scenario 1 -> Level 1 -> Level 2 -> this is a test"// + ); + + check(IndicativeSentencesRuntimeEnclosingTypeScenarioTwoTestCase.class, // + "CONTAINER: Scenario 2", // + "CONTAINER: Scenario 2 -> Level 1", // + "CONTAINER: Scenario 2 -> Level 1 -> Level 2", // + "TEST: Scenario 2 -> Level 1 -> Level 2 -> this is a test"// + ); + } + private void check(Class testClass, String... expectedDisplayNames) { var request = request().selectors(selectClass(testClass)).build(); var descriptors = discoverTests(request).getDescendants(); @@ -217,12 +235,13 @@ public String generateDisplayNameForClass(Class testClass) { } @Override - public String generateDisplayNameForNestedClass(Class nestedClass) { + public String generateDisplayNameForNestedClass(List> enclosingInstanceTypes, Class nestedClass) { return "nn"; } @Override - public String generateDisplayNameForMethod(Class testClass, Method testMethod) { + public String generateDisplayNameForMethod(List> enclosingInstanceTypes, Class testClass, + Method testMethod) { return "nn"; } } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesRuntimeEnclosingTypeScenarioOneTestCase.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesRuntimeEnclosingTypeScenarioOneTestCase.java new file mode 100644 index 000000000000..927903c14612 --- /dev/null +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesRuntimeEnclosingTypeScenarioOneTestCase.java @@ -0,0 +1,19 @@ +/* + * Copyright 2015-2025 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.api; + +/** + * @since 5.12 + */ +@DisplayName("Scenario 1") +class IndicativeSentencesRuntimeEnclosingTypeScenarioOneTestCase + extends IndicativeSentencesRuntimeEnclosingTypeTestCase { +} diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesRuntimeEnclosingTypeScenarioTwoTestCase.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesRuntimeEnclosingTypeScenarioTwoTestCase.java new file mode 100644 index 000000000000..c6e2f377db10 --- /dev/null +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesRuntimeEnclosingTypeScenarioTwoTestCase.java @@ -0,0 +1,19 @@ +/* + * Copyright 2015-2025 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.api; + +/** + * @since 5.12 + */ +@DisplayName("Scenario 2") +class IndicativeSentencesRuntimeEnclosingTypeScenarioTwoTestCase + extends IndicativeSentencesRuntimeEnclosingTypeTestCase { +} diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesRuntimeEnclosingTypeTestCase.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesRuntimeEnclosingTypeTestCase.java new file mode 100644 index 000000000000..86244f4cbfcc --- /dev/null +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/IndicativeSentencesRuntimeEnclosingTypeTestCase.java @@ -0,0 +1,33 @@ +/* + * Copyright 2015-2025 the original author or authors. + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License v2.0 which + * accompanies this distribution and is available at + * + * https://www.eclipse.org/legal/epl-v20.html + */ + +package org.junit.jupiter.api; + +import org.junit.jupiter.api.DisplayNameGenerator.ReplaceUnderscores; + +/** + * @since 5.12 + */ +@DisplayName("Base Scenario") +@IndicativeSentencesGeneration(separator = " -> ", generator = ReplaceUnderscores.class) +abstract class IndicativeSentencesRuntimeEnclosingTypeTestCase { + + @Nested + class Level_1 { + + @Nested + class Level_2 { + + @Test + void this_is_a_test() { + } + } + } +} diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/ResourceLockAnnotationTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/ResourceLockAnnotationTests.java index 2025c6e0ad49..b095a8d28e7c 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/ResourceLockAnnotationTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/api/parallel/ResourceLockAnnotationTests.java @@ -20,6 +20,7 @@ import static org.mockito.Mockito.when; import java.lang.reflect.Method; +import java.util.List; import java.util.Set; import java.util.stream.Stream; @@ -255,7 +256,7 @@ private ClassTestDescriptor getClassTestDescriptor(Class testClass) { private Set getMethodResources(Class testClass) { var descriptor = new TestMethodTestDescriptor( // - uniqueId, testClass, getDeclaredTestMethod(testClass), configuration // + uniqueId, testClass, getDeclaredTestMethod(testClass), List::of, configuration // ); descriptor.setParent(getClassTestDescriptor(testClass)); return descriptor.getExclusiveResources(); @@ -271,7 +272,7 @@ private static Method getDeclaredTestMethod(Class testClass) { } private Set getNestedClassResources(Class testClass) { - var descriptor = new NestedClassTestDescriptor(uniqueId, testClass, configuration); + var descriptor = new NestedClassTestDescriptor(uniqueId, testClass, List::of, configuration); descriptor.setParent(getClassTestDescriptor(testClass.getEnclosingClass())); return descriptor.getExclusiveResources(); } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/CustomDisplayNameGenerator.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/CustomDisplayNameGenerator.java index f7b8afae102c..6b00ad5b9282 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/CustomDisplayNameGenerator.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/CustomDisplayNameGenerator.java @@ -11,6 +11,7 @@ package org.junit.jupiter.engine.descriptor; import java.lang.reflect.Method; +import java.util.List; import org.junit.jupiter.api.DisplayNameGenerator; @@ -22,12 +23,13 @@ public String generateDisplayNameForClass(Class testClass) { } @Override - public String generateDisplayNameForNestedClass(Class nestedClass) { + public String generateDisplayNameForNestedClass(List> enclosingInstanceTypes, Class nestedClass) { return "nested-class-display-name"; } @Override - public String generateDisplayNameForMethod(Class testClass, Method testMethod) { + public String generateDisplayNameForMethod(List> enclosingInstanceTypes, Class testClass, + Method testMethod) { return "method-display-name"; } } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/DisplayNameUtilsTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/DisplayNameUtilsTests.java index a5d019e1f95a..7a9ca9a4a165 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/DisplayNameUtilsTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/DisplayNameUtilsTests.java @@ -15,6 +15,7 @@ import static org.mockito.Mockito.when; import java.lang.reflect.Method; +import java.util.List; import java.util.function.Supplier; import java.util.logging.Level; import java.util.logging.LogRecord; @@ -70,7 +71,7 @@ void shouldGetDisplayNameFromSupplierIfNoDisplayNameAnnotationPresent() { @Nested class ClassDisplayNameSupplierTests { - private JupiterConfiguration configuration = mock(); + private final JupiterConfiguration configuration = mock(); @Test void shouldGetDisplayNameFromDisplayNameGenerationAnnotation() { @@ -115,12 +116,12 @@ void shouldFallbackOnDefaultDisplayNameGeneratorWhenNullIsGenerated() { @Nested class NestedClassDisplayNameTests { - private JupiterConfiguration configuration = mock(); + private final JupiterConfiguration configuration = mock(); @Test void shouldGetDisplayNameFromDisplayNameGenerationAnnotation() { when(configuration.getDefaultDisplayNameGenerator()).thenReturn(new CustomDisplayNameGenerator()); - Supplier displayName = DisplayNameUtils.createDisplayNameSupplierForNestedClass( + Supplier displayName = DisplayNameUtils.createDisplayNameSupplierForNestedClass(List::of, StandardDisplayNameTestCase.class, configuration); assertThat(displayName.get()).isEqualTo(StandardDisplayNameTestCase.class.getSimpleName()); @@ -129,7 +130,7 @@ void shouldGetDisplayNameFromDisplayNameGenerationAnnotation() { @Test void shouldGetDisplayNameFromDefaultDisplayNameGenerator() { when(configuration.getDefaultDisplayNameGenerator()).thenReturn(new CustomDisplayNameGenerator()); - Supplier displayName = DisplayNameUtils.createDisplayNameSupplierForNestedClass( + Supplier displayName = DisplayNameUtils.createDisplayNameSupplierForNestedClass(List::of, NestedTestCase.class, configuration); assertThat(displayName.get()).isEqualTo("nested-class-display-name"); @@ -138,7 +139,7 @@ void shouldGetDisplayNameFromDefaultDisplayNameGenerator() { @Test void shouldFallbackOnDefaultDisplayNameGeneratorWhenNullIsGenerated() { when(configuration.getDefaultDisplayNameGenerator()).thenReturn(new CustomDisplayNameGenerator()); - Supplier displayName = DisplayNameUtils.createDisplayNameSupplierForNestedClass( + Supplier displayName = DisplayNameUtils.createDisplayNameSupplierForNestedClass(List::of, NullDisplayNameTestCase.NestedTestCase.class, configuration); assertThat(displayName.get()).isEqualTo("nested-class-display-name"); @@ -148,14 +149,14 @@ void shouldFallbackOnDefaultDisplayNameGeneratorWhenNullIsGenerated() { @Nested class MethodDisplayNameTests { - private JupiterConfiguration configuration = mock(); + private final JupiterConfiguration configuration = mock(); @Test void shouldGetDisplayNameFromDisplayNameGenerationAnnotation() throws Exception { when(configuration.getDefaultDisplayNameGenerator()).thenReturn(new CustomDisplayNameGenerator()); Method method = MyTestCase.class.getDeclaredMethod("test1"); - String displayName = DisplayNameUtils.determineDisplayNameForMethod(StandardDisplayNameTestCase.class, - method, configuration); + String displayName = DisplayNameUtils.determineDisplayNameForMethod(List::of, + StandardDisplayNameTestCase.class, method, configuration); assertThat(displayName).isEqualTo("test1()"); } @@ -165,8 +166,8 @@ void shouldGetDisplayNameFromDefaultNameGenerator() throws Exception { Method method = MyTestCase.class.getDeclaredMethod("test1"); when(configuration.getDefaultDisplayNameGenerator()).thenReturn(new CustomDisplayNameGenerator()); - String displayName = DisplayNameUtils.determineDisplayNameForMethod(NotDisplayNameTestCase.class, method, - configuration); + String displayName = DisplayNameUtils.determineDisplayNameForMethod(List::of, NotDisplayNameTestCase.class, + method, configuration); assertThat(displayName).isEqualTo("method-display-name"); } @@ -176,8 +177,8 @@ void shouldFallbackOnDefaultDisplayNameGeneratorWhenNullIsGenerated() throws Exc Method method = NullDisplayNameTestCase.class.getDeclaredMethod("test"); when(configuration.getDefaultDisplayNameGenerator()).thenReturn(new CustomDisplayNameGenerator()); - String displayName = DisplayNameUtils.determineDisplayNameForMethod(NullDisplayNameTestCase.class, method, - configuration); + String displayName = DisplayNameUtils.determineDisplayNameForMethod(List::of, NullDisplayNameTestCase.class, + method, configuration); assertThat(displayName).isEqualTo("method-display-name"); } @@ -238,12 +239,13 @@ public String generateDisplayNameForClass(Class testClass) { } @Override - public String generateDisplayNameForNestedClass(Class nestedClass) { + public String generateDisplayNameForNestedClass(List> enclosingInstanceTypes, Class nestedClass) { return null; } @Override - public String generateDisplayNameForMethod(Class testClass, Method testMethod) { + public String generateDisplayNameForMethod(List> enclosingInstanceTypes, Class testClass, + Method testMethod) { return null; } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java index 482290a3c559..66796f302620 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/ExtensionContextTests.java @@ -418,7 +418,7 @@ void configurationParameter(Function { var method = ReflectionSupport.findMethod(testClass, "extensionContextFactories").orElseThrow(); var methodUniqueId = UniqueId.parse("[engine:junit-jupiter]/[class:MyClass]/[method:myMethod]"); - var methodTestDescriptor = new TestMethodTestDescriptor(methodUniqueId, testClass, method, + var methodTestDescriptor = new TestMethodTestDescriptor(methodUniqueId, testClass, method, List::of, configuration); return new MethodExtensionContext(null, null, methodTestDescriptor, configuration, extensionRegistry, null); @@ -428,7 +428,7 @@ void configurationParameter(Function testClass = TestCase.class; Method testMethod = testClass.getDeclaredMethod("test"); - TestMethodTestDescriptor descriptor = new TestMethodTestDescriptor(uniqueId, testClass, testMethod, + TestMethodTestDescriptor descriptor = new TestMethodTestDescriptor(uniqueId, testClass, testMethod, List::of, configuration); assertEquals(uniqueId, descriptor.getUniqueId()); @@ -127,7 +127,7 @@ void constructFromMethodWithAnnotations() throws Exception { JupiterTestDescriptor classDescriptor = new ClassTestDescriptor(uniqueId, TestCase.class, configuration); Method testMethod = TestCase.class.getDeclaredMethod("foo"); TestMethodTestDescriptor methodDescriptor = new TestMethodTestDescriptor(uniqueId, TestCase.class, testMethod, - configuration); + List::of, configuration); classDescriptor.addChild(methodDescriptor); assertEquals(testMethod, methodDescriptor.getTestMethod()); @@ -143,7 +143,7 @@ void constructFromMethodWithAnnotations() throws Exception { void constructFromMethodWithCustomTestAnnotation() throws Exception { Method testMethod = TestCase.class.getDeclaredMethod("customTestAnnotation"); TestMethodTestDescriptor descriptor = new TestMethodTestDescriptor(uniqueId, TestCase.class, testMethod, - configuration); + List::of, configuration); assertEquals(testMethod, descriptor.getTestMethod()); assertEquals("custom name", descriptor.getDisplayName(), "display name:"); @@ -155,7 +155,7 @@ void constructFromMethodWithCustomTestAnnotation() throws Exception { void constructFromMethodWithParameters() throws Exception { Method testMethod = TestCase.class.getDeclaredMethod("test", String.class, BigDecimal.class); TestMethodTestDescriptor descriptor = new TestMethodTestDescriptor(uniqueId, TestCase.class, testMethod, - configuration); + List::of, configuration); assertEquals(testMethod, descriptor.getTestMethod()); assertEquals("test(String, BigDecimal)", descriptor.getDisplayName(), "display name"); @@ -166,7 +166,7 @@ void constructFromMethodWithParameters() throws Exception { void constructFromMethodWithPrimitiveArrayParameter() throws Exception { Method testMethod = TestCase.class.getDeclaredMethod("test", int[].class); TestMethodTestDescriptor descriptor = new TestMethodTestDescriptor(uniqueId, TestCase.class, testMethod, - configuration); + List::of, configuration); assertEquals(testMethod, descriptor.getTestMethod()); assertEquals("test(int[])", descriptor.getDisplayName(), "display name"); @@ -177,7 +177,7 @@ void constructFromMethodWithPrimitiveArrayParameter() throws Exception { void constructFromMethodWithObjectArrayParameter() throws Exception { Method testMethod = TestCase.class.getDeclaredMethod("test", String[].class); TestMethodTestDescriptor descriptor = new TestMethodTestDescriptor(uniqueId, TestCase.class, testMethod, - configuration); + List::of, configuration); assertEquals(testMethod, descriptor.getTestMethod()); assertEquals("test(String[])", descriptor.getDisplayName(), "display name"); @@ -188,7 +188,7 @@ void constructFromMethodWithObjectArrayParameter() throws Exception { void constructFromMethodWithMultidimensionalPrimitiveArrayParameter() throws Exception { Method testMethod = TestCase.class.getDeclaredMethod("test", int[][][][][].class); TestMethodTestDescriptor descriptor = new TestMethodTestDescriptor(uniqueId, TestCase.class, testMethod, - configuration); + List::of, configuration); assertEquals(testMethod, descriptor.getTestMethod()); assertEquals("test(int[][][][][])", descriptor.getDisplayName(), "display name"); @@ -199,7 +199,7 @@ void constructFromMethodWithMultidimensionalPrimitiveArrayParameter() throws Exc void constructFromMethodWithMultidimensionalObjectArrayParameter() throws Exception { Method testMethod = TestCase.class.getDeclaredMethod("test", String[][][][][].class); TestMethodTestDescriptor descriptor = new TestMethodTestDescriptor(uniqueId, TestCase.class, testMethod, - configuration); + List::of, configuration); assertEquals(testMethod, descriptor.getTestMethod()); assertEquals("test(String[][][][][])", descriptor.getDisplayName(), "display name"); @@ -210,7 +210,7 @@ void constructFromMethodWithMultidimensionalObjectArrayParameter() throws Except void constructFromInheritedMethod() throws Exception { Method testMethod = ConcreteTestCase.class.getMethod("theTest"); TestMethodTestDescriptor descriptor = new TestMethodTestDescriptor(uniqueId, ConcreteTestCase.class, testMethod, - configuration); + List::of, configuration); assertEquals(testMethod, descriptor.getTestMethod()); @@ -230,7 +230,7 @@ void shouldTakeCustomMethodNameDescriptorFromConfigurationIfPresent() { assertEquals("class-display-name", descriptor.getDisplayName()); assertEquals(getClass().getName(), descriptor.getLegacyReportingName()); - descriptor = new NestedClassTestDescriptor(uniqueId, NestedTestCase.class, configuration); + descriptor = new NestedClassTestDescriptor(uniqueId, NestedTestCase.class, List::of, configuration); assertEquals("nested-class-display-name", descriptor.getDisplayName()); assertEquals(NestedTestCase.class.getName(), descriptor.getLegacyReportingName()); @@ -249,7 +249,7 @@ void defaultDisplayNamesForTestClasses() { assertEquals(getClass().getSimpleName(), descriptor.getDisplayName()); assertEquals(getClass().getName(), descriptor.getLegacyReportingName()); - descriptor = new NestedClassTestDescriptor(uniqueId, NestedTestCase.class, configuration); + descriptor = new NestedClassTestDescriptor(uniqueId, NestedTestCase.class, List::of, configuration); assertEquals(NestedTestCase.class.getSimpleName(), descriptor.getDisplayName()); assertEquals(NestedTestCase.class.getName(), descriptor.getLegacyReportingName()); @@ -269,7 +269,7 @@ void enclosingClassesAreDerivedFromParent() { ClassBasedTestDescriptor parentDescriptor = new ClassTestDescriptor(uniqueId, StaticTestCase.class, configuration); ClassBasedTestDescriptor nestedDescriptor = new NestedClassTestDescriptor(uniqueId, NestedTestCase.class, - configuration); + List::of, configuration); assertThat(parentDescriptor.getEnclosingTestClasses()).isEmpty(); assertThat(nestedDescriptor.getEnclosingTestClasses()).isEmpty(); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestFactoryTestDescriptorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestFactoryTestDescriptorTests.java index 618d290870d2..6ad584b728df 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestFactoryTestDescriptorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestFactoryTestDescriptorTests.java @@ -18,6 +18,7 @@ import java.io.File; import java.lang.reflect.Method; import java.net.URI; +import java.util.List; import java.util.Optional; import java.util.stream.Stream; @@ -147,7 +148,7 @@ void before() throws Exception { Method testMethod = CustomStreamTestCase.class.getDeclaredMethod("customStream"); descriptor = new TestFactoryTestDescriptor(UniqueId.forEngine("engine"), CustomStreamTestCase.class, - testMethod, jupiterConfiguration); + testMethod, List::of, jupiterConfiguration); when(extensionContext.getTestMethod()).thenReturn(Optional.of(testMethod)); } diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestTemplateInvocationTestDescriptorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestTemplateInvocationTestDescriptorTests.java index 0491150abb57..65b2bf268688 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestTemplateInvocationTestDescriptorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestTemplateInvocationTestDescriptorTests.java @@ -16,6 +16,7 @@ import static org.mockito.Mockito.when; import java.lang.reflect.Method; +import java.util.List; import org.junit.jupiter.api.DisplayNameGenerator; import org.junit.jupiter.api.Test; @@ -34,7 +35,7 @@ void invocationsDoNotDeclareExclusiveResources() throws Exception { JupiterConfiguration configuration = mock(); when(configuration.getDefaultDisplayNameGenerator()).thenReturn(new DisplayNameGenerator.Standard()); TestTemplateTestDescriptor parent = new TestTemplateTestDescriptor(UniqueId.root("segment", "template"), - testClass, testTemplateMethod, configuration); + testClass, testTemplateMethod, List::of, configuration); TestTemplateInvocationContext invocationContext = mock(); when(invocationContext.getDisplayName(anyInt())).thenReturn("invocation"); diff --git a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptorTests.java b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptorTests.java index 1cd492db23ce..c0dab4d6a66e 100644 --- a/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptorTests.java +++ b/jupiter-tests/src/test/java/org/junit/jupiter/engine/descriptor/TestTemplateTestDescriptorTests.java @@ -15,6 +15,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import java.util.List; import java.util.Set; import org.junit.jupiter.api.DisplayNameGenerator; @@ -45,7 +46,7 @@ void inheritsTagsFromParent() throws Exception { TestTemplateTestDescriptor testDescriptor = new TestTemplateTestDescriptor( parentUniqueId.append("tmp", "testTemplate()"), MyTestCase.class, - MyTestCase.class.getDeclaredMethod("testTemplate"), jupiterConfiguration); + MyTestCase.class.getDeclaredMethod("testTemplate"), List::of, jupiterConfiguration); parent.addChild(testDescriptor); assertThat(testDescriptor.getTags()).containsExactlyInAnyOrder(TestTag.create("foo"), TestTag.create("bar"), @@ -63,7 +64,7 @@ void shouldUseCustomDisplayNameGeneratorIfPresentFromConfiguration() throws Exce TestTemplateTestDescriptor testDescriptor = new TestTemplateTestDescriptor( parentUniqueId.append("tmp", "testTemplate()"), MyTestCase.class, - MyTestCase.class.getDeclaredMethod("testTemplate"), jupiterConfiguration); + MyTestCase.class.getDeclaredMethod("testTemplate"), List::of, jupiterConfiguration); parent.addChild(testDescriptor); assertThat(testDescriptor.getDisplayName()).isEqualTo("method-display-name"); @@ -80,7 +81,7 @@ void shouldUseStandardDisplayNameGeneratorIfConfigurationNotPresent() throws Exc TestTemplateTestDescriptor testDescriptor = new TestTemplateTestDescriptor( parentUniqueId.append("tmp", "testTemplate()"), MyTestCase.class, - MyTestCase.class.getDeclaredMethod("testTemplate"), jupiterConfiguration); + MyTestCase.class.getDeclaredMethod("testTemplate"), List::of, jupiterConfiguration); parent.addChild(testDescriptor); assertThat(testDescriptor.getDisplayName()).isEqualTo("testTemplate()"); From 511ab7d04dd5deec372157381b37a42003778b18 Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sun, 26 Jan 2025 19:23:11 +0100 Subject: [PATCH 527/611] Provide runtime enclosing instance types to `ResourceLocksProviders` Make API consistent with `DisplayNameGenerator` prior to releasing it in 5.12. Resolves #4163. --------- Co-authored-by: Sam Brannen <104798+sbrannen@users.noreply.github.com> --- .../DynamicSharedResourcesDemo.java | 4 +- .../api/parallel/ResourceLocksProvider.java | 32 +++++++++++--- .../descriptor/ClassTestDescriptor.java | 5 ++- .../descriptor/MethodBasedTestDescriptor.java | 17 ++++++- .../descriptor/NestedClassTestDescriptor.java | 7 ++- .../engine/descriptor/ResourceLockAware.java | 37 +++++++++++++--- .../parallel/ResourceLockAnnotationTests.java | 18 +++++--- .../parallel/ResourceLocksProviderTests.java | 44 ++++++++++++++----- 8 files changed, 128 insertions(+), 36 deletions(-) diff --git a/documentation/src/test/java/example/sharedresources/DynamicSharedResourcesDemo.java b/documentation/src/test/java/example/sharedresources/DynamicSharedResourcesDemo.java index 31f4c37e6bb3..4abe7297e357 100644 --- a/documentation/src/test/java/example/sharedresources/DynamicSharedResourcesDemo.java +++ b/documentation/src/test/java/example/sharedresources/DynamicSharedResourcesDemo.java @@ -19,6 +19,7 @@ import java.lang.reflect.Method; import java.util.Collections; +import java.util.List; import java.util.Properties; import java.util.Set; @@ -68,7 +69,8 @@ void canSetCustomPropertyToBanana() { static class Provider implements ResourceLocksProvider { @Override - public Set provideForMethod(Class testClass, Method testMethod) { + public Set provideForMethod(List> enclosingInstanceTypes, Class testClass, + Method testMethod) { ResourceAccessMode mode = testMethod.getName().startsWith("canSet") ? READ_WRITE : READ; return Collections.singleton(new Lock(SYSTEM_PROPERTIES, mode)); } diff --git a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocksProvider.java b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocksProvider.java index d94024d99f3b..2cffc5d6101f 100644 --- a/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocksProvider.java +++ b/junit-jupiter-api/src/main/java/org/junit/jupiter/api/parallel/ResourceLocksProvider.java @@ -14,6 +14,7 @@ import static org.apiguardian.api.API.Status.EXPERIMENTAL; import java.lang.reflect.Method; +import java.util.List; import java.util.Objects; import java.util.Set; @@ -43,7 +44,7 @@ public interface ResourceLocksProvider { /** - * Add shared resources to a test class. + * Add shared resources for a test class. * *

    Invoked in case a test class or its parent class is annotated with * {@code @ResourceLock(providers)}. @@ -60,8 +61,8 @@ default Set provideForClass(Class testClass) { } /** - * Add shared resources to a {@linkplain org.junit.jupiter.api.Nested @Nested} - * test class. + * Add shared resources for a + * {@link org.junit.jupiter.api.Nested @Nested} test class. * *

    Invoked in case: *