BAEL-3730: Add example of usage CacheManagerCustomizer in Spring Boot (#9048)

This commit is contained in:
kwoyke
2020-04-10 21:58:48 +02:00
committed by GitHub
parent c4bb15539e
commit bb85bd933e
4 changed files with 66 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
package com.baeldung.caching.boot;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cache.CacheManager;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class)
@SpringBootTest
public class SimpleCacheCustomizerIntegrationTest {
@Autowired
private CacheManager cacheManager;
@Test
public void givenCacheManagerCustomizerWhenBootstrappedThenCacheManagerCustomized() {
assertThat(cacheManager.getCacheNames())
.containsOnly(SimpleCacheCustomizer.USERS_CACHE, SimpleCacheCustomizer.TRANSACTIONS_CACHE);
}
}