Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ updates:
update-types: ["version-update:semver-major", "version-update:semver-minor"]
- dependency-name: "io.undertow:*"
update-types: ["version-update:semver-major", "version-update:semver-minor"]
# junit5 module stays on JUnit 5, the junit6 module covers JUnit 6
- dependency-name: "org.junit.jupiter:*"
update-types: ["version-update:semver-major"]
- package-ecosystem: "github-actions" # Also update Github actions
directory: "/"
schedule:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/maven-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
call-release-job:
permissions:
contents: write # needed to push commit and tag back to the repository
uses: project-ncl/shared-github-actions/.github/workflows/maven-release.yml@af62bc3c8181df77581ddf64859f9bba9129fcad # v0.0.28
uses: project-ncl/shared-github-actions/.github/workflows/maven-release.yml@fbfd6ad4b1b569f0f4667f5cc71259506dbcb933 # main
with:
java_version: "17"
ref_to_release: ${{ inputs.ref_to_release }}
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ or:
}
}

#### Choosing the artifact

| Test framework | Artifact | Java |
|---|---|---|
| JUnit 4 | `http-testserver-junit4` | 11+ |
| JUnit 5 | `http-testserver-junit5` (built against JUnit Jupiter 5.14.x) | 11+ |
| JUnit 6 | `http-testserver-junit6` (built against JUnit Jupiter 6.x) | 17+ |

The JUnit 5 and 6 artifacts expose the same classes in the same `org.commonjava.test.http.junit5` package, so switching only requires changing the artifactId.

#### Quarkus Based Test

There are some limitations to let junit5 @ExtendWith work together with @QuarkusTest, see https://github.com/quarkusio/quarkus/issues/24911#issuecomment-1098935690
Expand Down
2 changes: 2 additions & 0 deletions junit5/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<!-- JUnit 5 line. The JUnit 6 line lives in ../junit6, which reuses these sources. -->
<version>5.14.4</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
97 changes: 97 additions & 0 deletions junit6/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<!--

Copyright © 2011-2024 Red Hat, Inc. (https://github.com/Commonjava/http-testserver)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.commonjava.util</groupId>
<artifactId>http-testserver-parent</artifactId>
<version>2.3.6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>http-testserver-junit6</artifactId>
<name>http-testserver-junit6</name>
<packaging>jar</packaging>

<properties>
<!-- JUnit 6 requires Java 17 -->
<maven.compiler.release>17</maven.compiler.release>
</properties>

<dependencies>
<dependency>
<groupId>org.commonjava.util</groupId>
<artifactId>http-testserver-core</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>6.1.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!--
The extension API used (BeforeEach/AfterEach callbacks, TestInstancePostProcessor) is identical in
JUnit 5 and 6, so this module has no sources of its own: it compiles and tests the ../junit5 sources
against JUnit 6. The classes keep their org.commonjava.test.http.junit5 package so that switching
between the two artifacts only requires changing the artifactId.
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.6.1</version>
<executions>
<execution>
<id>add-junit5-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.basedir}/../junit5/src/main/java</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-junit5-test-sources</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>${project.basedir}/../junit5/src/test/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
6 changes: 1 addition & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@
<artifactId>junit</artifactId>
<version>4.13.2</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>6.1.3</version>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
Expand All @@ -97,6 +92,7 @@
<module>core</module>
<module>junit4</module>
<module>junit5</module>
<module>junit6</module>
<module>quarkus</module>
</modules>

Expand Down
5 changes: 0 additions & 5 deletions quarkus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@
<groupId>org.commonjava.util</groupId>
<artifactId>http-testserver-core</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
Expand Down
Loading