
unit-test-exception-handler
Provides patterns for unit testing `@ExceptionHandler`
by giuseppe-trisciuoglioFree
Description
This agent skill gives patterns for unit testing error handling in Spring Boot. It covers @ExceptionHandler methods and @ControllerAdvice classes, which together decide what a REST API returns when something goes wrong. The tests use MockMvc to send requests through the controller layer and check the result. The assertions cover the HTTP status code, the JSON structure of the error body, and field-level messages for validation errors, so a test can confirm that each bad field is named in the response. The skill also covers mocking the dependencies of a handler and testing custom error payloads. Use it when writing tests for a global exception handler, when checking how a controller turns an exception into an HTTP response, or when confirming that a REST API keeps a consistent error format. It is an instruction set for an AI coding agent working on a Java project, and it sits in the developer-kit repository by giuseppe-trisciuoglio, which has about 371 stars on GitHub, next to its other unit testing skills. It does not cover running the full application or testing the business logic behind the exception.…
Highlights
- Test @ExceptionHandler methods in @ControllerAdvice classes
- Assert HTTP status codes and error payloads
- Check field-level validation error messages
- Mock handler dependencies
- Verify consistent REST error formats
Ratings & Reviews
No ratings yet
Be the first to rate unit-test-exception-handler.
People also visit

unit-test-application-events
Provides patterns for unit testing Spring application events
unit-test-exception-handler FAQ
Which annotations does it cover?
It covers @ExceptionHandler methods and @ControllerAdvice classes in Spring Boot.
How are the requests sent?
The skill uses MockMvc to send requests through the controller and check the result.
Does it check validation errors?
Yes. It covers field-level validation error responses.
How do I install it?
Run npx skills add https://github.com/giuseppe-trisciuoglio/developer-kit --skill unit-test-exception-handler.
What security audits has it passed?
Gen Agent Trust Hub: Pass. Socket: Pass. Snyk: Pass.
What are the best unit-test-exception-handler alternatives?
Popular alternatives to unit-test-exception-handler include unit-test-controller-layer, unit-test-application-events and unit-test-security-authorization. See all unit-test-exception-handler alternatives










