New advertisers: 50% off your first month with code FIRSTMONTHSee slots
giuseppe-trisciuoglio avatar

Unit Test Controller Layer

Patterns for unit testing REST controllers with MockMvc, covering status codes, validation, and error handling.

skills.sh installs
4K
GitHub stars
372
last updated
Aug 21, 2026
View on GitHub

What it does

  • Covers standalone MockMvc setup with mocked services for GET, POST, PUT, and DELETE endpoints in isolation
  • Includes examples for query parameters, path variables, validation failures, response headers, authorization headers, and content negotiation
  • Guides test-driven debugging with .andDo(print()) to compare actual and expected results when assertions fail
  • Designed for Spring MVC projects that need web layer tests without loading the full application context

Install

$ npx -y skills add giuseppe-trisciuoglio/developer-kit --skill unit-test-controller-layer -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Unit Testing REST Controllers with MockMvc

Overview

Provides patterns for unit testing @RestController and @Controller classes using MockMvc. Covers request/response handling, HTTP status codes, request parameter binding, validation, content negotiation, response headers, and exception handling with mocked service dependencies.

When to Use

Use for: controller tests, API endpoint testing, Spring MVC tests, mock HTTP requests, unit testing web layer endpoints, verifying REST controllers in isolation.

Instructions

Details

Repository
github.com/giuseppe-trisciuoglio/developer-kit
Category
Testing & QA
First seen
May 16, 2026

More from giuseppe-trisciuoglio/developer-kit

All 95

Similar to Unit Test Controller Layer

More Testing & QA