
Unit Test Caching
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-codeInstalls 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
@Cacheablemethod behavior - Verifying
@CacheEvictcache invalidation works correctly - Testing
@CachePutcache updates - Validating cache key generation from SpEL expressions
- Testing conditional caching with
unless/conditionparameters - 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- Unit Test Config Properties3.8K
- Unit Test Application Events3.8K
- Langchain4j Vector Stores Configuration3.8K
- Langchain4j Mcp Server Patterns3.8K
- Aws Sdk Java V2 S33.8K
- Langchain4j Testing Strategies3.8K
- Aws Sdk Java V2 Dynamodb3.8K
- Aws Rds Spring Boot Integration3.8K
- Nextjs Deployment3.8K
- Aws Sdk Java V2 Lambda3.8K
- Aws Sdk Java V2 Core3.8K
- Aws Sdk Java V2 Bedrock3.8K
- Aws Sdk Java V2 Messaging3.8K
- Aws Sdk Java V2 Secrets Manager3.8K
- Aws Sdk Java V2 Kms3.8K
- Aws Sdk Java V2 Rds3.8K
- Nestjs Drizzle Crud Generator3.8K
- Aws Lambda Python Integration3.8K
- Aws Lambda Typescript Integration3.7K
- Sonarqube Mcp3.7K
- Better Auth3.7K
- Aws Lambda Java Integration3.7K
- Aws Lambda Php Integration3.7K
- Spring Boot Project Creator3.7K