Companion code for the rewritten post "Organising and Displaying JUnit Tests: @DisplayName, @Nested, @Tag (JUnit 5 -> JUnit 6)". Same suite also runs green on JUnit 5.14.4 via -Djunit.version. Verified, not assumed: GA dates and versions cross-checked against Maven Central metadata and docs.junit.org release notes; the @TestMethodOrder-inheritance-into-@Nested-classes and MethodOrderer.Default/ClassOrderer.Default behaviour differences between 5.14.4 and 6.1.3 are demonstrated by actually running the same source under both engines (see organising/output/12-* and 14-*), not by reading about them. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01YXCrLgRKFgCh9RHKW8xaqJ
27 lines
1.2 KiB
Bash
Executable File
27 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Compiles src/broken/MethodOrdererDefaultDemo.java against both JUnit versions and captures the
|
|
# REAL compiler output. MethodOrderer.Default was added in JUnit 6.0; this file is excluded from the
|
|
# normal build (it lives under src/broken, not src/test) precisely because it will not compile on 5.x.
|
|
set -uo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
|
|
mvn -q -B dependency:build-classpath -Dmdep.outputFile=/tmp/cp-6.1.3.txt
|
|
mvn -q -B dependency:build-classpath -Dmdep.outputFile=/tmp/cp-5.14.4.txt -Djunit.version=5.14.4
|
|
|
|
mkdir -p /tmp/broken-compile-out/6 /tmp/broken-compile-out/5
|
|
|
|
{
|
|
echo '$ javac -cp <junit-jupiter-6.1.3 and its dependencies> src/broken/MethodOrdererDefaultDemo.java'
|
|
javac -cp "$(cat /tmp/cp-6.1.3.txt)" -d /tmp/broken-compile-out/6 src/broken/MethodOrdererDefaultDemo.java
|
|
echo "(compiled cleanly)"
|
|
} > output/15-broken-compile-junit6.1.3.txt 2>&1
|
|
|
|
{
|
|
echo '$ javac -cp <junit-jupiter-5.14.4 and its dependencies> src/broken/MethodOrdererDefaultDemo.java'
|
|
javac -cp "$(cat /tmp/cp-5.14.4.txt)" -d /tmp/broken-compile-out/5 src/broken/MethodOrdererDefaultDemo.java
|
|
} > output/16-broken-compile-junit5.14.4.txt 2>&1
|
|
|
|
cat output/15-broken-compile-junit6.1.3.txt
|
|
echo
|
|
cat output/16-broken-compile-junit5.14.4.txt
|