예제 #1
0
 @Test
 public void getOptional() {
   Cache cache = application().cache();
   assertFalse(cache.getOptional(FOO).isPresent());
   cache.set(FOO, BAR);
   assertTrue(cache.getOptional(FOO).isPresent());
   assertThat(cache.getOptional(FOO).get(), equalTo(BAR));
   cache.remove(FOO);
   assertFalse(cache.getOptional(FOO).isPresent());
 }
예제 #2
0
 @Test
 public void hasSetHasGetRemoveHas() {
   Cache cache = application().cache();
   assertFalse(cache.has(FOO));
   cache.set(FOO, BAR);
   assertTrue(cache.has(FOO));
   assertThat(cache.get(FOO), equalTo(BAR));
   cache.remove(FOO);
   assertFalse(cache.has(FOO));
 }
예제 #3
0
 @Test
 public void removeAbsent() {
   Cache cache = application().cache();
   assertFalse(cache.has(FOO));
   cache.remove(FOO);
 }