#!/usr/bin/env bash # Captures what the assertions-generator produced, and what happens WITHOUT the javax.annotation-api dependency. set -euo pipefail cd "$(dirname "$0")/.." G=target/generated-test-sources/assertj-assertions/lab/assertj { echo "# files generated into target/generated-test-sources/assertj-assertions/" (cd target/generated-test-sources/assertj-assertions && find . -name '*.java' | sort | sed 's#^\./##') } > output/22-generator-files.txt { echo "# AbstractOrderAssert.java: annotation line, class declaration and the isPaid() method, verbatim" grep -n -E '^@javax.annotation.Generated|^public abstract class' $G/domain/AbstractOrderAssert.java | sed -E 's/^[0-9]+://' sed -n '/public S isPaid()/,/^ }/p' $G/domain/AbstractOrderAssert.java } > output/23-generated-isPaid.txt # Same build, dependency removed: copy the module, delete the javax.annotation-api block. TMP=$(mktemp -d) cp -r pom.xml src "$TMP"/ python3 - "$TMP/pom.xml" <<'PY' import re,sys p=sys.argv[1]; s=open(p).read() s=re.sub(r'\s*javax\.annotation.*?','',s,flags=re.S) open(p,'w').write(s) PY (cd "$TMP" && mvn -B -q test-compile 2>&1 | grep -E '^\[ERROR\] /.*(package javax.annotation does not exist)' | sed -E "s#^\[ERROR\] $TMP/##" | sort -u) > output/24-generator-without-javax-annotation.txt || true rm -rf "$TMP" # The same 27 tests against the 4.0.0-M1 milestone, in a scratch copy (the module itself stays on 3.27.7). TMP=$(mktemp -d) cp -r pom.xml src "$TMP"/ (cd "$TMP" && mvn -B test -Dassertj.version=4.0.0-M1 2>&1 | grep -E '^\[(INFO|ERROR|WARNING)\] Tests run:.*[0-9]$' | tail -1 | sed 's/^\[[A-Z]*\] //') > "$TMP/summary.txt" { echo "assertj-core 4.0.0-M1 (milestone), same sources:" cat "$TMP/summary.txt" echo "transcripts whose text differs from the 3.27.7 run (excluding the generator captures):" for f in output/0*.txt output/1*.txt output/20*.txt output/21*.txt; do b=$(basename "$f") if ! diff -q <(sed -E 's/@[0-9a-f]{6,8}/@HASH/g' "$f") <(sed -E 's/@[0-9a-f]{6,8}/@HASH/g' "$TMP/output/$b") >/dev/null; then echo " $b"; fi done echo " (end of list; identity hashes like Customer@73c3cd09 are ignored in the comparison)" } > output/25-assertj-4-milestone.txt rm -rf "$TMP"