File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
spring-context/src/test/java/org/springframework/cache Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -137,10 +137,17 @@ public void spr13081ConfigFailIfCacheResolverReturnsNullCacheName() {
137
137
public void spr14230AdaptsToOptional () {
138
138
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext (Spr14230Config .class );
139
139
Spr14230Service bean = context .getBean (Spr14230Service .class );
140
+ Cache cache = context .getBean (CacheManager .class ).getCache ("itemCache" );
140
141
141
142
TestBean tb = new TestBean ("tb1" );
142
143
bean .insertItem (tb );
143
144
assertSame (tb , bean .findById ("tb1" ).get ());
145
+ assertSame (tb , cache .get ("tb1" ).get ());
146
+
147
+ cache .clear ();
148
+ TestBean tb2 = bean .findById ("tb1" ).get ();
149
+ assertNotSame (tb , tb2 );
150
+ assertSame (tb2 , cache .get ("tb1" ).get ());
144
151
}
145
152
146
153
You can’t perform that action at this time.
0 commit comments