View Javadoc

1   package com.atlassian.vcache.internal.core.service;
2   
3   import com.atlassian.vcache.JvmCache;
4   import com.atlassian.vcache.JvmCacheSettings;
5   import com.atlassian.vcache.VCacheException;
6   import com.atlassian.vcache.internal.test.AbstractJvmCacheTest;
7   import org.junit.Test;
8   
9   public class GuavaJvmCacheTest extends AbstractJvmCacheTest {
10      @Override
11      protected <K, V> JvmCache<K, V> createCache(String name, JvmCacheSettings settings) {
12          return new GuavaJvmCache<>(name, settings);
13      }
14  
15      @Test
16      public void detect_illegal_recursion_supplier() {
17          thrown.expect(VCacheException.class);
18          thrown.expectMessage("Supplier failed");
19  
20          final JvmCache<String, String> cache = createCache("abc");
21  
22          cache.get("first", () ->
23                  cache.get("first", () -> "fail"));
24      }
25  }