unit-test-exception-handler

Community

Test Spring exception handling with MockMvc.

AuthorMassimilianoPili
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill streamlines the testing of global exception handling mechanisms in Spring Boot applications, ensuring that errors are caught, formatted, and returned with the correct HTTP status codes.

Core Features & Use Cases

  • Test @ExceptionHandler: Verify that custom exception handlers correctly map exceptions to appropriate error responses.
  • Validate HTTP Status Codes: Ensure that specific exceptions trigger the expected HTTP status codes (e.g., 404 for not found, 400 for bad request).
  • Check Error Response Formatting: Confirm that the structure and content of error responses are consistent and informative.
  • Use Case: After implementing a new @ControllerAdvice to handle UserNotFoundException, use this Skill to write tests that confirm a GET request for a non-existent user returns a 404 status and a standardized error message.

Quick Start

Use the unit-test-exception-handler skill to test the handling of a ResourceNotFoundException by making a GET request to /api/users/999 and asserting a 404 status code.

Dependency Matrix

Required Modules

None required

Components

references

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: unit-test-exception-handler
Download link: https://github.com/MassimilianoPili/claude-code-config/archive/main.zip#unit-test-exception-handler

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.