Add support for JUnit6#1659
Conversation
|
Part 1 and Part 2 are almost identical. Only the following three things should be different:
|
25a25d8 to
c9660f2
Compare
9998433 to
dabea23
Compare
There was a problem hiding this comment.
moved to archunit-self-test/src/main/java/com/tngtech/archunit/ArchUnitExampleArchitectureRules.java with too many changes
dabea23 to
75512aa
Compare
0db3de2 to
4194a2c
Compare
| .ignoreDependency(ArchConfiguration.class, ClassResolver.class); | ||
| .ignoreDependency(ArchConfiguration.class, ClassResolver.class) | ||
| // Not all layers are present on all archunit-junit* packages | ||
| .withOptionalLayers(true); |
There was a problem hiding this comment.
@hankem this setting is not covered by archRule.failOnEmptyShould=false. We can either set this withOptionalLayers or self-check the entirety of ArchUnit in all production packages (i.e. @AnalyzeClasses(packages = "com.tngtech.archunit" instead of @AnalyzeClasses(packages = "com.tngtech.archunit.junit.[...]"). What would you prefer?
4b5b3e4 to
d24f652
Compare
Introduce `archunit-junit6-api`, `archunit-junit6-engine`, `archunit-junit6-engine-api` as well as the `archunit-junit6` aggregator modules (analogous to their junit5 counterparts) to enable ArchUnit tests on the JUnit 6 platform: * Implement `ArchUnitTestEngine` and `ArchUnitTestDescriptor` for test discovery and execution. * Add `ArchTest`, `AnalyzeClasses`, and `ArchTag` annotations to define and organize tests. * Implement `ArchUnitSystemPropertyTestFilterJUnit6` to support test filtering via the `junit.testFilter` system property. Signed-off-by: junya koyama <arukiidou@yahoo.co.jp> Co-authored-by: Dr. Jonathan Schulz <jonathan.schulz@tngtech.com> Signed-off-by: Dr. Jonathan Schulz <jonathan.schulz@tngtech.com>
Using version catalog for Maven plugins (`mavenSurefirePlugin` and `mavenCompilerPlugin` from `gradle/libs.versions.toml` are injected into `archunit-maven-test/pom.xml.template` via `archunit-maven-test/build.gradle`). `TestResultTest` now identifies test results by simple class names since the behavior of the maven-surefire-plugin changed with apache/maven-surefire#214: `surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/RunListenerAdapter.java` uses `className = testPlan.getParent(testIdentifier).getDisplayName()` instead of `org.junit.platform.launcher.listeners.LegacyReportingUtils.getClassName(testPlan, testIdentifier)` for `TestSource`s that are neither a `MethodSource` nor a `ClassSource` (including ArchUnit's `FieldSource`, created by `ArchUnitRuleDescriptor`), which causes the test report's testcase/@classname to not contain fully qualified class names anymore. Signed-off-by: Dr. Jonathan Schulz <jonathan.schulz@tngtech.com>
Add `archunit-example:example-junit6` (analogous to `archunit-example:example-junit5`), and `archunit-integration-test:junit6` (analogous to `archunit-integration-test:junit5`) to verify them. Signed-off-by: Dr. Jonathan Schulz <jonathan.schulz@tngtech.com>
- Required because the previous setting was unable to test junit5-engine and junit6-engine at the same time Signed-off-by: Dr. Jonathan Schulz <jonathan.schulz@tngtech.com>
This task caused build failures on Windows. After some investigation, I concluded that it is no longer needed - the existing `dependencies.exclude()` make this transformation an identity operation. Also, there is test coverage for missing `exclude` statements (see `:checkArtifact`), so we can't accidentally publish a release where the problem that this code meant to address is present. Signed-off-by: Dr. Jonathan Schulz <jonathan.schulz@tngtech.com>
| archTestImplementation project(path: ':archunit-junit4') | ||
| archTestImplementation project(path: ':archunit-junit5') |
There was a problem hiding this comment.
We don't need both, right?
| archTestImplementation project(path: ':archunit-junit4') | |
| archTestImplementation project(path: ':archunit-junit5') | |
| archTestImplementation project(path: ':archunit-junit5') |
| can obtain the necessary JAR files directly from | ||
| http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.tngtech.archunit%22[Maven Central]. | ||
|
|
||
| === JUnit 4 |
There was a problem hiding this comment.
Should we flip the order of JUnit 4 and JUnit 5 & 6?
The sequence of 4, 5, 6 is nice, but JUnit 4 might be(come) less relevant.
Signed-off-by: Dr. Jonathan Schulz <jonathan.schulz@tngtech.com>
… be allow-listed Signed-off-by: Dr. Jonathan Schulz <jonathan.schulz@tngtech.com>
d24f652 to
f695eaf
Compare
Uh oh!
There was an error while loading. Please reload this page.