Polishing

This commit is contained in:
Sam Brannen
2023-11-30 19:04:59 +01:00
parent 8ff687b68c
commit 6ea9fdbf77
36 changed files with 126 additions and 120 deletions

View File

@@ -1056,7 +1056,7 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
return NOT_HANDLED;
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
@Nullable
public Object findInCaches(CacheOperationContext context, Cache cache, Object key,
CacheOperationInvoker invoker, Method method, CacheOperationContexts contexts) {

View File

@@ -842,7 +842,7 @@ class XmlBeanFactoryTests {
DependenciesBean rod5 = (DependenciesBean) xbf.getBean("rod5");
// Should not have been autowired
assertThat((Object) rod5.getSpouse()).isNull();
assertThat(rod5.getSpouse()).isNull();
BeanFactory appCtx = (BeanFactory) xbf.getBean("childAppCtx");
assertThat(appCtx.containsBean("rod1")).isTrue();
@@ -944,7 +944,7 @@ class XmlBeanFactoryTests {
catch (BeanCreationException ex) {
ex.printStackTrace();
assertThat(ex.toString()).contains("touchy");
assertThat((Object) ex.getRelatedCauses()).isNull();
assertThat(ex.getRelatedCauses()).isNull();
}
}

View File

@@ -29,7 +29,6 @@ import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.concurrent.ConcurrentMapCache;
import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -51,7 +50,7 @@ public class ReactiveCachingTests {
LateCacheHitDeterminationConfig.class,
LateCacheHitDeterminationWithValueWrapperConfig.class})
void cacheHitDetermination(Class<?> configClass) {
ApplicationContext ctx = new AnnotationConfigApplicationContext(configClass, ReactiveCacheableService.class);
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(configClass, ReactiveCacheableService.class);
ReactiveCacheableService service = ctx.getBean(ReactiveCacheableService.class);
Object key = new Object();
@@ -107,6 +106,8 @@ public class ReactiveCachingTests {
assertThat(r1).isNotNull();
assertThat(r1).isSameAs(r2).isSameAs(r3);
ctx.close();
}

View File

@@ -187,10 +187,10 @@ class AutowiredConfigurationTests {
System.clearProperty("myProp");
TestBean testBean = context.getBean("testBean", TestBean.class);
assertThat((Object) testBean.getName()).isNull();
assertThat(testBean.getName()).isNull();
testBean = context.getBean("testBean2", TestBean.class);
assertThat((Object) testBean.getName()).isNull();
assertThat(testBean.getName()).isNull();
System.setProperty("myProp", "foo");
@@ -203,10 +203,10 @@ class AutowiredConfigurationTests {
System.clearProperty("myProp");
testBean = context.getBean("testBean", TestBean.class);
assertThat((Object) testBean.getName()).isNull();
assertThat(testBean.getName()).isNull();
testBean = context.getBean("testBean2", TestBean.class);
assertThat((Object) testBean.getName()).isNull();
assertThat(testBean.getName()).isNull();
}
@Test

View File

@@ -57,7 +57,7 @@ public abstract class AbstractCacheTests<T extends Cache> {
String key = createRandomKey();
Object value = "george";
assertThat((Object) cache.get(key)).isNull();
assertThat(cache.get(key)).isNull();
assertThat(cache.get(key, String.class)).isNull();
assertThat(cache.get(key, Object.class)).isNull();
@@ -96,7 +96,7 @@ public abstract class AbstractCacheTests<T extends Cache> {
String key = createRandomKey();
Object value = "george";
assertThat((Object) cache.get(key)).isNull();
assertThat(cache.get(key)).isNull();
cache.put(key, value);
}
@@ -104,13 +104,13 @@ public abstract class AbstractCacheTests<T extends Cache> {
public void testCacheClear() throws Exception {
T cache = getCache();
assertThat((Object) cache.get("enescu")).isNull();
assertThat(cache.get("enescu")).isNull();
cache.put("enescu", "george");
assertThat((Object) cache.get("vlaicu")).isNull();
assertThat(cache.get("vlaicu")).isNull();
cache.put("vlaicu", "aurel");
cache.clear();
assertThat((Object) cache.get("vlaicu")).isNull();
assertThat((Object) cache.get("enescu")).isNull();
assertThat(cache.get("vlaicu")).isNull();
assertThat(cache.get("enescu")).isNull();
}
@Test
@@ -128,7 +128,7 @@ public abstract class AbstractCacheTests<T extends Cache> {
String key = createRandomKey();
assertThat((Object) cache.get(key)).isNull();
assertThat(cache.get(key)).isNull();
Object value = cache.get(key, () -> returnValue);
assertThat(value).isEqualTo(returnValue);
assertThat(cache.get(key).get()).isEqualTo(value);
@@ -161,7 +161,7 @@ public abstract class AbstractCacheTests<T extends Cache> {
T cache = getCache();
String key = createRandomKey();
assertThat((Object) cache.get(key)).isNull();
assertThat(cache.get(key)).isNull();
try {
cache.get(key, () -> {