Browse Source

Polishing

pull/31736/head
Sam Brannen 2 years ago
parent
commit
6ea9fdbf77
  1. 5
      spring-context-support/src/test/java/org/springframework/cache/caffeine/CaffeineReactiveCachingTests.java
  2. 2
      spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java
  3. 4
      spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java
  4. 5
      spring-context/src/test/java/org/springframework/cache/annotation/ReactiveCachingTests.java
  5. 8
      spring-context/src/test/java/org/springframework/context/annotation/configuration/AutowiredConfigurationTests.java
  6. 16
      spring-context/src/testFixtures/java/org/springframework/context/testfixture/cache/AbstractCacheTests.java
  7. 14
      spring-core/src/test/java/org/springframework/core/GenericTypeResolverTests.java
  8. 12
      spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java
  9. 2
      spring-core/src/test/java/org/springframework/core/convert/converter/DefaultConversionServiceTests.java
  10. 21
      spring-core/src/test/java/org/springframework/core/env/MutablePropertySourcesTests.java
  11. 4
      spring-core/src/test/java/org/springframework/util/ConcurrentReferenceHashMapTests.java
  12. 2
      spring-core/src/test/java/org/springframework/util/ReflectionUtilsTests.java
  13. 2
      spring-core/src/test/java/org/springframework/util/concurrent/SettableListenableFutureTests.java
  14. 9
      spring-core/src/test/java/org/springframework/util/xml/StaxSourceTests.java
  15. 16
      spring-jdbc/src/test/java/org/springframework/jdbc/datasource/SingleConnectionDataSourceTests.java
  16. 4
      spring-messaging/src/test/java/org/springframework/messaging/simp/config/MessageBrokerConfigurationTests.java
  17. 4
      spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/DefaultStompSessionTests.java
  18. 4
      spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompHeaderAccessorTests.java
  19. 6
      spring-messaging/src/test/java/org/springframework/messaging/support/MessageHeaderAccessorTests.java
  20. 3
      spring-orm/src/test/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBeanTests.java
  21. 3
      spring-orm/src/test/java/org/springframework/orm/jpa/LocalEntityManagerFactoryBeanTests.java
  22. 2
      spring-web/src/test/java/org/springframework/http/ResponseEntityTests.java
  23. 2
      spring-web/src/test/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBeanTests.java
  24. 34
      spring-web/src/test/java/org/springframework/web/cors/reactive/DefaultCorsProcessorTests.java
  25. 6
      spring-web/src/test/java/org/springframework/web/jsf/DelegatingPhaseListenerTests.java
  26. 18
      spring-web/src/test/java/org/springframework/web/util/pattern/PathPatternTests.java
  27. 2
      spring-webflux/src/test/java/org/springframework/web/reactive/config/ResourceHandlerRegistryTests.java
  28. 4
      spring-webflux/src/test/java/org/springframework/web/reactive/resource/ResourceWebHandlerTests.java
  29. 8
      spring-webflux/src/test/java/org/springframework/web/reactive/resource/VersionResourceResolverTests.java
  30. 2
      spring-webmvc/src/test/java/org/springframework/web/servlet/DispatcherServletTests.java
  31. 6
      spring-webmvc/src/test/java/org/springframework/web/servlet/config/MvcNamespaceTests.java
  32. 2
      spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistryTests.java
  33. 2
      spring-webmvc/src/test/java/org/springframework/web/servlet/resource/ResourceUrlProviderTests.java
  34. 8
      spring-webmvc/src/test/java/org/springframework/web/servlet/resource/VersionResourceResolverTests.java
  35. 2
      spring-webmvc/src/test/java/org/springframework/web/servlet/view/ResourceBundleViewResolverTests.java
  36. 2
      spring-webmvc/src/test/java/org/springframework/web/servlet/view/json/MappingJackson2JsonViewTests.java

5
spring-context-support/src/test/java/org/springframework/cache/caffeine/CaffeineReactiveCachingTests.java vendored

@ -29,7 +29,6 @@ import org.springframework.cache.CacheManager; @@ -29,7 +29,6 @@ import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -47,7 +46,7 @@ public class CaffeineReactiveCachingTests { @@ -47,7 +46,7 @@ public class CaffeineReactiveCachingTests {
@ParameterizedTest
@ValueSource(classes = {AsyncCacheModeConfig.class, AsyncCacheModeConfig.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();
@ -103,6 +102,8 @@ public class CaffeineReactiveCachingTests { @@ -103,6 +102,8 @@ public class CaffeineReactiveCachingTests {
assertThat(r1).isNotNull();
assertThat(r1).isSameAs(r2).isSameAs(r3);
ctx.close();
}

2
spring-context/src/main/java/org/springframework/cache/interceptor/CacheAspectSupport.java vendored

@ -1056,7 +1056,7 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker @@ -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) {

4
spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java

@ -842,7 +842,7 @@ class XmlBeanFactoryTests { @@ -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 { @@ -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();
}
}

5
spring-context/src/test/java/org/springframework/cache/annotation/ReactiveCachingTests.java vendored

@ -29,7 +29,6 @@ import org.springframework.cache.Cache; @@ -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 { @@ -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 { @@ -107,6 +106,8 @@ public class ReactiveCachingTests {
assertThat(r1).isNotNull();
assertThat(r1).isSameAs(r2).isSameAs(r3);
ctx.close();
}

8
spring-context/src/test/java/org/springframework/context/annotation/configuration/AutowiredConfigurationTests.java

@ -187,10 +187,10 @@ class AutowiredConfigurationTests { @@ -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 { @@ -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

16
spring-context/src/testFixtures/java/org/springframework/context/testfixture/cache/AbstractCacheTests.java vendored

@ -57,7 +57,7 @@ public abstract class AbstractCacheTests<T extends Cache> { @@ -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> { @@ -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> { @@ -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> { @@ -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> { @@ -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, () -> {

14
spring-core/src/test/java/org/springframework/core/GenericTypeResolverTests.java

@ -66,7 +66,7 @@ class GenericTypeResolverTests { @@ -66,7 +66,7 @@ class GenericTypeResolverTests {
@Test
void nullIfNotResolvable() {
GenericClass<String> obj = new GenericClass<>();
assertThat((Object) resolveTypeArgument(obj.getClass(), GenericClass.class)).isNull();
assertThat(resolveTypeArgument(obj.getClass(), GenericClass.class)).isNull();
}
@Test
@ -148,13 +148,13 @@ class GenericTypeResolverTests { @@ -148,13 +148,13 @@ class GenericTypeResolverTests {
@Test // SPR-11030
void getGenericsCannotBeResolved() {
Class<?>[] resolved = GenericTypeResolver.resolveTypeArguments(List.class, Iterable.class);
assertThat((Object) resolved).isNull();
assertThat(resolved).isNull();
}
@Test // SPR-11052
void getRawMapTypeCannotBeResolved() {
Class<?>[] resolved = GenericTypeResolver.resolveTypeArguments(Map.class, Map.class);
assertThat((Object) resolved).isNull();
assertThat(resolved).isNull();
}
@Test // SPR-11044
@ -377,16 +377,16 @@ class GenericTypeResolverTests { @@ -377,16 +377,16 @@ class GenericTypeResolverTests {
interface IdFixingRepository<T> extends Repository<T, Long> {
}
interface First<F extends Number> {
interface First<N extends Number> {
default void foo(F f) {
default void foo(N f) {
// ...
}
}
interface Second<B> {
interface Second<T> {
default void bar(B b) {
default void bar(T b) {
// ...
}
}

12
spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java

@ -321,8 +321,8 @@ class AnnotationUtilsTests { @@ -321,8 +321,8 @@ class AnnotationUtilsTests {
@Test
void findAnnotationDeclaringClassForAllScenarios() {
// no class-level annotation
assertThat((Object) findAnnotationDeclaringClass(Transactional.class, NonAnnotatedInterface.class)).isNull();
assertThat((Object) findAnnotationDeclaringClass(Transactional.class, NonAnnotatedClass.class)).isNull();
assertThat(findAnnotationDeclaringClass(Transactional.class, NonAnnotatedInterface.class)).isNull();
assertThat(findAnnotationDeclaringClass(Transactional.class, NonAnnotatedClass.class)).isNull();
// inherited class-level annotation; note: @Transactional is inherited
assertThat(findAnnotationDeclaringClass(Transactional.class, InheritedAnnotationInterface.class)).isEqualTo(InheritedAnnotationInterface.class);
@ -342,8 +342,8 @@ class AnnotationUtilsTests { @@ -342,8 +342,8 @@ class AnnotationUtilsTests {
void findAnnotationDeclaringClassForTypesWithSingleCandidateType() {
// no class-level annotation
List<Class<? extends Annotation>> transactionalCandidateList = Collections.singletonList(Transactional.class);
assertThat((Object) findAnnotationDeclaringClassForTypes(transactionalCandidateList, NonAnnotatedInterface.class)).isNull();
assertThat((Object) findAnnotationDeclaringClassForTypes(transactionalCandidateList, NonAnnotatedClass.class)).isNull();
assertThat(findAnnotationDeclaringClassForTypes(transactionalCandidateList, NonAnnotatedInterface.class)).isNull();
assertThat(findAnnotationDeclaringClassForTypes(transactionalCandidateList, NonAnnotatedClass.class)).isNull();
// inherited class-level annotation; note: @Transactional is inherited
assertThat(findAnnotationDeclaringClassForTypes(transactionalCandidateList, InheritedAnnotationInterface.class)).isEqualTo(InheritedAnnotationInterface.class);
@ -365,8 +365,8 @@ class AnnotationUtilsTests { @@ -365,8 +365,8 @@ class AnnotationUtilsTests {
List<Class<? extends Annotation>> candidates = asList(Transactional.class, Order.class);
// no class-level annotation
assertThat((Object) findAnnotationDeclaringClassForTypes(candidates, NonAnnotatedInterface.class)).isNull();
assertThat((Object) findAnnotationDeclaringClassForTypes(candidates, NonAnnotatedClass.class)).isNull();
assertThat(findAnnotationDeclaringClassForTypes(candidates, NonAnnotatedInterface.class)).isNull();
assertThat(findAnnotationDeclaringClassForTypes(candidates, NonAnnotatedClass.class)).isNull();
// inherited class-level annotation; note: @Transactional is inherited
assertThat(findAnnotationDeclaringClassForTypes(candidates, InheritedAnnotationInterface.class)).isEqualTo(InheritedAnnotationInterface.class);

2
spring-core/src/test/java/org/springframework/core/convert/converter/DefaultConversionServiceTests.java

@ -862,7 +862,7 @@ class DefaultConversionServiceTests { @@ -862,7 +862,7 @@ class DefaultConversionServiceTests {
void convertObjectToObjectFinderMethodWithNull() {
TestEntity entity = (TestEntity) conversionService.convert(null,
TypeDescriptor.valueOf(String.class), TypeDescriptor.valueOf(TestEntity.class));
assertThat((Object) entity).isNull();
assertThat(entity).isNull();
}
@Test

21
spring-core/src/test/java/org/springframework/core/env/MutablePropertySourcesTests.java vendored

@ -99,12 +99,12 @@ class MutablePropertySourcesTests { @@ -99,12 +99,12 @@ class MutablePropertySourcesTests {
assertThat(sources).hasSize(6);
assertThat(sources.contains("a")).isFalse();
assertThat((Object) sources.remove("a")).isNull();
assertThat(sources.remove("a")).isNull();
assertThat(sources).hasSize(6);
String bogusPS = "bogus";
assertThatIllegalArgumentException().isThrownBy(() ->
sources.addAfter(bogusPS, new MockPropertySource("h")))
assertThatIllegalArgumentException()
.isThrownBy(() -> sources.addAfter(bogusPS, new MockPropertySource("h")))
.withMessageContaining("does not exist");
sources.addFirst(new MockPropertySource("a"));
@ -121,16 +121,16 @@ class MutablePropertySourcesTests { @@ -121,16 +121,16 @@ class MutablePropertySourcesTests {
sources.replace("a-replaced", new MockPropertySource("a"));
assertThatIllegalArgumentException().isThrownBy(() ->
sources.replace(bogusPS, new MockPropertySource("bogus-replaced")))
assertThatIllegalArgumentException()
.isThrownBy(() -> sources.replace(bogusPS, new MockPropertySource("bogus-replaced")))
.withMessageContaining("does not exist");
assertThatIllegalArgumentException().isThrownBy(() ->
sources.addBefore("b", new MockPropertySource("b")))
assertThatIllegalArgumentException()
.isThrownBy(() -> sources.addBefore("b", new MockPropertySource("b")))
.withMessageContaining("cannot be added relative to itself");
assertThatIllegalArgumentException().isThrownBy(() ->
sources.addAfter("b", new MockPropertySource("b")))
assertThatIllegalArgumentException()
.isThrownBy(() -> sources.addAfter("b", new MockPropertySource("b")))
.withMessageContaining("cannot be added relative to itself");
}
@ -149,8 +149,7 @@ class MutablePropertySourcesTests { @@ -149,8 +149,7 @@ class MutablePropertySourcesTests {
assertThat(it.hasNext()).isTrue();
assertThat(it.next().getName()).isEqualTo("test");
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(
it::remove);
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(it::remove);
assertThat(it.hasNext()).isFalse();
}

4
spring-core/src/test/java/org/springframework/util/ConcurrentReferenceHashMapTests.java

@ -522,10 +522,6 @@ class ConcurrentReferenceHashMapTests { @@ -522,10 +522,6 @@ class ConcurrentReferenceHashMapTests {
super(initialCapacity, loadFactor, concurrencyLevel);
}
public TestWeakConcurrentCache(int initialCapacity, int concurrencyLevel) {
super(initialCapacity, concurrencyLevel);
}
@Override
protected int getHash(@Nullable Object o) {
// For testing we want more control of the hash

2
spring-core/src/test/java/org/springframework/util/ReflectionUtilsTests.java

@ -73,7 +73,7 @@ class ReflectionUtilsTests { @@ -73,7 +73,7 @@ class ReflectionUtilsTests {
assertThat(testBean.getName()).isEqualTo("FooBar");
ReflectionUtils.setField(field, testBean, null);
assertThat((Object) testBean.getName()).isNull();
assertThat(testBean.getName()).isNull();
}
@Test

2
spring-core/src/test/java/org/springframework/util/concurrent/SettableListenableFutureTests.java

@ -221,7 +221,7 @@ class SettableListenableFutureTests { @@ -221,7 +221,7 @@ class SettableListenableFutureTests {
@Test
void nullIsAcceptedAsValueToSet() throws ExecutionException, InterruptedException {
settableListenableFuture.set(null);
assertThat((Object) settableListenableFuture.get()).isNull();
assertThat(settableListenableFuture.get()).isNull();
assertThat(settableListenableFuture.isCancelled()).isFalse();
assertThat(settableListenableFuture.isDone()).isTrue();
}

9
spring-core/src/test/java/org/springframework/util/xml/StaxSourceTests.java

@ -66,7 +66,7 @@ class StaxSourceTests { @@ -66,7 +66,7 @@ class StaxSourceTests {
XMLStreamReader streamReader = inputFactory.createXMLStreamReader(new StringReader(XML));
StaxSource source = new StaxSource(streamReader);
assertThat(source.getXMLStreamReader()).as("Invalid streamReader returned").isEqualTo(streamReader);
assertThat((Object) source.getXMLEventReader()).as("EventReader returned").isNull();
assertThat(source.getXMLEventReader()).as("EventReader returned").isNull();
StringWriter writer = new StringWriter();
transformer.transform(source, new StreamResult(writer));
assertThat(XmlContent.from(writer)).as("Invalid result").isSimilarTo(XML);
@ -77,7 +77,7 @@ class StaxSourceTests { @@ -77,7 +77,7 @@ class StaxSourceTests {
XMLStreamReader streamReader = inputFactory.createXMLStreamReader(new StringReader(XML));
StaxSource source = new StaxSource(streamReader);
assertThat(source.getXMLStreamReader()).as("Invalid streamReader returned").isEqualTo(streamReader);
assertThat((Object) source.getXMLEventReader()).as("EventReader returned").isNull();
assertThat(source.getXMLEventReader()).as("EventReader returned").isNull();
Document expected = documentBuilder.parse(new InputSource(new StringReader(XML)));
Document result = documentBuilder.newDocument();
@ -89,7 +89,7 @@ class StaxSourceTests { @@ -89,7 +89,7 @@ class StaxSourceTests {
void eventReaderSourceToStreamResult() throws Exception {
XMLEventReader eventReader = inputFactory.createXMLEventReader(new StringReader(XML));
StaxSource source = new StaxSource(eventReader);
assertThat((Object) source.getXMLEventReader()).as("Invalid eventReader returned").isEqualTo(eventReader);
assertThat(source.getXMLEventReader()).as("Invalid eventReader returned").isEqualTo(eventReader);
assertThat(source.getXMLStreamReader()).as("StreamReader returned").isNull();
StringWriter writer = new StringWriter();
transformer.transform(source, new StreamResult(writer));
@ -100,7 +100,7 @@ class StaxSourceTests { @@ -100,7 +100,7 @@ class StaxSourceTests {
void eventReaderSourceToDOMResult() throws Exception {
XMLEventReader eventReader = inputFactory.createXMLEventReader(new StringReader(XML));
StaxSource source = new StaxSource(eventReader);
assertThat((Object) source.getXMLEventReader()).as("Invalid eventReader returned").isEqualTo(eventReader);
assertThat(source.getXMLEventReader()).as("Invalid eventReader returned").isEqualTo(eventReader);
assertThat(source.getXMLStreamReader()).as("StreamReader returned").isNull();
Document expected = documentBuilder.parse(new InputSource(new StringReader(XML)));
@ -108,4 +108,5 @@ class StaxSourceTests { @@ -108,4 +108,5 @@ class StaxSourceTests {
transformer.transform(source, new DOMResult(result));
assertThat(XmlContent.of(result)).as("Invalid result").isSimilarTo(expected);
}
}

16
spring-jdbc/src/test/java/org/springframework/jdbc/datasource/SingleConnectionDataSourceTests.java

@ -33,13 +33,14 @@ import static org.mockito.Mockito.verify; @@ -33,13 +33,14 @@ import static org.mockito.Mockito.verify;
* @author Juergen Hoeller
* @since 6.1.2
*/
public class SingleConnectionDataSourceTests {
class SingleConnectionDataSourceTests {
private final Connection connection = mock();
@Test
public void plainConnection() throws Exception {
@SuppressWarnings("resource")
void plainConnection() throws Exception {
SingleConnectionDataSource ds = new SingleConnectionDataSource(connection, false);
ds.getConnection().close();
@ -47,7 +48,7 @@ public class SingleConnectionDataSourceTests { @@ -47,7 +48,7 @@ public class SingleConnectionDataSourceTests {
}
@Test
public void withAutoCloseable() throws Exception {
void withAutoCloseable() throws Exception {
try (SingleConnectionDataSource ds = new SingleConnectionDataSource(connection, false)) {
ds.getConnection();
}
@ -56,7 +57,8 @@ public class SingleConnectionDataSourceTests { @@ -56,7 +57,8 @@ public class SingleConnectionDataSourceTests {
}
@Test
public void withSuppressClose() throws Exception {
@SuppressWarnings("resource")
void withSuppressClose() throws Exception {
SingleConnectionDataSource ds = new SingleConnectionDataSource(connection, true);
ds.getConnection().close();
@ -70,7 +72,8 @@ public class SingleConnectionDataSourceTests { @@ -70,7 +72,8 @@ public class SingleConnectionDataSourceTests {
}
@Test
public void withRollbackBeforeClose() throws Exception {
@SuppressWarnings("resource")
void withRollbackBeforeClose() throws Exception {
SingleConnectionDataSource ds = new SingleConnectionDataSource(connection, true);
ds.setRollbackBeforeClose(true);
@ -80,7 +83,8 @@ public class SingleConnectionDataSourceTests { @@ -80,7 +83,8 @@ public class SingleConnectionDataSourceTests {
}
@Test
public void withEnforcedAutoCommit() throws Exception {
@SuppressWarnings("resource")
void withEnforcedAutoCommit() throws Exception {
SingleConnectionDataSource ds = new SingleConnectionDataSource() {
@Override
protected Connection getConnectionFromDriverManager(String url, Properties props) {

4
spring-messaging/src/test/java/org/springframework/messaging/simp/config/MessageBrokerConfigurationTests.java

@ -225,7 +225,7 @@ public class MessageBrokerConfigurationTests { @@ -225,7 +225,7 @@ public class MessageBrokerConfigurationTests {
assertThat(handlers.contains(context.getBean(UserDestinationMessageHandler.class))).isTrue();
assertThat(handlers.contains(context.getBean(SimpleBrokerMessageHandler.class))).isTrue();
assertThat((Object) channel.getExecutor()).isNull();
assertThat(channel.getExecutor()).isNull();
}
@Test
@ -479,7 +479,7 @@ public class MessageBrokerConfigurationTests { @@ -479,7 +479,7 @@ public class MessageBrokerConfigurationTests {
assertThat(registry.getClass()).isNotEqualTo(MultiServerUserRegistry.class);
UserDestinationMessageHandler handler = context.getBean(UserDestinationMessageHandler.class);
assertThat((Object) handler.getBroadcastDestination()).isNull();
assertThat(handler.getBroadcastDestination()).isNull();
Object nullBean = context.getBean("userRegistryMessageHandler");
assertThat(nullBean.equals(null)).isTrue();

4
spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/DefaultStompSessionTests.java

@ -586,7 +586,7 @@ public class DefaultStompSessionTests { @@ -586,7 +586,7 @@ public class DefaultStompSessionTests {
receivedHeaders.set(receiptHeaders);
});
assertThat((Object) received.get()).isNull();
assertThat(received.get()).isNull();
StompHeaderAccessor accessor = StompHeaderAccessor.create(StompCommand.RECEIPT);
accessor.setReceiptId("my-receipt");
@ -656,7 +656,7 @@ public class DefaultStompSessionTests { @@ -656,7 +656,7 @@ public class DefaultStompSessionTests {
Runnable scheduledTask = taskCaptor.getValue();
assertThat(scheduledTask).isNotNull();
assertThat((Object) notReceived.get()).isNull();
assertThat(notReceived.get()).isNull();
scheduledTask.run();
assertThat(notReceived.get()).isTrue();

4
spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompHeaderAccessorTests.java

@ -205,8 +205,8 @@ public class StompHeaderAccessorTests { @@ -205,8 +205,8 @@ public class StompHeaderAccessorTests {
StompHeaderAccessor headerAccessor = StompHeaderAccessor.create(StompCommand.SEND);
MessageHeaders headers = headerAccessor.getMessageHeaders();
assertThat((Object) headers.getId()).isNull();
assertThat((Object) headers.getTimestamp()).isNull();
assertThat(headers.getId()).isNull();
assertThat(headers.getTimestamp()).isNull();
}
@Test

6
spring-messaging/src/test/java/org/springframework/messaging/support/MessageHeaderAccessorTests.java

@ -265,7 +265,7 @@ public class MessageHeaderAccessorTests { @@ -265,7 +265,7 @@ public class MessageHeaderAccessorTests {
@Test
public void timestampDefaultBehavior() {
MessageHeaderAccessor accessor = new MessageHeaderAccessor();
assertThat((Object) accessor.getMessageHeaders().getTimestamp()).isNull();
assertThat(accessor.getMessageHeaders().getTimestamp()).isNull();
}
@Test
@ -291,8 +291,8 @@ public class MessageHeaderAccessorTests { @@ -291,8 +291,8 @@ public class MessageHeaderAccessorTests {
accessor.setLeaveMutable(true);
MessageHeaders headers = accessor.getMessageHeaders();
assertThat((Object) headers.getId()).isNull();
assertThat((Object) headers.getTimestamp()).isNull();
assertThat(headers.getId()).isNull();
assertThat(headers.getTimestamp()).isNull();
final UUID id = new UUID(0L, 23L);
accessor.setIdGenerator(() -> id);

3
spring-orm/src/test/java/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBeanTests.java

@ -253,6 +253,7 @@ public class LocalContainerEntityManagerFactoryBeanTests extends AbstractEntityM @@ -253,6 +253,7 @@ public class LocalContainerEntityManagerFactoryBeanTests extends AbstractEntityM
createEntityManagerFactoryBean("org/springframework/orm/jpa/domain/persistence.xml", null, "call me Bob"));
}
@SuppressWarnings("unchecked")
protected LocalContainerEntityManagerFactoryBean createEntityManagerFactoryBean(
String persistenceXml, Properties props, String entityManagerName) throws Exception {
@ -273,7 +274,7 @@ public class LocalContainerEntityManagerFactoryBeanTests extends AbstractEntityM @@ -273,7 +274,7 @@ public class LocalContainerEntityManagerFactoryBeanTests extends AbstractEntityM
assertThat(actualPui.getPersistenceUnitName()).isEqualTo(entityManagerName);
if (props != null) {
assertThat((Object) actualProps).isEqualTo(props);
assertThat(actualProps).isEqualTo(props);
}
//checkInvariants(containerEmfb);

3
spring-orm/src/test/java/org/springframework/orm/jpa/LocalEntityManagerFactoryBeanTests.java

@ -57,6 +57,7 @@ public class LocalEntityManagerFactoryBeanTests extends AbstractEntityManagerFac @@ -57,6 +57,7 @@ public class LocalEntityManagerFactoryBeanTests extends AbstractEntityManagerFac
testValidUsage(new Properties());
}
@SuppressWarnings("unchecked")
protected void testValidUsage(Properties props) throws Exception {
// This will be set by DummyPersistenceProvider
actualName = null;
@ -74,7 +75,7 @@ public class LocalEntityManagerFactoryBeanTests extends AbstractEntityManagerFac @@ -74,7 +75,7 @@ public class LocalEntityManagerFactoryBeanTests extends AbstractEntityManagerFac
assertThat(actualName).isSameAs(entityManagerName);
if (props != null) {
assertThat((Object) actualProps).isEqualTo(props);
assertThat(actualProps).isEqualTo(props);
}
checkInvariants(lemfb);

2
spring-web/src/test/java/org/springframework/http/ResponseEntityTests.java

@ -208,7 +208,7 @@ class ResponseEntityTests { @@ -208,7 +208,7 @@ class ResponseEntityTests {
assertThat(responseHeaders.getFirst(HttpHeaders.CONTENT_LENGTH)).isEqualTo(String.valueOf(contentLength));
assertThat(responseHeaders.getFirst(HttpHeaders.CONTENT_TYPE)).isEqualTo(contentType.toString());
assertThat((Object) responseEntity.getBody()).isNull();
assertThat(responseEntity.getBody()).isNull();
}
@Test

2
spring-web/src/test/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBeanTests.java

@ -209,7 +209,7 @@ public class Jackson2ObjectMapperFactoryBeanTests { @@ -209,7 +209,7 @@ public class Jackson2ObjectMapperFactoryBeanTests {
@Test
public void undefinedObjectType() {
assertThat((Object) this.factory.getObjectType()).isNull();
assertThat(this.factory.getObjectType()).isNull();
}
private static SerializerFactoryConfig getSerializerFactoryConfig(ObjectMapper objectMapper) {

34
spring-web/src/test/java/org/springframework/web/cors/reactive/DefaultCorsProcessorTests.java

@ -68,7 +68,7 @@ public class DefaultCorsProcessorTests { @@ -68,7 +68,7 @@ public class DefaultCorsProcessorTests {
assertThat(response.getHeaders().containsKey(ACCESS_CONTROL_ALLOW_ORIGIN)).isFalse();
assertThat(response.getHeaders().get(VARY)).contains(ORIGIN,
ACCESS_CONTROL_REQUEST_METHOD, ACCESS_CONTROL_REQUEST_HEADERS);
assertThat((Object) response.getStatusCode()).isNull();
assertThat(response.getStatusCode()).isNull();
}
@Test
@ -84,7 +84,7 @@ public class DefaultCorsProcessorTests { @@ -84,7 +84,7 @@ public class DefaultCorsProcessorTests {
assertThat(response.getHeaders().containsKey(ACCESS_CONTROL_ALLOW_ORIGIN)).isFalse();
assertThat(response.getHeaders().get(VARY)).contains(ORIGIN,
ACCESS_CONTROL_REQUEST_METHOD, ACCESS_CONTROL_REQUEST_HEADERS);
assertThat((Object) response.getStatusCode()).isNull();
assertThat(response.getStatusCode()).isNull();
}
@Test
@ -106,7 +106,7 @@ public class DefaultCorsProcessorTests { @@ -106,7 +106,7 @@ public class DefaultCorsProcessorTests {
ServerHttpResponse response = exchange.getResponse();
assertThat(response.getHeaders().containsKey(ACCESS_CONTROL_ALLOW_ORIGIN)).isFalse();
assertThat((Object) response.getStatusCode()).isNull();
assertThat(response.getStatusCode()).isNull();
}
@Test
@ -122,7 +122,7 @@ public class DefaultCorsProcessorTests { @@ -122,7 +122,7 @@ public class DefaultCorsProcessorTests {
assertThat(response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS)).isFalse();
assertThat(response.getHeaders().get(VARY)).contains(ORIGIN,
ACCESS_CONTROL_REQUEST_METHOD, ACCESS_CONTROL_REQUEST_HEADERS);
assertThat((Object) response.getStatusCode()).isNull();
assertThat(response.getStatusCode()).isNull();
}
@Test
@ -141,7 +141,7 @@ public class DefaultCorsProcessorTests { @@ -141,7 +141,7 @@ public class DefaultCorsProcessorTests {
assertThat(response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS)).isEqualTo("true");
assertThat(response.getHeaders().get(VARY)).contains(ORIGIN,
ACCESS_CONTROL_REQUEST_METHOD, ACCESS_CONTROL_REQUEST_HEADERS);
assertThat((Object) response.getStatusCode()).isNull();
assertThat(response.getStatusCode()).isNull();
}
@Test
@ -162,7 +162,7 @@ public class DefaultCorsProcessorTests { @@ -162,7 +162,7 @@ public class DefaultCorsProcessorTests {
assertThat(response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS)).isEqualTo("true");
assertThat(response.getHeaders().get(VARY)).contains(ORIGIN,
ACCESS_CONTROL_REQUEST_METHOD, ACCESS_CONTROL_REQUEST_HEADERS);
assertThat((Object) response.getStatusCode()).isNull();
assertThat(response.getStatusCode()).isNull();
}
@Test
@ -172,7 +172,7 @@ public class DefaultCorsProcessorTests { @@ -172,7 +172,7 @@ public class DefaultCorsProcessorTests {
this.processor.process(this.conf, exchange);
ServerHttpResponse response = exchange.getResponse();
assertThat((Object) response.getStatusCode()).isNull();
assertThat(response.getStatusCode()).isNull();
assertThat(response.getHeaders().containsKey(ACCESS_CONTROL_ALLOW_ORIGIN)).isTrue();
}
@ -186,7 +186,7 @@ public class DefaultCorsProcessorTests { @@ -186,7 +186,7 @@ public class DefaultCorsProcessorTests {
this.processor.process(this.conf, exchange);
ServerHttpResponse response = exchange.getResponse();
assertThat((Object) response.getStatusCode()).isNull();
assertThat(response.getStatusCode()).isNull();
assertThat(response.getHeaders().containsKey(ACCESS_CONTROL_ALLOW_ORIGIN)).isTrue();
}
@ -206,7 +206,7 @@ public class DefaultCorsProcessorTests { @@ -206,7 +206,7 @@ public class DefaultCorsProcessorTests {
assertThat(response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS)).contains("header2");
assertThat(response.getHeaders().get(VARY)).contains(ORIGIN,
ACCESS_CONTROL_REQUEST_METHOD, ACCESS_CONTROL_REQUEST_HEADERS);
assertThat((Object) response.getStatusCode()).isNull();
assertThat(response.getStatusCode()).isNull();
}
@Test
@ -219,7 +219,7 @@ public class DefaultCorsProcessorTests { @@ -219,7 +219,7 @@ public class DefaultCorsProcessorTests {
ServerHttpResponse response = exchange.getResponse();
assertThat(response.getHeaders().get(VARY)).contains(ORIGIN,
ACCESS_CONTROL_REQUEST_METHOD, ACCESS_CONTROL_REQUEST_HEADERS);
assertThat((Object) response.getStatusCode()).isNull();
assertThat(response.getStatusCode()).isNull();
}
@ -244,7 +244,7 @@ public class DefaultCorsProcessorTests { @@ -244,7 +244,7 @@ public class DefaultCorsProcessorTests {
this.processor.process(this.conf, exchange);
ServerHttpResponse response = exchange.getResponse();
assertThat((Object) response.getStatusCode()).isNull();
assertThat(response.getStatusCode()).isNull();
assertThat(response.getHeaders().get(VARY)).contains(ORIGIN,
ACCESS_CONTROL_REQUEST_METHOD, ACCESS_CONTROL_REQUEST_HEADERS);
assertThat(response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS)).isEqualTo("GET,HEAD");
@ -312,7 +312,7 @@ public class DefaultCorsProcessorTests { @@ -312,7 +312,7 @@ public class DefaultCorsProcessorTests {
assertThat(response.getHeaders().containsKey(HttpHeaders.ACCESS_CONTROL_MAX_AGE)).isFalse();
assertThat(response.getHeaders().get(VARY)).contains(ORIGIN,
ACCESS_CONTROL_REQUEST_METHOD, ACCESS_CONTROL_REQUEST_HEADERS);
assertThat((Object) response.getStatusCode()).isNull();
assertThat(response.getStatusCode()).isNull();
}
@Test
@ -336,7 +336,7 @@ public class DefaultCorsProcessorTests { @@ -336,7 +336,7 @@ public class DefaultCorsProcessorTests {
assertThat(response.getHeaders().getFirst(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS)).isEqualTo("true");
assertThat(response.getHeaders().get(VARY)).contains(ORIGIN,
ACCESS_CONTROL_REQUEST_METHOD, ACCESS_CONTROL_REQUEST_HEADERS);
assertThat((Object) response.getStatusCode()).isNull();
assertThat(response.getStatusCode()).isNull();
}
@Test
@ -361,7 +361,7 @@ public class DefaultCorsProcessorTests { @@ -361,7 +361,7 @@ public class DefaultCorsProcessorTests {
assertThat(response.getHeaders().getFirst(ACCESS_CONTROL_ALLOW_ORIGIN)).isEqualTo("https://domain2.com");
assertThat(response.getHeaders().get(VARY)).contains(ORIGIN,
ACCESS_CONTROL_REQUEST_METHOD, ACCESS_CONTROL_REQUEST_HEADERS);
assertThat((Object) response.getStatusCode()).isNull();
assertThat(response.getStatusCode()).isNull();
}
@Test
@ -385,7 +385,7 @@ public class DefaultCorsProcessorTests { @@ -385,7 +385,7 @@ public class DefaultCorsProcessorTests {
assertThat(response.getHeaders().getFirst(ACCESS_CONTROL_ALLOW_HEADERS)).doesNotContain("Header3");
assertThat(response.getHeaders().get(VARY)).contains(ORIGIN,
ACCESS_CONTROL_REQUEST_METHOD, ACCESS_CONTROL_REQUEST_HEADERS);
assertThat((Object) response.getStatusCode()).isNull();
assertThat(response.getStatusCode()).isNull();
}
@Test
@ -407,7 +407,7 @@ public class DefaultCorsProcessorTests { @@ -407,7 +407,7 @@ public class DefaultCorsProcessorTests {
assertThat(response.getHeaders().getFirst(ACCESS_CONTROL_ALLOW_HEADERS)).doesNotContain("*");
assertThat(response.getHeaders().get(VARY)).contains(ORIGIN,
ACCESS_CONTROL_REQUEST_METHOD, ACCESS_CONTROL_REQUEST_HEADERS);
assertThat((Object) response.getStatusCode()).isNull();
assertThat(response.getStatusCode()).isNull();
}
@Test
@ -426,7 +426,7 @@ public class DefaultCorsProcessorTests { @@ -426,7 +426,7 @@ public class DefaultCorsProcessorTests {
assertThat(response.getHeaders().containsKey(ACCESS_CONTROL_ALLOW_HEADERS)).isFalse();
assertThat(response.getHeaders().get(VARY)).contains(ORIGIN,
ACCESS_CONTROL_REQUEST_METHOD, ACCESS_CONTROL_REQUEST_HEADERS);
assertThat((Object) response.getStatusCode()).isNull();
assertThat(response.getStatusCode()).isNull();
}
@Test

6
spring-web/src/test/java/org/springframework/web/jsf/DelegatingPhaseListenerTests.java

@ -45,12 +45,13 @@ public class DelegatingPhaseListenerTests { @@ -45,12 +45,13 @@ public class DelegatingPhaseListenerTests {
}
};
@SuppressWarnings("unchecked")
@Test
public void beforeAndAfterPhaseWithSingleTarget() {
TestListener target = new TestListener();
beanFactory.addBean("testListener", target);
assertThat((Object) delPhaseListener.getPhaseId()).isEqualTo(PhaseId.ANY_PHASE);
assertThat(delPhaseListener.getPhaseId()).isEqualTo(PhaseId.ANY_PHASE);
PhaseEvent event = new PhaseEvent(facesContext, PhaseId.INVOKE_APPLICATION, new MockLifecycle());
delPhaseListener.beforePhase(event);
@ -60,6 +61,7 @@ public class DelegatingPhaseListenerTests { @@ -60,6 +61,7 @@ public class DelegatingPhaseListenerTests {
assertThat(target.afterCalled).isTrue();
}
@SuppressWarnings("unchecked")
@Test
public void beforeAndAfterPhaseWithMultipleTargets() {
TestListener target1 = new TestListener();
@ -67,7 +69,7 @@ public class DelegatingPhaseListenerTests { @@ -67,7 +69,7 @@ public class DelegatingPhaseListenerTests {
beanFactory.addBean("testListener1", target1);
beanFactory.addBean("testListener2", target2);
assertThat((Object) delPhaseListener.getPhaseId()).isEqualTo(PhaseId.ANY_PHASE);
assertThat(delPhaseListener.getPhaseId()).isEqualTo(PhaseId.ANY_PHASE);
PhaseEvent event = new PhaseEvent(facesContext, PhaseId.INVOKE_APPLICATION, new MockLifecycle());
delPhaseListener.beforePhase(event);

18
spring-web/src/test/java/org/springframework/web/util/pattern/PathPatternTests.java

@ -361,10 +361,10 @@ public class PathPatternTests { @@ -361,10 +361,10 @@ public class PathPatternTests {
@Test
public void pathRemainingCornerCases_spr15336() {
// No match when the literal path element is a longer form of the segment in the pattern
assertThat((Object) parse("/foo").matchStartOfPath(toPathContainer("/footastic/bar"))).isNull();
assertThat((Object) parse("/f?o").matchStartOfPath(toPathContainer("/footastic/bar"))).isNull();
assertThat((Object) parse("/f*o*p").matchStartOfPath(toPathContainer("/flooptastic/bar"))).isNull();
assertThat((Object) parse("/{abc}abc").matchStartOfPath(toPathContainer("/xyzabcbar/bar"))).isNull();
assertThat(parse("/foo").matchStartOfPath(toPathContainer("/footastic/bar"))).isNull();
assertThat(parse("/f?o").matchStartOfPath(toPathContainer("/footastic/bar"))).isNull();
assertThat(parse("/f*o*p").matchStartOfPath(toPathContainer("/flooptastic/bar"))).isNull();
assertThat(parse("/{abc}abc").matchStartOfPath(toPathContainer("/xyzabcbar/bar"))).isNull();
// With a /** on the end have to check if there is any more data post
// 'the match' it starts with a separator
@ -614,7 +614,7 @@ public class PathPatternTests { @@ -614,7 +614,7 @@ public class PathPatternTests {
pp = parse("/*/{foo}/b*");
pri = getPathRemaining(pp, "/foo");
assertThat((Object) pri).isNull();
assertThat(pri).isNull();
pri = getPathRemaining(pp, "/abc/def/bhi");
assertThat(pri.getPathRemaining().value()).isEmpty();
assertThat(pri.getUriVariables()).containsEntry("foo", "def");
@ -838,8 +838,8 @@ public class PathPatternTests { @@ -838,8 +838,8 @@ public class PathPatternTests {
checkCapture("/A-{B}-C", "/A-b-C", "B", "b");
checkCapture("/{name}.{extension}", "/test.html", "name", "test", "extension", "html");
assertThat((Object) checkCapture("/{one}/", "//")).isNull();
assertThat((Object) checkCapture("", "/abc")).isNull();
assertThat(checkCapture("/{one}/", "//")).isNull();
assertThat(checkCapture("", "/abc")).isNull();
assertThat(checkCapture("", "").getUriVariables()).isEmpty();
checkCapture("{id}", "99", "id", "99");
@ -1043,8 +1043,8 @@ public class PathPatternTests { @@ -1043,8 +1043,8 @@ public class PathPatternTests {
paths.add(null);
paths.add(null);
paths.sort(comparator);
assertThat((Object) paths.get(0)).isNull();
assertThat((Object) paths.get(1)).isNull();
assertThat(paths.get(0)).isNull();
assertThat(paths.get(1)).isNull();
paths.clear();
paths.add(null);

2
spring-webflux/src/test/java/org/springframework/web/reactive/config/ResourceHandlerRegistryTests.java

@ -75,7 +75,7 @@ class ResourceHandlerRegistryTests { @@ -75,7 +75,7 @@ class ResourceHandlerRegistryTests {
@Test
void noResourceHandlers() {
this.registry = new ResourceHandlerRegistry(new GenericApplicationContext());
assertThat((Object) this.registry.getHandlerMapping()).isNull();
assertThat(this.registry.getHandlerMapping()).isNull();
}
@Test

4
spring-webflux/src/test/java/org/springframework/web/reactive/resource/ResourceWebHandlerTests.java

@ -495,7 +495,7 @@ class ResourceWebHandlerTests { @@ -495,7 +495,7 @@ class ResourceWebHandlerTests {
setBestMachingPattern(exchange, "/**");
this.handler.handle(exchange).block(TIMEOUT);
assertThat((Object) exchange.getResponse().getStatusCode()).isNull();
assertThat(exchange.getResponse().getStatusCode()).isNull();
assertResponseBody(exchange, "h1 { color:red; }");
}
@ -522,7 +522,7 @@ class ResourceWebHandlerTests { @@ -522,7 +522,7 @@ class ResourceWebHandlerTests {
setPathWithinHandlerMapping(exchange, "foo.css");
setBestMachingPattern(exchange, "/**");
this.handler.handle(exchange).block(TIMEOUT);
assertThat((Object) exchange.getResponse().getStatusCode()).isNull();
assertThat(exchange.getResponse().getStatusCode()).isNull();
assertResponseBody(exchange, "h1 { color:red; }");
}

8
spring-webflux/src/test/java/org/springframework/web/reactive/resource/VersionResourceResolverTests.java

@ -84,7 +84,7 @@ class VersionResourceResolverTests { @@ -84,7 +84,7 @@ class VersionResourceResolverTests {
.resolveResourceInternal(null, file, this.locations, this.chain)
.block(Duration.ofMillis(5000));
assertThat((Object) actual).isNull();
assertThat(actual).isNull();
verify(this.chain, times(1)).resolveResource(null, file, this.locations);
}
@ -99,7 +99,7 @@ class VersionResourceResolverTests { @@ -99,7 +99,7 @@ class VersionResourceResolverTests {
.resolveResourceInternal(null, file, this.locations, this.chain)
.block(Duration.ofMillis(5000));
assertThat((Object) actual).isNull();
assertThat(actual).isNull();
verify(this.chain, times(1)).resolveResource(null, file, this.locations);
verify(this.versionStrategy, times(1)).extractVersion(file);
}
@ -119,7 +119,7 @@ class VersionResourceResolverTests { @@ -119,7 +119,7 @@ class VersionResourceResolverTests {
.resolveResourceInternal(null, versionFile, this.locations, this.chain)
.block(Duration.ofMillis(5000));
assertThat((Object) actual).isNull();
assertThat(actual).isNull();
verify(this.versionStrategy, times(1)).removeVersion(versionFile, version);
}
@ -140,7 +140,7 @@ class VersionResourceResolverTests { @@ -140,7 +140,7 @@ class VersionResourceResolverTests {
.resolveResourceInternal(null, versionFile, this.locations, this.chain)
.block(Duration.ofMillis(5000));
assertThat((Object) actual).isNull();
assertThat(actual).isNull();
verify(this.versionStrategy, times(1)).getResourceVersion(expected);
}

2
spring-webmvc/src/test/java/org/springframework/web/servlet/DispatcherServletTests.java

@ -686,7 +686,7 @@ public class DispatcherServletTests { @@ -686,7 +686,7 @@ public class DispatcherServletTests {
assertThat(myServlet.getServletConfig().getServletName()).isEqualTo("complex");
assertThat(myServlet.getServletConfig().getServletContext()).isEqualTo(getServletContext());
complexDispatcherServlet.destroy();
assertThat((Object) myServlet.getServletConfig()).isNull();
assertThat(myServlet.getServletConfig()).isNull();
}
@Test

6
spring-webmvc/src/test/java/org/springframework/web/servlet/config/MvcNamespaceTests.java

@ -540,7 +540,7 @@ public class MvcNamespaceTests { @@ -540,7 +540,7 @@ public class MvcNamespaceTests {
MockHttpServletResponse response = new MockHttpServletResponse();
ModelAndView mv = adapter.handle(request, response, chain.getHandler());
assertThat((Object) mv).isNull();
assertThat(mv).isNull();
}
@Test
@ -566,7 +566,7 @@ public class MvcNamespaceTests { @@ -566,7 +566,7 @@ public class MvcNamespaceTests {
MockHttpServletResponse response = new MockHttpServletResponse();
ModelAndView mv = adapter.handle(request, response, chain.getHandler());
assertThat((Object) mv).isNull();
assertThat(mv).isNull();
}
@Test
@ -624,7 +624,7 @@ public class MvcNamespaceTests { @@ -624,7 +624,7 @@ public class MvcNamespaceTests {
assertThat(chain.getInterceptorList().get(2)).isInstanceOf(LocaleChangeInterceptor.class);
assertThat(chain.getInterceptorList().get(3)).isInstanceOf(ThemeChangeInterceptor.class);
ModelAndView mv = adapter.handle(request, new MockHttpServletResponse(), chain.getHandler());
assertThat((Object) mv.getViewName()).isNull();
assertThat(mv.getViewName()).isNull();
request = new MockHttpServletRequest("GET", "/myapp/app/bar");
request.setContextPath("/myapp");

2
spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/ResourceHandlerRegistryTests.java

@ -84,7 +84,7 @@ public class ResourceHandlerRegistryTests { @@ -84,7 +84,7 @@ public class ResourceHandlerRegistryTests {
@Test
public void noResourceHandlers() {
this.registry = new ResourceHandlerRegistry(new GenericWebApplicationContext(), new MockServletContext());
assertThat((Object) this.registry.getHandlerMapping()).isNull();
assertThat(this.registry.getHandlerMapping()).isNull();
}
@Test

2
spring-webmvc/src/test/java/org/springframework/web/servlet/resource/ResourceUrlProviderTests.java

@ -97,7 +97,7 @@ public class ResourceUrlProviderTests { @@ -97,7 +97,7 @@ public class ResourceUrlProviderTests {
request.setRequestURI("/contextpath-longer-than-request-path/style.css");
String url = "/resources/foo.css";
String resolvedUrl = this.urlProvider.getForRequestUrl(request, url);
assertThat((Object) resolvedUrl).isNull();
assertThat(resolvedUrl).isNull();
}
@Test

8
spring-webmvc/src/test/java/org/springframework/web/servlet/resource/VersionResourceResolverTests.java

@ -73,7 +73,7 @@ class VersionResourceResolverTests { @@ -73,7 +73,7 @@ class VersionResourceResolverTests {
this.resolver.setStrategyMap(Collections.emptyMap());
Resource actual = this.resolver.resolveResourceInternal(null, file, this.locations, this.chain);
assertThat((Object) actual).isNull();
assertThat(actual).isNull();
verify(this.chain, times(1)).resolveResource(null, file, this.locations);
}
@ -85,7 +85,7 @@ class VersionResourceResolverTests { @@ -85,7 +85,7 @@ class VersionResourceResolverTests {
this.resolver.setStrategyMap(Collections.singletonMap("/**", this.versionStrategy));
Resource actual = this.resolver.resolveResourceInternal(null, file, this.locations, this.chain);
assertThat((Object) actual).isNull();
assertThat(actual).isNull();
verify(this.chain, times(1)).resolveResource(null, file, this.locations);
verify(this.versionStrategy, times(1)).extractVersion(file);
}
@ -102,7 +102,7 @@ class VersionResourceResolverTests { @@ -102,7 +102,7 @@ class VersionResourceResolverTests {
this.resolver.setStrategyMap(Collections.singletonMap("/**", this.versionStrategy));
Resource actual = this.resolver.resolveResourceInternal(null, versionFile, this.locations, this.chain);
assertThat((Object) actual).isNull();
assertThat(actual).isNull();
verify(this.versionStrategy, times(1)).removeVersion(versionFile, version);
}
@ -120,7 +120,7 @@ class VersionResourceResolverTests { @@ -120,7 +120,7 @@ class VersionResourceResolverTests {
this.resolver.setStrategyMap(Collections.singletonMap("/**", this.versionStrategy));
Resource actual = this.resolver.resolveResourceInternal(null, versionFile, this.locations, this.chain);
assertThat((Object) actual).isNull();
assertThat(actual).isNull();
verify(this.versionStrategy, times(1)).getResourceVersion(expected);
}

2
spring-webmvc/src/test/java/org/springframework/web/servlet/view/ResourceBundleViewResolverTests.java

@ -133,7 +133,7 @@ public class ResourceBundleViewResolverTests { @@ -133,7 +133,7 @@ public class ResourceBundleViewResolverTests {
@Test
public void noSuchViewEnglish() throws Exception {
assertThat((Object) rb.resolveViewName("xxxxxxweorqiwuopeir", Locale.ENGLISH)).isNull();
assertThat(rb.resolveViewName("xxxxxxweorqiwuopeir", Locale.ENGLISH)).isNull();
}
@Test

2
spring-webmvc/src/test/java/org/springframework/web/servlet/view/json/MappingJackson2JsonViewTests.java

@ -126,7 +126,7 @@ public class MappingJackson2JsonViewTests { @@ -126,7 +126,7 @@ public class MappingJackson2JsonViewTests {
view.render(model, request, response);
assertThat((Object) response.getHeader("Cache-Control")).isNull();
assertThat(response.getHeader("Cache-Control")).isNull();
}
@Test

Loading…
Cancel
Save