assertj: AssertJ 3.27.7 lab (soft assertions, recursive comparison, custom and generated assertions)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CifR2BE7PBvRy5hT8TS9oz
This commit is contained in:
Executable
+44
@@ -0,0 +1,44 @@
|
||||
#!/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 <dependency> 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'<dependency>\s*<groupId>javax\.annotation</groupId>.*?</dependency>','',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"
|
||||
Reference in New Issue
Block a user