Provides patterns for unit testing Jakarta Bean Validation (JSR-380), including @Valid, @NotNull, @Min, @Max, @Email constraints with Hibernate Validator. Generates custom validator tests, constraint violation assertions, validation groups, and parameterized validation tests. Validates data integrity logic without Spring context.
SkillScore87Maintained
Automatic
◆QA & Test Engineering pack
Last verified 8/21/2026
What it changes
Passed 20 of 23 test cases with the skill, and 17 of 23 without it.
Without skill74%
With skill87%
Checks it passed that the model alone missed
Includes org.assertj:assertj-core dependency in test scope.
Uses AssertJ hasSize() to verify the exact number of constraint violations.
Constructs the Validator using a @BeforeEach setup method rather than @BeforeAll.
and 1 more in the full report
4 fixed16 passed either way2 still failing1 broke
Pass-rate lift
+13 pp
Tokens
+58%
Agent turns
0%
Response time
-17%
Model gemini-3.6-flashMeasured 8/21/2026v120 of 23 cases passed with skill
Tokens, turns and time describe resource use, not a dollar price.
See it in action
One of 4 test cases the skill fixed. Same model, same prompt, with and without the skill.
1 of 4
Prompt
What is the recommended pattern in JUnit 5 and AssertJ for asserting that a completely valid DTO object produces zero Bean Validation violations? Write the test method.
What was checked, without and with the skill
Checked
Without skill
With skill
Validates a compliant DTO instance using validator.validate(validDto).
Passed
Passed
Uses assertThat(validator.validate(validDto)).isEmpty() to assert zero violations.
Missed
Passed
case-16 · gemini-3.6-flash · 8/21/2026 · answers are capped and redacted
What's inside
The instructions your model reads when the skill loads.
SKILL.md173 lines3 files
Unit Testing Jakarta Bean Validation
Overview
This skill provides executable patterns for unit testing Jakarta Bean Validation annotations and custom validators using JUnit 5. Covers built-in constraints (@NotNull, @Email, @Min, @Max, @Size), custom @Constraint implementations, cross-field validation, and validation groups. Tests run in isolation without Spring context.
When to Use
Writing unit tests for Jakarta Bean Validation or JSR-380 constraints
Testing custom @Constraint validators and constraint violation messages
Testing bean validation logic in DTOs and request objects
Provides patterns for unit testing REST controllers using MockMvc and @WebMvcTest. Generates controller tests that validates request/response mapping, validation, exception handling, and HTTP status codes. Use when testing web layer endpoints in isolation for API endpoint testing, Spring MVC tests, mock HTTP requests, or controller layer unit tests.