jpa-persistence-test
Writes the persistence tests of a use case (UC-XXX) for Spring Data JPA: @DataJpaTest classes against a real database in a Testcontainers container (never H2 unless the project already tests on it), test data from Flyway test migrations, one UC<id><Name>RepositoryTest class per use case with @UseCase annotations. Tests only queries with logic of their own — filters, joins, projections, paging, fetch joins, custom @Query and Specification queries, attribute converters — and says so when the use case has none. In a hexagonal backend it tests through the persistence adapter in the adapter module. Use when the user asks to "test the repository", "write a @DataJpaTest", "test the JPA query of UC-001", "write persistence tests", or mentions DataJpaTest, repository tests, or Testcontainers for Spring Data JPA. /use-case-test runs it only to reconcile existing tests, for queries the integration layer cannot reach, or when the persistence layer is named; it can also be run directly.
Pinned to revision dbb4e27b6d25, so it is the text this page describes rather than whatever the author pushed since.
Files
- skills/jpa-persistence-test/SKILL.md
- skills/jpa-persistence-test/references/UC001RegisterGuestRepositoryTest.java.md
- skills/jpa-persistence-test/references/UseCase.java.md
- skills/jpa-persistence-test/references/markers.md
Every link opens the file at its source, pinned to the revision this page describes.