{"enrichment":{"faq":[{"a":"unit-test-caching teaches you to isolate @Cacheable behavior by injecting a ConcurrentMapCacheManager into your test, then verifying cache hits by checking that your repository method is called fewer times than the number of invocations. Use Mockito's times() matcher to assert call counts and confirm the cache prevented redundant database queries.","q":"How do I unit test Spring @Cacheable annotation?"},{"a":"unit-test-caching provides patterns to verify cache hit/miss by counting repository invocations with Mockito.verify(). For cache hits, the repository is called once but the method is invoked multiple times; for misses, call counts match invocation counts. This skill shows how to assert these patterns without requiring Redis or external cache infrastructure.","q":"How can unit-test-caching help verify cache hit/miss behavior?"},{"a":"unit-test-caching covers @CacheEvict testing by demonstrating how to verify that cache entries are removed after eviction methods execute. You'll learn to check that subsequent calls to the cached method trigger repository calls again, confirming the cache was actually cleared rather than returning stale data.","q":"What does unit-test-caching teach about testing @CacheEvict invalidation?"},{"a":"Yes. unit-test-caching includes patterns for testing SpEL-based cache keys and compound keys by verifying that different parameter combinations produce distinct cache entries. You'll learn to mock CacheManager and inspect cache contents to confirm key generation logic works correctly without needing complex integration tests.","q":"Can unit-test-caching help test cache key generation from SpEL expressions?"},{"a":"unit-test-caching teaches you to mock cache managers and test conditional caching by verifying that @Cacheable with unless or condition attributes correctly skips caching when predicates are false. You'll use Mockito to confirm the cache.get() method is never called for excluded conditions, validating your conditional logic in isolation.","q":"How does unit-test-caching address conditional caching with unless/condition?"},{"a":"unit-test-caching covers null result handling by showing how to test @Cacheable and @CachePut behavior when methods return null. You'll learn whether your cache stores null values and how to validate cache eviction strategies that may treat nulls differently, ensuring your application handles edge cases consistently.","q":"What patterns does unit-test-caching provide for null result handling?"}],"shadow_tags":["cache-behavior-verification","mock-cache-manager","spel-key-generation","cache-invalidation-testing","conditional-caching-logic","in-memory-cache-testing","cache-hit-miss-patterns","spring-proxy-testing","cache-eviction-validation"],"summary_rewrite":"This skill equips you with reusable test patterns for Spring caching annotations without requiring full application context. It covers cache hit/miss behavior, invalidation logic, SpEL key generation, and conditional caching scenarios using in-memory CacheManager."},"files":[{"bytes":11614,"path":"plugins/developer-kit-java/skills/unit-test-caching/SKILL.md","sha256":"33ca396c703165187ab98d515a7ee201a47e6162bc1f12e0117bdd24aef4da70","url":"https://skillfed.io/files/giuseppe-trisciuoglio/developer-kit/unit-test-caching/5cf872d9/SKILL.md"}],"id":"giuseppe-trisciuoglio/developer-kit/unit-test-caching","links":{"html":"https://skillfed.io/giuseppe-trisciuoglio/developer-kit/unit-test-caching","md":"https://skillfed.io/giuseppe-trisciuoglio/developer-kit/unit-test-caching.md","repo":"https://github.com/giuseppe-trisciuoglio/developer-kit"},"meta":{"agents_supported":[],"first_seen":"2026-07-28","forks":37,"language":"Python","last_updated":"2026-06-22","license":"MIT","name":"unit-test-caching","publisher":"giuseppe-trisciuoglio","stars":311},"relations":{"similar":[{"id":"giuseppe-trisciuoglio/developer-kit/spring-boot-cache"},{"id":"pluginagentmarketplace/custom-plugin-java/java-testing"},{"id":"manutej/luxor-claude-marketplace/spring-boot-development"},{"id":"giuseppe-trisciuoglio/developer-kit/unit-test-service-layer"},{"id":"giuseppe-trisciuoglio/developer-kit/spring-boot-test-patterns"},{"id":"dawiddutoit/custom-claude/java-test-generator"},{"id":"doccker/cc-use-exp/cc-java-dev"},{"id":"josavicentevw/ai-agent-skills/testing"},{"id":"xu-xiang/everything-claude-code-zh/springboot-verification"},{"id":"affaan-m/ECC/springboot-verification"}]},"slug":{"owner":"giuseppe-trisciuoglio","repo":"developer-kit","skill":"unit-test-caching"},"version":"5cf872d9"}
