Companion code for "Global Exception Handling with ProblemDetail (RFC 9457) in Spring Boot 4". Thirteen failures under five handling setups (Boot defaults, the Boot flag, a ResponseEntityExceptionHandler advice, advice plus an ErrorController, a catch-all ordered first), validation errors, i18n, content negotiation, Security's 401/403, silent 500s and decoding on the client. 16 tests pin the behaviour. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01C3TETMrqVUWeFkNtz3Jbo3
16 lines
676 B
Bash
16 lines
676 B
Bash
#!/usr/bin/env bash
|
|
# Declaring @ExceptionHandler(MethodArgumentNotValidException.class) in a subclass of
|
|
# ResponseEntityExceptionHandler. -> docs/output/ambiguous-handler.txt
|
|
set -uo pipefail
|
|
source "$(dirname "$0")/env.sh"
|
|
"$MODULE_DIR/scripts/stop.sh"
|
|
timeout 60 java -jar "$JAR" --spring.profiles.active=ambiguous --server.port="$PORT" > "$LOG" 2>&1
|
|
code=$?
|
|
{
|
|
echo "# Profile: ambiguous (exit code $code)"
|
|
echo
|
|
grep -v 'Picked up JAVA_TOOL_OPTIONS' "$LOG" | grep -E '^Caused by: java.lang.IllegalStateException: Ambiguous' | head -1 \
|
|
| sed -e 's/: {/:\n {/' -e 's/, public/,\n public/'
|
|
} > "$OUT/ambiguous-handler.txt"
|
|
cat "$OUT/ambiguous-handler.txt"
|