@Test
 public void jCacheCacheWithExistingJCacheManager() {
   load(JCacheCustomCacheManager.class, "spring.cache.type=jcache");
   JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class);
   assertThat(
       cacheManager.getCacheManager(), equalTo(this.context.getBean("customJCacheCacheManager")));
 }
 @Test
 public void infinispanAsJCacheWithCaches() {
   String cachingProviderFqn = JCachingProvider.class.getName();
   load(
       DefaultCacheConfiguration.class,
       "spring.cache.type=jcache",
       "spring.cache.jcache.provider=" + cachingProviderFqn,
       "spring.cache.cacheNames[0]=foo",
       "spring.cache.cacheNames[1]=bar");
   JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class);
   assertThat(cacheManager.getCacheNames(), containsInAnyOrder("foo", "bar"));
   assertThat(cacheManager.getCacheNames(), hasSize(2));
 }
 @Test
 public void jCacheCacheWithConfig() throws IOException {
   String cachingProviderFqn = MockCachingProvider.class.getName();
   String configLocation = "org/springframework/boot/autoconfigure/cache/hazelcast-specific.xml";
   load(
       JCacheCustomConfiguration.class,
       "spring.cache.type=jcache",
       "spring.cache.jcache.provider=" + cachingProviderFqn,
       "spring.cache.jcache.config=" + configLocation);
   JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class);
   Resource configResource = new ClassPathResource(configLocation);
   assertThat(cacheManager.getCacheManager().getURI(), equalTo(configResource.getURI()));
 }
 @Test
 public void jCacheCacheWithProvider() {
   String cachingProviderFqn = MockCachingProvider.class.getName();
   load(
       DefaultCacheConfiguration.class,
       "spring.cache.type=jcache",
       "spring.cache.jcache.provider=" + cachingProviderFqn);
   JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class);
   assertThat(cacheManager.getCacheNames(), empty());
   assertThat(
       this.context.getBean(javax.cache.CacheManager.class),
       equalTo(cacheManager.getCacheManager()));
 }
 @Test
 public void jCacheCacheWithCachesAndCustomizer() {
   String cachingProviderFqn = HazelcastCachingProvider.class.getName();
   load(
       JCacheWithCustomizerConfiguration.class,
       "spring.cache.type=jcache",
       "spring.cache.jcache.provider=" + cachingProviderFqn,
       "spring.cache.cacheNames[0]=foo",
       "spring.cache.cacheNames[1]=bar");
   JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class);
   assertThat(cacheManager.getCacheNames(), containsInAnyOrder("foo", "custom1")); // see
   // customizer
   assertThat(cacheManager.getCacheNames(), hasSize(2));
 }
  @Test
  public void infinispanAsJCacheWithConfig() throws IOException {
    String cachingProviderFqn = JCachingProvider.class.getName();
    String configLocation = "infinispan.xml";
    load(
        DefaultCacheConfiguration.class,
        "spring.cache.type=jcache",
        "spring.cache.jcache.provider=" + cachingProviderFqn,
        "spring.cache.jcache.config=" + configLocation);
    JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class);

    Resource configResource = new ClassPathResource(configLocation);
    assertThat(cacheManager.getCacheManager().getURI(), equalTo(configResource.getURI()));
  }
  @Test
  public void jCacheCacheWithCachesAndCustomConfig() {
    String cachingProviderFqn = MockCachingProvider.class.getName();
    load(
        JCacheCustomConfiguration.class,
        "spring.cache.type=jcache",
        "spring.cache.jcache.provider=" + cachingProviderFqn,
        "spring.cache.cacheNames[0]=one",
        "spring.cache.cacheNames[1]=two");
    JCacheCacheManager cacheManager = validateCacheManager(JCacheCacheManager.class);
    assertThat(cacheManager.getCacheNames(), containsInAnyOrder("one", "two"));
    assertThat(cacheManager.getCacheNames(), hasSize(2));

    CompleteConfiguration<?, ?> defaultCacheConfiguration =
        this.context.getBean(CompleteConfiguration.class);
    verify(cacheManager.getCacheManager()).createCache("one", defaultCacheConfiguration);
    verify(cacheManager.getCacheManager()).createCache("two", defaultCacheConfiguration);
  }