Skip to content

Commit

Permalink
Check actual cache value for unwrapped Optional
Browse files Browse the repository at this point in the history
Issue: SPR-14230
  • Loading branch information
jhoeller committed Apr 29, 2016
1 parent bd40a93 commit fdb31cd
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -137,10 +137,17 @@ public void spr13081ConfigFailIfCacheResolverReturnsNullCacheName() {
public void spr14230AdaptsToOptional() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(Spr14230Config.class);
Spr14230Service bean = context.getBean(Spr14230Service.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());
}


Expand Down

0 comments on commit fdb31cd

Please sign in to comment.