use of org.springframework.boot.autoconfigure.cache.support.MockCachingProvider.MockCacheManager in project spring-boot by spring-projects.
the class CacheAutoConfigurationTests method jCacheCacheWithCachesAndCustomConfig.
@Test
void jCacheCacheWithCachesAndCustomConfig() {
String cachingProviderFqn = MockCachingProvider.class.getName();
this.contextRunner.withUserConfiguration(JCacheCustomConfiguration.class).withPropertyValues("spring.cache.type=jcache", "spring.cache.jcache.provider=" + cachingProviderFqn, "spring.cache.cacheNames[0]=one", "spring.cache.cacheNames[1]=two").run((context) -> {
JCacheCacheManager cacheManager = getCacheManager(context, JCacheCacheManager.class);
assertThat(cacheManager.getCacheNames()).containsOnly("one", "two");
CompleteConfiguration<?, ?> defaultCacheConfiguration = context.getBean(CompleteConfiguration.class);
MockCacheManager mockCacheManager = (MockCacheManager) cacheManager.getCacheManager();
assertThat(mockCacheManager.getConfigurations()).containsEntry("one", defaultCacheConfiguration).containsEntry("two", defaultCacheConfiguration);
});
}
Aggregations