skills/jabrena/cursor-rules-java/521-frameworks-micronaut-testing-unit-tests

521-frameworks-micronaut-testing-unit-tests

Installation
SKILL.md

Micronaut Unit Testing

Apply fast testing strategies for Micronaut: Mockito-first, narrow @MicronautTest when HTTP or DI replacement is required.

What is covered in this Skill?

  • Pure JUnit 5 + Mockito without container boot
  • @MicronautTest with @MockBean factory methods for collaborators
  • HttpClient blocking exchanges against the embedded server
  • @Property for deterministic configuration in tests
  • @ParameterizedTest with @CsvSource / @MethodSource
  • Naming: *Test → Surefire; *IT → Failsafe when configured
  • When to escalate to @522

Scope: Apply recommendations based on the reference rules and good/bad code examples.

Constraints

Compile before test refactors; verify the full suite after.

  • MANDATORY: Run ./mvnw compile or mvn compile before applying any change
  • SAFETY: If compilation fails, stop immediately
  • VERIFY: Run ./mvnw clean verify or mvn clean verify after applying improvements
  • BEFORE APPLYING: Read the reference for detailed rules and examples

When to use this skill

  • Add or improve unit tests in a Micronaut project
  • Reduce unnecessary @MicronautTest usage with Mockito-first tests

Reference

For detailed guidance, examples, and constraints, see references/521-frameworks-micronaut-testing-unit-tests.md.

Weekly Installs
41
GitHub Stars
360
First Seen
1 day ago