Skip to content

[ISSUE-3779][test] Deepen GlobalExceptionHandlerTest with 501/500/503/type-mismatch/unreadable-body branches - #3779

Open
yyqdbngt wants to merge 1 commit into
apache:rocketmq-studiofrom
yyqdbngt:codex/yy-deepen-global-exception-handler-test
Open

[ISSUE-3779][test] Deepen GlobalExceptionHandlerTest with 501/500/503/type-mismatch/unreadable-body branches#3779
yyqdbngt wants to merge 1 commit into
apache:rocketmq-studiofrom
yyqdbngt:codex/yy-deepen-global-exception-handler-test

Conversation

@yyqdbngt

@yyqdbngt yyqdbngt commented Sep 5, 2026

Copy link
Copy Markdown

Motivation

The existing GlobalExceptionHandlerTest covers business, LLM-gateway, 404/405/406 mappings, but five handler branches were still unverified through the advice: unsupported operations, the generic catch-all, Prometheus failures, request-parameter type mismatches and unreadable request bodies.

Changes

  • unsupportedOperationReturns501Envelope: UnsupportedOperationException maps to HTTP 501 with the exception message preserved.
  • unexpectedExceptionReturns500Envelope: the catch-all maps arbitrary runtime failures to HTTP 500 with the neutral Internal Server Error message (no leak).
  • prometheusExceptionPreservesStatusAndMessage: a Prometheus failure keeps its status code and message.
  • typeMismatchParameterReturns400InvalidParameter: a non-numeric path variable for an int parameter is reported as 400 with the generic parameter message.
  • unreadableBodyReturns400InvalidBody: a malformed JSON body is reported as 400 with the Invalid request body message.

Verification

mvn -B test -Dtest=GlobalExceptionHandlerTest
[INFO] Tests run: 11, Failures: 0, Errors: 0, Skipped: 0
[INFO] BUILD SUCCESS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants