@Test
 public void shouldCheckRepoExistenceBeforeTryingPurge()
     throws IOException, IllegalAccessException {
   factory.createSuiteTimeRepo("foo", LATEST_VERSION);
   Cache<EntryRepo> repos = (Cache<EntryRepo>) deref("cache", factory);
   List<String> keys = repos.keys();
   assertThat(keys.size(), is(1));
   String fooKey = keys.get(0);
   repos.clear();
   try {
     factory.purge(fooKey);
   } catch (IOException e) {
     e.printStackTrace();
     fail("Should not fail when trying to purge already purged entry");
   }
 }
  @Test
  public void spr14853AdaptsToOptionalWithSync() {
    AnnotationConfigApplicationContext context =
        new AnnotationConfigApplicationContext(Spr14853Config.class);
    Spr14853Service bean = context.getBean(Spr14853Service.class);
    Cache cache = context.getBean(CacheManager.class).getCache("itemCache");

    TestBean tb = new TestBean("tb1");
    bean.insertItem(tb);
    assertSame(tb, bean.findById("tb1").get());
    assertSame(tb, cache.get("tb1").get());

    cache.clear();
    TestBean tb2 = bean.findById("tb1").get();
    assertNotSame(tb, tb2);
    assertSame(tb2, cache.get("tb1").get());
  }