unit-test-mapper-converter

Installation
Summary

Unit testing patterns for MapStruct mappers and custom converters with comprehensive transformation validation.

  • Covers field mapping accuracy, null handling, type conversions, nested objects, bidirectional mapping, enum mapping, and partial updates
  • Includes Maven and Gradle setup with MapStruct, JUnit 5, and AssertJ dependencies
  • Provides patterns for testing simple mappings, nested hierarchies, custom @Mapping annotations, enum @ValueMapping, and @MappingTarget partial updates
  • Demonstrates round-trip validation, recursive comparison for complex structures, and null input handling across all mapper scenarios
SKILL.md

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/
Related skills

More from giuseppe-trisciuoglio/developer-kit

Installs
871
GitHub Stars
246
First Seen
Feb 3, 2026