
Unit Test Caching
Unit tests for Spring cache annotations using an in-memory ConcurrentMapCacheManager and mocked repositories.
- skills.sh installs
- 3.9K
- GitHub stars
- 372
- last updated
- Aug 21, 2026
What it does
- Covers @Cacheable hit and miss behavior, @CacheEvict invalidation, @CachePut updates, and cache key generation from SpEL expressions
- Includes Maven and Gradle dependency setup plus Java examples for service classes and their tests
- Enforces checks that
@EnableCachingis present and that calls pass through the Spring proxy rather thanthis - Designed for Spring Boot projects that want fast cache tests without Redis or a full application context
Install
$ npx -y skills add giuseppe-trisciuoglio/developer-kit --skill unit-test-caching -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
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
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 95- Unit Test Config Properties3.9K
- Unit Test Application Events3.9K
- Langchain4j Vector Stores Configuration3.9K
- Langchain4j Mcp Server Patterns3.9K
- Aws Sdk Java V2 S33.9K
- Langchain4j Testing Strategies3.9K
- Aws Sdk Java V2 Dynamodb3.9K
- Aws Rds Spring Boot Integration3.9K
- Nextjs Deployment3.9K
- Aws Sdk Java V2 Lambda3.9K
- Aws Sdk Java V2 Core3.9K
- Aws Sdk Java V2 Bedrock3.9K
- Aws Sdk Java V2 Messaging3.9K
- Aws Sdk Java V2 Secrets Manager3.9K
- Aws Sdk Java V2 Kms3.9K
- Aws Sdk Java V2 Rds3.9K
- Nestjs Drizzle Crud Generator3.8K
- Aws Lambda Python Integration3.8K
- Aws Lambda Typescript Integration3.8K
- Sonarqube Mcp3.8K
- Better Auth3.8K
- Aws Lambda Java Integration3.7K
- Aws Lambda Php Integration3.7K
- Spring Boot Project Creator3.7K
Similar to Unit Test Caching
More Testing & QA
spring-boot-cacheSkillgiuseppe-trisciuoglio/developer-kit4K installsStep-by-step Spring Boot caching guide that configures providers, annotations, TTL, and Actuator metrics.
unit-test-application-eventsSkillgiuseppe-trisciuoglio/developer-kit3.9K installsUnit test patterns for Spring events that mock publishers and call listeners directly without a booted context.
java-testingSkillpluginagentmarketplace/custom-plugin-java917 installsJava testing guide covering JUnit 5, Mockito, AssertJ, and Spring Boot integration tests with Testcontainers.
321-frameworks-spring-boot-testing-unit-testsPluginjabrena/plinth462 starsUse when you need to write unit tests for Spring Boot applications — including pure unit tests with @ExtendWith(MockitoExtension.class) for @Service/@Component,
spring-boot-testingSkillgithub/awesome-copilot2.1K installsExpert Spring Boot testing guide that picks the right test slice, Testcontainers setup, and mocking approach.