One test per question, each writing and asserting its own transcript under output/. Covers lifecycle, extensions, parameterized and dynamic tests, mocks vs spies, verification, strict stubs, static and constructor mocking, and flaky tests. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01CifR2BE7PBvRy5hT8TS9oz
21 lines
1008 B
Bash
Executable File
21 lines
1008 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Q2: compares the real junit-jupiter-api 5.14.4 and 6.1.3 jars. Writes output/q02-jar-comparison.txt.
|
|
# Needs JDK (javap, unzip) and Maven. Downloads both jars into the local Maven repository.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
unset JAVA_TOOL_OPTIONS
|
|
REPO="${HOME}/.m2/repository"
|
|
OUT=output/q02-jar-comparison.txt
|
|
TMP="$(mktemp -d)"
|
|
: > "$OUT"
|
|
for v in 5.14.4 6.1.3; do
|
|
mvn -B -q dependency:get -Dartifact="org.junit.jupiter:junit-jupiter-api:$v" >/dev/null
|
|
jar="$REPO/org/junit/jupiter/junit-jupiter-api/$v/junit-jupiter-api-$v.jar"
|
|
mkdir -p "$TMP/$v"
|
|
unzip -q -o "$jar" 'org/junit/jupiter/api/Test.class' -d "$TMP/$v"
|
|
major=$(javap -v -cp "$TMP/$v" org.junit.jupiter.api.Test | grep 'major version' | awk '{print $3}')
|
|
alpha=$(unzip -l "$jar" | grep -c 'MethodOrderer\$Alphanumeric' || true)
|
|
echo "junit-jupiter-api $v : class-file major version $major (Java $((major-44))), MethodOrderer\$Alphanumeric entries in jar: $alpha" | tee -a "$OUT"
|
|
done
|
|
rm -rf "$TMP"
|