This one generates unit test patterns for Spring Cache annotations without spinning up a full application context. You get test code that mocks CacheManager with ConcurrentMapCacheManager, verifies cache hits by checking repository call counts, and validates eviction and key generation logic. It covers the standard annotations (Cacheable, CacheEvict, CachePut) plus conditional caching scenarios with SpEL expressions. Honestly, this is most useful when you're adding caching to an existing service and want fast feedback on whether your annotations actually work before deploying. The examples show proper mock verification patterns, which is the tricky part most people get wrong when testing caching behavior.

skills.sh installs
3.8K
GitHub stars
369
last updated
Aug 21, 2026

Install

$ npx -y skills add giuseppe-trisciuoglio/developer-kit --skill unit-test-caching --agent claude-code

Installs into .claude/skills of the current project.

Files

Unit Testing Spring Caching

Overview

This skill provides patterns for unit testing Spring caching annotations (@Cacheable, @CacheEvict, @CachePut) without full Spring context. It covers cache hits/misses, invalidation, key generation, and conditional caching using in-memory ConcurrentMapCacheManager.

When to Use

  • Writing unit tests for @Cacheable method behavior
  • Verifying @CacheEvict cache invalidation works correctly
  • Testing @CachePut cache updates
  • Validating cache key generation from SpEL expressions
  • Testing conditional caching with unless/condition parameters
  • Mocking cache managers in fast unit tests without Redis

Instructions

Sponsors

Details

Repository
github.com/giuseppe-trisciuoglio/developer-kit
Categories
Testing & QA, Java & JVM
First seen
May 16, 2026

More from giuseppe-trisciuoglio/developer-kit

All 102
1bmad-labs avatartypescript-e2e-testingbmad-labs/skillsE2E and integration testing for TypeScript/NestJS projects using Jest, supertest, and real infrastructure via Docker (Kafka, PostgreSQL, MongoDB, Redis) with th2.3Kskills.sh installs
2web-infra-dev avatarvitest-midscene-e2eweb-infra-dev/midscene-skillsEnhances Vitest with Midscene for AI-powered UI testing across Web (Playwright), Android (ADB), and iOS (WDA). Scaffolds new projects, converts existing project2.1Kskills.sh installs
3cognitedata avatartest-coveragecognitedata/builder-skillsMUST be used whenever fixing test coverage for a Flows app to meet the 80% line coverage hard gate. This skill finds AND fixes coverage gaps — it configures too1.9Kskills.sh installs
4hieutrtr avatare2e-testinghieutrtr/ai1-skillsEnd-to-end testing patterns with Playwright for full-stack Python/React applications. Use when writing E2E tests for complete user workflows (login, CRUD, navig1.6Kskills.sh installs
5dbt-labs avataradding-dbt-unit-testdbt-labs/dbt-agent-skillsCreates unit test YAML definitions that mock upstream model inputs and validate expected outputs. Use when adding unit tests for a dbt model or practicing test-1.1Kskills.sh installs
6adobe avatarappbuilder-e2e-testingadobe/skillsUse this skill whenever the user wants browser-based end-to-end tests for an Adobe App Builder application. Covers Playwright E2E testing for ExC Shell SPAs, AE800skills.sh installs