
unit-test-caching
Provides patterns for unit testing Spring Cache annotations
by giuseppe-trisciuoglioFree
Description
This agent skill gives patterns for unit testing Spring's caching annotations, which are @Cacheable, @CachePut and @CacheEvict. The tests use an in-memory cache manager, ConcurrentMapCacheManager, so they run without a Redis server or a full Spring context. The skill covers cache hits and misses, which show whether a method body ran or whether its result came from the cache. It covers invalidation with @CacheEvict, so a test can confirm that stale entries are removed after a change. It covers @CachePut, which should refresh the cache with a new value. It also checks cache key generation from SpEL expressions, and conditional caching with the condition and unless parameters, which decide when a result is stored. The skill is a set of instructions for an AI coding agent that writes these tests in Java, and it is one of several Spring testing skills in the developer-kit repository by giuseppe-trisciuoglio, which has about 371 stars on GitHub. It is written for fast unit tests, so it does not cover integration tests against a real cache server.…
Highlights
- Test @Cacheable hits and misses
- Verify @CacheEvict removes stale entries
- Check @CachePut refreshes cached values
- Validate cache keys built from SpEL expressions
- Test conditional caching with condition and unless
Ratings & Reviews
No ratings yet
Be the first to rate unit-test-caching.
People also visit
unit-test-caching FAQ
Does it need Redis to run the tests?
No. The skill uses ConcurrentMapCacheManager, an in-memory cache manager, so tests run without Redis.
Which annotations does it cover?
It covers @Cacheable, @CacheEvict and @CachePut, plus the condition and unless parameters.
Is it for integration tests?
The skill is written for fast unit tests with mocked cache managers. It does not cover tests against a live cache server.
How do I install it?
Run npx skills add https://github.com/giuseppe-trisciuoglio/developer-kit --skill unit-test-caching.
What security audits has it passed?
Gen Agent Trust Hub: Pass. Socket: Pass. Snyk: Pass.
What are the best unit-test-caching alternatives?
Popular alternatives to unit-test-caching include unit-test-scheduled-async, spring-boot-cache and unit-test-exception-handler. See all unit-test-caching alternatives









