Beispiel #1
0
 @Test
 public void shouldAllowCacheablePutAndGet() {
   final Cache cache = newCache();
   final CacheableObj cacheable = new CacheableObj();
   cache.set(cacheable);
   MatcherAssert.assertThat(cache.get(cacheable.getKey()), Matchers.is(cacheable.getInstance()));
 }
Beispiel #2
0
 @Test
 public void shouldAllowRawPutAndGet() {
   final Cache cache = newCache();
   Object obj1 = new SerializableObj();
   cache.set("Key", obj1);
   MatcherAssert.assertThat(cache.get("Key"), Matchers.is(obj1));
 }
Beispiel #3
0
 @Test
 public void shouldOverwriteValueOnRawPut() {
   final Cache cache = newCache();
   Object obj1 = new SerializableObj();
   Object obj2 = new SerializableObj();
   cache.set("Key", obj1);
   cache.set("Key", obj2);
   MatcherAssert.assertThat(cache.get("Key"), Matchers.is(obj2));
 }
Beispiel #4
0
 @Test(expected = NullPointerException.class)
 public void shouldNotAllowCacheableGetWithNullCacheKey() {
   final Cache cache = newCache();
   CacheKey key = null;
   cache.get(key);
 }
Beispiel #5
0
 @Test(expected = NullPointerException.class)
 public void shouldNotAllowGetWithNullString() {
   final Cache cache = newCache();
   final String s = null;
   cache.get(s);
 }