Provides patterns for unit testing mappers, converters, and bean mappings. Validates entity-to-DTO and model transformation logic in isolation. Generates executable mapping tests with MapStruct and custom converter test coverage.
SkillScore100Maintained
Automatic
◆QA & Test Engineering pack
Last verified 8/21/2026
What it changes
Passed 22 of 22 test cases with the skill, and 21 of 22 without it.
Without skill95%
With skill100%
Checks it passed that the model alone missed
Advises running mvn compile or ./gradlew compileJava when generated mapper implementations are missing.
1 fixed21 passed either way0 still failing0 broke
Pass-rate lift
+5 pp
Tokens
+13%
Agent turns
0%
Response time
-27%
Model gemini-3.6-flashMeasured 8/21/2026v122 of 22 cases passed with skill
Tokens, turns and time describe resource use, not a dollar price.
See it in action
A test case the skill fixed. Same model, same prompt, with and without the skill.
Prompt
I'm running into issues where my MapStruct unit tests throw NullPointerExceptions or fail during build execution because generated mapper implementations aren't detected. Please provide a guide and sample unit test class showing how to set up standalone mapper tests, verify build outputs, and properly test null input handling.
What was checked, without and with the skill
Checked
Without skill
With skill
Mentions checking build output directories such as target/generated-sources/ or build/generated/sources/ for generated mapper classes.
Passed
Passed
Advises running mvn compile or ./gradlew compileJava when generated mapper implementations are missing.
Missed
Passed
Recommends configuring nullValueMappingStrategy = NullValueMappingStrategy.RETURN_NULL on the mapper interface when null tests fail.
Passed
Passed
case-01 · 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.md126 lines2 files
Unit Testing Mappers and Converters
Overview
Provides patterns for unit testing MapStruct mappers and custom converter classes. Covers field mapping accuracy, null handling, type conversions, nested object transformations, bidirectional mapping, enum mapping, and partial updates.
When to Use
Writing mapping tests for MapStruct mapper implementations
Testing custom entity-to-DTO converters and bean mappings
Validating nested object mapping and collection transformations
Instructions
1. Validate Generated Mapper Classes
Before testing, verify generated mapper classes exist:
# Maven
ls target/generated-sources/
# Gradle
ls build/generated/sources/
If generated classes are missing:
Run mvn compile (Maven) or ./gradlew compileJava (Gradle)
Check that the MapStruct annotation processor is configured
Verify @Mapper interfaces are in a compiled source set
2. Test Null Handling
assertThat(mapper.toDto(null)).isNull();
Configure nullValueMappingStrategy in mapper if null should return empty/default.
If null tests fail:
Add nullValueMappingStrategy = NullValueMappingStrategy.RETURN_NULL to @Mapper
Or use nullValuePropertyMappingStrategy for nested property handling