Browse Source

Use AssertJ's isEmpty() instead of hasSize(0)

Achieved via global search-and-replace.
pull/29557/head
Sam Brannen 3 years ago
parent
commit
7fcd1de8e3
  1. 114
      spring-aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java
  2. 89
      spring-aop/src/test/java/org/springframework/aop/support/JdkRegexpMethodPointcutTests.java
  3. 2
      spring-beans/src/test/java/org/springframework/beans/BeanWrapperEnumTests.java
  4. 4
      spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java
  5. 2
      spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java
  6. 2
      spring-beans/src/test/java/org/springframework/beans/factory/config/YamlMapFactoryBeanTests.java
  7. 6
      spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java
  8. 4
      spring-beans/src/test/java/org/springframework/beans/factory/support/DefaultSingletonBeanRegistryTests.java
  9. 2
      spring-beans/src/test/java/org/springframework/beans/factory/xml/EventPublicationTests.java
  10. 2
      spring-beans/src/test/java/org/springframework/beans/propertyeditors/PropertiesEditorTests.java
  11. 6
      spring-context-indexer/src/test/java/org/springframework/context/index/processor/CandidateComponentsIndexerTests.java
  12. 2
      spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/CacheRemoveAllOperationTests.java
  13. 2
      spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java
  14. 4
      spring-context/src/test/java/org/springframework/beans/factory/xml/XmlBeanFactoryTests.java
  15. 6
      spring-context/src/test/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProviderTests.java
  16. 6
      spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java
  17. 2
      spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassWithConditionTests.java
  18. 2
      spring-context/src/test/java/org/springframework/context/support/DefaultLifecycleProcessorTests.java
  19. 2
      spring-context/src/test/java/org/springframework/context/support/ResourceBundleMessageSourceTests.java
  20. 10
      spring-context/src/test/java/org/springframework/ui/ModelMapTests.java
  21. 2
      spring-core-test/src/test/java/org/springframework/core/test/tools/DynamicJavaFileManagerTests.java
  22. 2
      spring-core/src/test/java/org/springframework/core/ConstantsTests.java
  23. 2
      spring-core/src/test/java/org/springframework/core/LocalVariableTableParameterNameDiscovererTests.java
  24. 6
      spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java
  25. 2
      spring-core/src/test/java/org/springframework/core/annotation/ComposedRepeatableAnnotationsTests.java
  26. 6
      spring-core/src/test/java/org/springframework/core/annotation/MultipleComposedAnnotationsOnSingleAnnotatedElementTests.java
  27. 20
      spring-core/src/test/java/org/springframework/core/convert/TypeDescriptorTests.java
  28. 2
      spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java
  29. 2
      spring-core/src/test/java/org/springframework/core/env/PropertySourceTests.java
  30. 10
      spring-core/src/test/java/org/springframework/core/env/StandardEnvironmentTests.java
  31. 8
      spring-core/src/test/java/org/springframework/core/type/AnnotationMetadataTests.java
  32. 4
      spring-core/src/test/java/org/springframework/util/AntPathMatcherTests.java
  33. 6
      spring-core/src/test/java/org/springframework/util/ConcurrentReferenceHashMapTests.java
  34. 14
      spring-core/src/test/java/org/springframework/util/LinkedCaseInsensitiveMapTests.java
  35. 4
      spring-core/src/test/java/org/springframework/util/ObjectUtilsTests.java
  36. 4
      spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/NamedParameterUtilsTests.java
  37. 4
      spring-jdbc/src/test/java/org/springframework/jdbc/object/BatchSqlUpdateTests.java
  38. 6
      spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLErrorCodesFactoryTests.java
  39. 2
      spring-jms/src/test/java/org/springframework/jms/annotation/EnableJmsTests.java
  40. 10
      spring-messaging/src/test/java/org/springframework/messaging/simp/broker/DefaultSubscriptionRegistryTests.java
  41. 8
      spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/BufferingStompDecoderTests.java
  42. 14
      spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompDecoderTests.java
  43. 2
      spring-messaging/src/test/java/org/springframework/messaging/support/ChannelInterceptorTests.java
  44. 2
      spring-messaging/src/test/java/org/springframework/messaging/support/MessageHeaderAccessorTests.java
  45. 2
      spring-messaging/src/test/java/org/springframework/messaging/support/NativeMessageHeaderAccessorTests.java
  46. 8
      spring-orm/src/test/java/org/springframework/orm/jpa/AbstractContainerEntityManagerFactoryIntegrationTests.java
  47. 10
      spring-orm/src/test/java/org/springframework/orm/jpa/persistenceunit/PersistenceXmlParsingTests.java
  48. 2
      spring-test/src/test/java/org/springframework/mock/web/MockHttpServletRequestTests.java
  49. 4
      spring-test/src/test/java/org/springframework/mock/web/MockServletContextTests.java
  50. 2
      spring-test/src/test/java/org/springframework/test/context/TestContextConcurrencyTests.java
  51. 2
      spring-test/src/test/java/org/springframework/test/context/support/AnnotationConfigContextLoaderUtilsTests.java
  52. 8
      spring-test/src/test/java/org/springframework/test/context/support/ContextLoaderUtilsContextHierarchyTests.java
  53. 6
      spring-test/src/test/java/org/springframework/test/context/support/TestPropertySourceUtilsTests.java
  54. 32
      spring-test/src/test/java/org/springframework/test/web/client/response/ResponseCreatorsTests.java
  55. 4
      spring-web/src/test/java/org/springframework/http/HttpHeadersTests.java
  56. 2
      spring-web/src/test/java/org/springframework/http/server/ServletServerHttpRequestTests.java
  57. 2
      spring-web/src/test/java/org/springframework/http/server/reactive/ChannelSendOperatorTests.java
  58. 2
      spring-web/src/test/java/org/springframework/http/server/reactive/HeadersAdaptersTests.java
  59. 2
      spring-web/src/test/java/org/springframework/http/server/reactive/ServerHttpRequestTests.java
  60. 2
      spring-web/src/test/java/org/springframework/web/util/WebUtilsTests.java
  61. 6
      spring-web/src/test/java/org/springframework/web/util/pattern/PathPatternTests.java
  62. 2
      spring-webflux/src/test/java/org/springframework/web/reactive/config/ResourceHandlerRegistryTests.java
  63. 2
      spring-webflux/src/test/java/org/springframework/web/reactive/config/ViewResolverRegistryTests.java
  64. 2
      spring-webflux/src/test/java/org/springframework/web/reactive/result/condition/RequestMappingInfoTests.java
  65. 4
      spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ModelInitializerTests.java
  66. 2
      spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityResultHandlerTests.java
  67. 2
      spring-webflux/src/test/java/org/springframework/web/reactive/result/view/DefaultRenderingBuilderTests.java
  68. 4
      spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfigurationTests.java
  69. 2
      spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/ViewResolverRegistryTests.java
  70. 2
      spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupportTests.java
  71. 4
      spring-webmvc/src/test/java/org/springframework/web/servlet/function/ResourceHandlerFunctionTests.java
  72. 2
      spring-webmvc/src/test/java/org/springframework/web/servlet/handler/HandlerMethodMappingTests.java
  73. 2
      spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoTests.java
  74. 2
      spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/HttpEntityMethodProcessorMockTests.java
  75. 2
      spring-webmvc/src/test/java/org/springframework/web/servlet/support/AnnotationConfigDispatcherServletInitializerTests.java
  76. 4
      spring-webmvc/src/test/java/org/springframework/web/servlet/tags/UrlTagTests.java
  77. 6
      spring-webmvc/src/test/java/org/springframework/web/servlet/view/BaseViewTests.java
  78. 2
      spring-websocket/src/test/java/org/springframework/web/socket/config/annotation/WebMvcStompEndpointRegistryTests.java
  79. 2
      spring-websocket/src/test/java/org/springframework/web/socket/messaging/StompSubProtocolHandlerTests.java

114
spring-aop/src/test/java/org/springframework/aop/support/AbstractRegexpMethodPointcutTests.java

@ -1,114 +0,0 @@ @@ -1,114 +0,0 @@
/*
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.aop.support;
import java.io.IOException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.testfixture.beans.TestBean;
import org.springframework.core.testfixture.io.SerializationTestUtils;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Rod Johnson
* @author Dmitriy Kopylenko
* @author Chris Beams
*/
public abstract class AbstractRegexpMethodPointcutTests {
private AbstractRegexpMethodPointcut rpc;
@BeforeEach
public void setUp() {
rpc = getRegexpMethodPointcut();
}
protected abstract AbstractRegexpMethodPointcut getRegexpMethodPointcut();
@Test
public void testNoPatternSupplied() throws Exception {
noPatternSuppliedTests(rpc);
}
@Test
public void testSerializationWithNoPatternSupplied() throws Exception {
rpc = SerializationTestUtils.serializeAndDeserialize(rpc);
noPatternSuppliedTests(rpc);
}
protected void noPatternSuppliedTests(AbstractRegexpMethodPointcut rpc) throws Exception {
assertThat(rpc.matches(Object.class.getMethod("hashCode"), String.class)).isFalse();
assertThat(rpc.matches(Object.class.getMethod("wait"), Object.class)).isFalse();
assertThat(rpc.getPatterns()).hasSize(0);
}
@Test
public void testExactMatch() throws Exception {
rpc.setPattern("java.lang.Object.hashCode");
exactMatchTests(rpc);
rpc = SerializationTestUtils.serializeAndDeserialize(rpc);
exactMatchTests(rpc);
}
protected void exactMatchTests(AbstractRegexpMethodPointcut rpc) throws Exception {
// assumes rpc.setPattern("java.lang.Object.hashCode");
assertThat(rpc.matches(Object.class.getMethod("hashCode"), String.class)).isTrue();
assertThat(rpc.matches(Object.class.getMethod("hashCode"), Object.class)).isTrue();
assertThat(rpc.matches(Object.class.getMethod("wait"), Object.class)).isFalse();
}
@Test
public void testSpecificMatch() throws Exception {
rpc.setPattern("java.lang.String.hashCode");
assertThat(rpc.matches(Object.class.getMethod("hashCode"), String.class)).isTrue();
assertThat(rpc.matches(Object.class.getMethod("hashCode"), Object.class)).isFalse();
}
@Test
public void testWildcard() throws Exception {
rpc.setPattern(".*Object.hashCode");
assertThat(rpc.matches(Object.class.getMethod("hashCode"), Object.class)).isTrue();
assertThat(rpc.matches(Object.class.getMethod("wait"), Object.class)).isFalse();
}
@Test
public void testWildcardForOneClass() throws Exception {
rpc.setPattern("java.lang.Object.*");
assertThat(rpc.matches(Object.class.getMethod("hashCode"), String.class)).isTrue();
assertThat(rpc.matches(Object.class.getMethod("wait"), String.class)).isTrue();
}
@Test
public void testMatchesObjectClass() throws Exception {
rpc.setPattern("java.lang.Object.*");
assertThat(rpc.matches(Exception.class.getMethod("hashCode"), IOException.class)).isTrue();
// Doesn't match a method from Throwable
assertThat(rpc.matches(Exception.class.getMethod("getMessage"), Exception.class)).isFalse();
}
@Test
public void testWithExclusion() throws Exception {
this.rpc.setPattern(".*get.*");
this.rpc.setExcludedPattern(".*Age.*");
assertThat(this.rpc.matches(TestBean.class.getMethod("getName"), TestBean.class)).isTrue();
assertThat(this.rpc.matches(TestBean.class.getMethod("getAge"), TestBean.class)).isFalse();
}
}

89
spring-aop/src/test/java/org/springframework/aop/support/JdkRegexpMethodPointcutTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,14 +16,93 @@ @@ -16,14 +16,93 @@
package org.springframework.aop.support;
import java.io.IOException;
import org.junit.jupiter.api.Test;
import org.springframework.beans.testfixture.beans.TestBean;
import org.springframework.core.testfixture.io.SerializationTestUtils;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Rod Johnson
* @author Dmitriy Kopylenko
* @author Chris Beams
* @author Dmitriy Kopylenko
*/
public class JdkRegexpMethodPointcutTests extends AbstractRegexpMethodPointcutTests {
class JdkRegexpMethodPointcutTests {
private AbstractRegexpMethodPointcut rpc = new JdkRegexpMethodPointcut();
@Test
void noPatternSupplied() throws Exception {
noPatternSuppliedTests(rpc);
}
@Test
void serializationWithNoPatternSupplied() throws Exception {
rpc = SerializationTestUtils.serializeAndDeserialize(rpc);
noPatternSuppliedTests(rpc);
}
private void noPatternSuppliedTests(AbstractRegexpMethodPointcut rpc) throws Exception {
assertThat(rpc.matches(Object.class.getMethod("hashCode"), String.class)).isFalse();
assertThat(rpc.matches(Object.class.getMethod("wait"), Object.class)).isFalse();
assertThat(rpc.getPatterns()).isEmpty();
}
@Test
void exactMatch() throws Exception {
rpc.setPattern("java.lang.Object.hashCode");
exactMatchTests(rpc);
rpc = SerializationTestUtils.serializeAndDeserialize(rpc);
exactMatchTests(rpc);
}
private void exactMatchTests(AbstractRegexpMethodPointcut rpc) throws Exception {
// assumes rpc.setPattern("java.lang.Object.hashCode");
assertThat(rpc.matches(Object.class.getMethod("hashCode"), String.class)).isTrue();
assertThat(rpc.matches(Object.class.getMethod("hashCode"), Object.class)).isTrue();
assertThat(rpc.matches(Object.class.getMethod("wait"), Object.class)).isFalse();
}
@Test
void specificMatch() throws Exception {
rpc.setPattern("java.lang.String.hashCode");
assertThat(rpc.matches(Object.class.getMethod("hashCode"), String.class)).isTrue();
assertThat(rpc.matches(Object.class.getMethod("hashCode"), Object.class)).isFalse();
}
@Test
void wildcard() throws Exception {
rpc.setPattern(".*Object.hashCode");
assertThat(rpc.matches(Object.class.getMethod("hashCode"), Object.class)).isTrue();
assertThat(rpc.matches(Object.class.getMethod("wait"), Object.class)).isFalse();
}
@Test
void wildcardForOneClass() throws Exception {
rpc.setPattern("java.lang.Object.*");
assertThat(rpc.matches(Object.class.getMethod("hashCode"), String.class)).isTrue();
assertThat(rpc.matches(Object.class.getMethod("wait"), String.class)).isTrue();
}
@Test
void matchesObjectClass() throws Exception {
rpc.setPattern("java.lang.Object.*");
assertThat(rpc.matches(Exception.class.getMethod("hashCode"), IOException.class)).isTrue();
// Doesn't match a method from Throwable
assertThat(rpc.matches(Exception.class.getMethod("getMessage"), Exception.class)).isFalse();
}
@Override
protected AbstractRegexpMethodPointcut getRegexpMethodPointcut() {
return new JdkRegexpMethodPointcut();
@Test
void withExclusion() throws Exception {
this.rpc.setPattern(".*get.*");
this.rpc.setExcludedPattern(".*Age.*");
assertThat(this.rpc.matches(TestBean.class.getMethod("getName"), TestBean.class)).isTrue();
assertThat(this.rpc.matches(TestBean.class.getMethod("getAge"), TestBean.class)).isFalse();
}
}

2
spring-beans/src/test/java/org/springframework/beans/BeanWrapperEnumTests.java

@ -144,7 +144,7 @@ public class BeanWrapperEnumTests { @@ -144,7 +144,7 @@ public class BeanWrapperEnumTests {
bw.setAutoGrowNestedPaths(true);
assertThat(gb.getStandardEnumSet()).isNull();
bw.getPropertyValue("standardEnumSet.class");
assertThat(gb.getStandardEnumSet()).hasSize(0);
assertThat(gb.getStandardEnumSet()).isEmpty();
}
@Test

4
spring-beans/src/test/java/org/springframework/beans/factory/BeanFactoryUtilsTests.java

@ -103,7 +103,7 @@ public class BeanFactoryUtilsTests { @@ -103,7 +103,7 @@ public class BeanFactoryUtilsTests {
public void testHierarchicalNamesWithNoMatch() {
List<String> names = Arrays.asList(
BeanFactoryUtils.beanNamesForTypeIncludingAncestors(this.listableBeanFactory, NoOp.class));
assertThat(names).hasSize(0);
assertThat(names).isEmpty();
}
@Test
@ -278,7 +278,7 @@ public class BeanFactoryUtilsTests { @@ -278,7 +278,7 @@ public class BeanFactoryUtilsTests {
public void testHierarchicalNamesForAnnotationWithNoMatch() {
List<String> names = Arrays.asList(
BeanFactoryUtils.beanNamesForAnnotationIncludingAncestors(this.listableBeanFactory, Override.class));
assertThat(names).hasSize(0);
assertThat(names).isEmpty();
}
@Test

2
spring-beans/src/test/java/org/springframework/beans/factory/config/PropertyResourceConfigurerTests.java

@ -577,7 +577,7 @@ public class PropertyResourceConfigurerTests { @@ -577,7 +577,7 @@ public class PropertyResourceConfigurerTests {
TestBean tb = (TestBean) factory.getBean("tb");
assertThat(tb).isNotNull();
assertThat(factory.getAliases("tb")).hasSize(0);
assertThat(factory.getAliases("tb")).isEmpty();
}
@Test

2
spring-beans/src/test/java/org/springframework/beans/factory/config/YamlMapFactoryBeanTests.java

@ -47,7 +47,7 @@ public class YamlMapFactoryBeanTests { @@ -47,7 +47,7 @@ public class YamlMapFactoryBeanTests {
public void testSetIgnoreResourceNotFound() {
this.factory.setResolutionMethod(YamlMapFactoryBean.ResolutionMethod.OVERRIDE_AND_IGNORE);
this.factory.setResources(new FileSystemResource("non-exsitent-file.yml"));
assertThat(this.factory.getObject()).hasSize(0);
assertThat(this.factory.getObject()).isEmpty();
}
@Test

6
spring-beans/src/test/java/org/springframework/beans/factory/support/BeanFactoryGenericsTests.java

@ -762,7 +762,7 @@ class BeanFactoryGenericsTests { @@ -762,7 +762,7 @@ class BeanFactoryGenericsTests {
assertThat(bf.getType("mock")).isNull();
assertThat(bf.getType("mock")).isNull();
Map<String, Runnable> beans = bf.getBeansOfType(Runnable.class);
assertThat(beans).hasSize(0);
assertThat(beans).isEmpty();
}
@Test
@ -828,8 +828,8 @@ class BeanFactoryGenericsTests { @@ -828,8 +828,8 @@ class BeanFactoryGenericsTests {
assertThat(numberStoreNames).hasSize(2);
assertThat(numberStoreNames[0]).isEqualTo("doubleStore");
assertThat(numberStoreNames[1]).isEqualTo("floatStore");
assertThat(doubleStoreNames).hasSize(0);
assertThat(floatStoreNames).hasSize(0);
assertThat(doubleStoreNames).isEmpty();
assertThat(floatStoreNames).isEmpty();
}
@Test

4
spring-beans/src/test/java/org/springframework/beans/factory/support/DefaultSingletonBeanRegistryTests.java

@ -51,7 +51,7 @@ public class DefaultSingletonBeanRegistryTests { @@ -51,7 +51,7 @@ public class DefaultSingletonBeanRegistryTests {
beanRegistry.destroySingletons();
assertThat(beanRegistry.getSingletonCount()).isEqualTo(0);
assertThat(beanRegistry.getSingletonNames()).hasSize(0);
assertThat(beanRegistry.getSingletonNames()).isEmpty();
}
@Test
@ -72,7 +72,7 @@ public class DefaultSingletonBeanRegistryTests { @@ -72,7 +72,7 @@ public class DefaultSingletonBeanRegistryTests {
beanRegistry.destroySingletons();
assertThat(beanRegistry.getSingletonCount()).isEqualTo(0);
assertThat(beanRegistry.getSingletonNames()).hasSize(0);
assertThat(beanRegistry.getSingletonNames()).isEmpty();
assertThat(tb.wasDestroyed()).isTrue();
}

2
spring-beans/src/test/java/org/springframework/beans/factory/xml/EventPublicationTests.java

@ -90,7 +90,7 @@ class EventPublicationTests { @@ -90,7 +90,7 @@ class EventPublicationTests {
assertThat(componentDefinition1.getBeanDefinitions()).hasSize(1);
BeanDefinition beanDefinition2 = componentDefinition2.getBeanDefinitions()[0];
assertThat(beanDefinition2.getPropertyValues().getPropertyValue("name").getValue()).isEqualTo(new TypedStringValue("Juergen Hoeller"));
assertThat(componentDefinition2.getBeanReferences()).hasSize(0);
assertThat(componentDefinition2.getBeanReferences()).isEmpty();
assertThat(componentDefinition2.getInnerBeanDefinitions()).hasSize(1);
BeanDefinition innerBd2 = componentDefinition2.getInnerBeanDefinitions()[0];
assertThat(innerBd2.getPropertyValues().getPropertyValue("name").getValue()).isEqualTo(new TypedStringValue("Eva Schallmeiner"));

2
spring-beans/src/test/java/org/springframework/beans/propertyeditors/PropertiesEditorTests.java

@ -139,7 +139,7 @@ public class PropertiesEditorTests { @@ -139,7 +139,7 @@ public class PropertiesEditorTests {
PropertiesEditor pe= new PropertiesEditor();
pe.setAsText(null);
Properties p = (Properties) pe.getValue();
assertThat(p).hasSize(0);
assertThat(p).isEmpty();
}
@Test

6
spring-context-indexer/src/test/java/org/springframework/context/index/processor/CandidateComponentsIndexerTests.java

@ -82,13 +82,13 @@ class CandidateComponentsIndexerTests { @@ -82,13 +82,13 @@ class CandidateComponentsIndexerTests {
@Test
void noCandidate() {
CandidateComponentsMetadata metadata = compile(SampleNone.class);
assertThat(metadata.getItems()).hasSize(0);
assertThat(metadata.getItems()).isEmpty();
}
@Test
void noAnnotation() {
CandidateComponentsMetadata metadata = compile(CandidateComponentsIndexerTests.class);
assertThat(metadata.getItems()).hasSize(0);
assertThat(metadata.getItems()).isEmpty();
}
@Test
@ -214,7 +214,7 @@ class CandidateComponentsIndexerTests { @@ -214,7 +214,7 @@ class CandidateComponentsIndexerTests {
@Test
void embeddedNonStaticCandidateAreIgnored() {
CandidateComponentsMetadata metadata = compile(SampleNonStaticEmbedded.class);
assertThat(metadata.getItems()).hasSize(0);
assertThat(metadata.getItems()).isEmpty();
}
private void testComponent(Class<?>... classes) {

2
spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/CacheRemoveAllOperationTests.java vendored

@ -42,7 +42,7 @@ public class CacheRemoveAllOperationTests extends AbstractCacheOperationTests<Ca @@ -42,7 +42,7 @@ public class CacheRemoveAllOperationTests extends AbstractCacheOperationTests<Ca
CacheRemoveAllOperation operation = createSimpleOperation();
CacheInvocationParameter[] allParameters = operation.getAllParameters();
assertThat(allParameters).hasSize(0);
assertThat(allParameters).isEmpty();
}
}

2
spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java

@ -796,7 +796,7 @@ public abstract class AbstractAopProxyTests { @@ -796,7 +796,7 @@ public abstract class AbstractAopProxyTests {
advised.removeAdvisor(0);
// Check it still works: proxy factory state shouldn't have been corrupted
assertThat(proxied.getAge()).isEqualTo(target.getAge());
assertThat(advised.getAdvisors()).hasSize(0);
assertThat(advised.getAdvisors()).isEmpty();
}
@Test

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

@ -1530,7 +1530,7 @@ class XmlBeanFactoryTests { @@ -1530,7 +1530,7 @@ class XmlBeanFactoryTests {
new XmlBeanDefinitionReader(xbf).loadBeanDefinitions(CONSTRUCTOR_ARG_CONTEXT);
ConstructorArrayTestBean bean = (ConstructorArrayTestBean) xbf.getBean("constructorArrayNoType");
assertThat(bean.array instanceof String[]).isTrue();
assertThat(((String[]) bean.array)).hasSize(0);
assertThat(((String[]) bean.array)).isEmpty();
}
@Test
@ -1541,7 +1541,7 @@ class XmlBeanFactoryTests { @@ -1541,7 +1541,7 @@ class XmlBeanFactoryTests {
bd.setLenientConstructorResolution(false);
ConstructorArrayTestBean bean = (ConstructorArrayTestBean) xbf.getBean("constructorArrayNoType");
assertThat(bean.array instanceof String[]).isTrue();
assertThat(((String[]) bean.array)).hasSize(0);
assertThat(((String[]) bean.array)).isEmpty();
}
@Test

6
spring-context/src/test/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProviderTests.java

@ -130,7 +130,7 @@ class ClassPathScanningCandidateComponentProviderTests { @@ -130,7 +130,7 @@ class ClassPathScanningCandidateComponentProviderTests {
provider.setResourceLoader(new DefaultResourceLoader(
CandidateComponentsTestClassLoader.disableIndex(getClass().getClassLoader())));
Set<BeanDefinition> candidates = provider.findCandidateComponents("bogus");
assertThat(candidates).hasSize(0);
assertThat(candidates).isEmpty();
}
@Test
@ -138,7 +138,7 @@ class ClassPathScanningCandidateComponentProviderTests { @@ -138,7 +138,7 @@ class ClassPathScanningCandidateComponentProviderTests {
ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(true);
provider.setResourceLoader(new DefaultResourceLoader(TEST_BASE_CLASSLOADER));
Set<BeanDefinition> candidates = provider.findCandidateComponents("bogus");
assertThat(candidates).hasSize(0);
assertThat(candidates).isEmpty();
}
@Test
@ -279,7 +279,7 @@ class ClassPathScanningCandidateComponentProviderTests { @@ -279,7 +279,7 @@ class ClassPathScanningCandidateComponentProviderTests {
void withNoFilters() {
ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false);
Set<BeanDefinition> candidates = provider.findCandidateComponents(TEST_BASE_PACKAGE);
assertThat(candidates).hasSize(0);
assertThat(candidates).isEmpty();
}
@Test

6
spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorTests.java

@ -682,10 +682,10 @@ class ConfigurationClassPostProcessorTests { @@ -682,10 +682,10 @@ class ConfigurationClassPostProcessorTests {
assertThat(beanNames).contains("stringRepo");
beanNames = beanFactory.getBeanNamesForType(ResolvableType.forClassWithGenerics(Repository.class, String.class));
assertThat(beanNames).hasSize(0);
assertThat(beanNames).isEmpty();
beanNames = beanFactory.getBeanNamesForType(ResolvableType.forClassWithGenerics(Repository.class, String.class));
assertThat(beanNames).hasSize(0);
assertThat(beanNames).isEmpty();
}
@Test
@ -1040,7 +1040,7 @@ class ConfigurationClassPostProcessorTests { @@ -1040,7 +1040,7 @@ class ConfigurationClassPostProcessorTests {
ConfigurableApplicationContext ctx = new AnnotationConfigApplicationContext(VarargConfiguration.class);
VarargConfiguration bean = ctx.getBean(VarargConfiguration.class);
assertThat(bean.testBeans).isNotNull();
assertThat(bean.testBeans).hasSize(0);
assertThat(bean.testBeans).isEmpty();
ctx.close();
}

2
spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassWithConditionTests.java

@ -138,7 +138,7 @@ public class ConfigurationClassWithConditionTests { @@ -138,7 +138,7 @@ public class ConfigurationClassWithConditionTests {
@Test
public void conditionOnOverriddenMethodHonored() {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConfigWithBeanSkipped.class);
assertThat(context.getBeansOfType(ExampleBean.class)).hasSize(0);
assertThat(context.getBeansOfType(ExampleBean.class)).isEmpty();
}
@Test

2
spring-context/src/test/java/org/springframework/context/support/DefaultLifecycleProcessorTests.java

@ -116,7 +116,7 @@ class DefaultLifecycleProcessorTests { @@ -116,7 +116,7 @@ class DefaultLifecycleProcessorTests {
assertThat(bean.isRunning()).isFalse();
context.refresh();
assertThat(bean.isRunning()).isFalse();
assertThat(startedBeans).hasSize(0);
assertThat(startedBeans).isEmpty();
context.start();
assertThat(bean.isRunning()).isTrue();
assertThat(startedBeans).hasSize(1);

2
spring-context/src/test/java/org/springframework/context/support/ResourceBundleMessageSourceTests.java

@ -414,7 +414,7 @@ class ResourceBundleMessageSourceTests { @@ -414,7 +414,7 @@ class ResourceBundleMessageSourceTests {
assertThat(filenames.get(0)).isEqualTo("messages__UK_POSIX");
filenames = ms.calculateFilenamesForLocale("messages", new Locale("", "", "POSIX"));
assertThat(filenames).hasSize(0);
assertThat(filenames).isEmpty();
}
@Test

10
spring-context/src/test/java/org/springframework/ui/ModelMapTests.java

@ -44,7 +44,7 @@ public class ModelMapTests { @@ -44,7 +44,7 @@ public class ModelMapTests {
@Test
public void testNoArgCtorYieldsEmptyModel() throws Exception {
assertThat(new ModelMap()).hasSize(0);
assertThat(new ModelMap()).isEmpty();
}
/*
@ -117,7 +117,7 @@ public class ModelMapTests { @@ -117,7 +117,7 @@ public class ModelMapTests {
public void testOneArgCtorWithEmptyCollection() throws Exception {
ModelMap model = new ModelMap(new HashSet<>());
// must not add if collection is empty...
assertThat(model).hasSize(0);
assertThat(model).isEmpty();
}
@Test
@ -134,21 +134,21 @@ public class ModelMapTests { @@ -134,21 +134,21 @@ public class ModelMapTests {
assertThat(model).hasSize(1);
int[] ints = (int[]) model.get("intList");
assertThat(ints).isNotNull();
assertThat(ints).hasSize(0);
assertThat(ints).isEmpty();
}
@Test
public void testAddAllObjectsWithNullMap() throws Exception {
ModelMap model = new ModelMap();
model.addAllAttributes((Map<String, ?>) null);
assertThat(model).hasSize(0);
assertThat(model).isEmpty();
}
@Test
public void testAddAllObjectsWithNullCollection() throws Exception {
ModelMap model = new ModelMap();
model.addAllAttributes((Collection<Object>) null);
assertThat(model).hasSize(0);
assertThat(model).isEmpty();
}
@Test

2
spring-core-test/src/test/java/org/springframework/core/test/tools/DynamicJavaFileManagerTests.java

@ -136,7 +136,7 @@ class DynamicJavaFileManagerTests { @@ -136,7 +136,7 @@ class DynamicJavaFileManagerTests {
void listWithoutClassKindDoesNotReturnClasses() throws IOException {
Iterable<JavaFileObject> listed = this.fileManager.list(
this.location, "com.example", EnumSet.of(Kind.SOURCE), true);
assertThat(listed).hasSize(0);
assertThat(listed).isEmpty();
}
@Test

2
spring-core/src/test/java/org/springframework/core/ConstantsTests.java

@ -217,7 +217,7 @@ class ConstantsTests { @@ -217,7 +217,7 @@ class ConstantsTests {
assertThat(c.getSize()).isEqualTo(0);
final Set<?> values = c.getValues("");
assertThat(values).isNotNull();
assertThat(values).hasSize(0);
assertThat(values).isEmpty();
}
@Test

2
spring-core/src/test/java/org/springframework/core/LocalVariableTableParameterNameDiscovererTests.java

@ -200,7 +200,7 @@ class LocalVariableTableParameterNameDiscovererTests { @@ -200,7 +200,7 @@ class LocalVariableTableParameterNameDiscovererTests {
m = clazz.getMethod("getDate");
names = discoverer.getParameterNames(m);
assertThat(names).hasSize(0);
assertThat(names).isEmpty();
}
@Disabled("Ignored because Ubuntu packages OpenJDK with debug symbols enabled. See SPR-8078.")

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

@ -706,17 +706,17 @@ class AnnotationUtilsTests { @@ -706,17 +706,17 @@ class AnnotationUtilsTests {
// Java 8
MyRepeatable[] array = clazz.getDeclaredAnnotationsByType(MyRepeatable.class);
assertThat(array).isNotNull();
assertThat(array).hasSize(0);
assertThat(array).isEmpty();
// Spring
Set<MyRepeatable> set = getDeclaredRepeatableAnnotations(clazz, MyRepeatable.class, MyRepeatableContainer.class);
assertThat(set).isNotNull();
assertThat(set).hasSize(0);
assertThat(set).isEmpty();
// When container type is omitted and therefore inferred from @Repeatable
set = getDeclaredRepeatableAnnotations(clazz, MyRepeatable.class);
assertThat(set).isNotNull();
assertThat(set).hasSize(0);
assertThat(set).isEmpty();
}
@Test

2
spring-core/src/test/java/org/springframework/core/annotation/ComposedRepeatableAnnotationsTests.java

@ -112,7 +112,7 @@ class ComposedRepeatableAnnotationsTests { @@ -112,7 +112,7 @@ class ComposedRepeatableAnnotationsTests {
Class<?> element = SubNoninheritedRepeatableClass.class;
Set<Noninherited> annotations = getMergedRepeatableAnnotations(element, Noninherited.class);
assertThat(annotations).isNotNull();
assertThat(annotations).hasSize(0);
assertThat(annotations).isEmpty();
}
@Test

6
spring-core/src/test/java/org/springframework/core/annotation/MultipleComposedAnnotationsOnSingleAnnotatedElementTests.java

@ -76,7 +76,7 @@ class MultipleComposedAnnotationsOnSingleAnnotatedElementTests { @@ -76,7 +76,7 @@ class MultipleComposedAnnotationsOnSingleAnnotatedElementTests {
Class<?> element = SubMultipleNoninheritedComposedCachesClass.class;
Set<Cacheable> cacheables = getAllMergedAnnotations(element, Cacheable.class);
assertThat(cacheables).isNotNull();
assertThat(cacheables).hasSize(0);
assertThat(cacheables).isEmpty();
}
@Test
@ -89,7 +89,7 @@ class MultipleComposedAnnotationsOnSingleAnnotatedElementTests { @@ -89,7 +89,7 @@ class MultipleComposedAnnotationsOnSingleAnnotatedElementTests {
Class<MultipleComposedCachesOnInterfaceClass> element = MultipleComposedCachesOnInterfaceClass.class;
Set<Cacheable> cacheables = getAllMergedAnnotations(element, Cacheable.class);
assertThat(cacheables).isNotNull();
assertThat(cacheables).hasSize(0);
assertThat(cacheables).isEmpty();
}
@Test
@ -109,7 +109,7 @@ class MultipleComposedAnnotationsOnSingleAnnotatedElementTests { @@ -109,7 +109,7 @@ class MultipleComposedAnnotationsOnSingleAnnotatedElementTests {
void getMultipleComposedAnnotationsOnBridgeMethod() throws Exception {
Set<Cacheable> cacheables = getAllMergedAnnotations(getBridgeMethod(), Cacheable.class);
assertThat(cacheables).isNotNull();
assertThat(cacheables).hasSize(0);
assertThat(cacheables).isEmpty();
}
@Test

20
spring-core/src/test/java/org/springframework/core/convert/TypeDescriptorTests.java

@ -65,7 +65,7 @@ class TypeDescriptorTests { @@ -65,7 +65,7 @@ class TypeDescriptorTests {
assertThat(desc.getName()).isEqualTo("int");
assertThat(desc.toString()).isEqualTo("int");
assertThat(desc.isPrimitive()).isTrue();
assertThat(desc.getAnnotations()).hasSize(0);
assertThat(desc.getAnnotations()).isEmpty();
assertThat(desc.isCollection()).isFalse();
assertThat(desc.isMap()).isFalse();
}
@ -78,7 +78,7 @@ class TypeDescriptorTests { @@ -78,7 +78,7 @@ class TypeDescriptorTests {
assertThat(desc.getName()).isEqualTo("java.lang.String");
assertThat(desc.toString()).isEqualTo("java.lang.String");
assertThat(!desc.isPrimitive()).isTrue();
assertThat(desc.getAnnotations()).hasSize(0);
assertThat(desc.getAnnotations()).isEmpty();
assertThat(desc.isCollection()).isFalse();
assertThat(desc.isArray()).isFalse();
assertThat(desc.isMap()).isFalse();
@ -93,7 +93,7 @@ class TypeDescriptorTests { @@ -93,7 +93,7 @@ class TypeDescriptorTests {
assertThat(desc.getName()).isEqualTo("java.util.List");
assertThat(desc.toString()).isEqualTo("java.util.List<java.util.List<java.util.Map<java.lang.Integer, java.lang.Enum<?>>>>");
assertThat(!desc.isPrimitive()).isTrue();
assertThat(desc.getAnnotations()).hasSize(0);
assertThat(desc.getAnnotations()).isEmpty();
assertThat(desc.isCollection()).isTrue();
assertThat(desc.isArray()).isFalse();
assertThat(desc.getElementTypeDescriptor().getType()).isEqualTo(List.class);
@ -114,7 +114,7 @@ class TypeDescriptorTests { @@ -114,7 +114,7 @@ class TypeDescriptorTests {
assertThat(desc.getName()).isEqualTo("java.util.List");
assertThat(desc.toString()).isEqualTo("java.util.List<?>");
assertThat(!desc.isPrimitive()).isTrue();
assertThat(desc.getAnnotations()).hasSize(0);
assertThat(desc.getAnnotations()).isEmpty();
assertThat(desc.isCollection()).isTrue();
assertThat(desc.isArray()).isFalse();
assertThat((Object) desc.getElementTypeDescriptor()).isNull();
@ -130,7 +130,7 @@ class TypeDescriptorTests { @@ -130,7 +130,7 @@ class TypeDescriptorTests {
assertThat(desc.getName()).isEqualTo("java.lang.Integer[]");
assertThat(desc.toString()).isEqualTo("java.lang.Integer[]");
assertThat(!desc.isPrimitive()).isTrue();
assertThat(desc.getAnnotations()).hasSize(0);
assertThat(desc.getAnnotations()).isEmpty();
assertThat(desc.isCollection()).isFalse();
assertThat(desc.isArray()).isTrue();
assertThat(desc.getElementTypeDescriptor().getType()).isEqualTo(Integer.class);
@ -147,7 +147,7 @@ class TypeDescriptorTests { @@ -147,7 +147,7 @@ class TypeDescriptorTests {
assertThat(desc.getName()).isEqualTo("java.util.Map");
assertThat(desc.toString()).isEqualTo("java.util.Map<java.lang.Integer, java.util.List<java.lang.String>>");
assertThat(!desc.isPrimitive()).isTrue();
assertThat(desc.getAnnotations()).hasSize(0);
assertThat(desc.getAnnotations()).isEmpty();
assertThat(desc.isCollection()).isFalse();
assertThat(desc.isArray()).isFalse();
assertThat(desc.isMap()).isTrue();
@ -463,7 +463,7 @@ class TypeDescriptorTests { @@ -463,7 +463,7 @@ class TypeDescriptorTests {
assertThat(desc.getName()).isEqualTo("java.util.List");
assertThat(desc.toString()).isEqualTo("java.util.List<java.lang.Integer>");
assertThat(!desc.isPrimitive()).isTrue();
assertThat(desc.getAnnotations()).hasSize(0);
assertThat(desc.getAnnotations()).isEmpty();
assertThat(desc.isCollection()).isTrue();
assertThat(desc.isArray()).isFalse();
assertThat(desc.getElementTypeDescriptor().getType()).isEqualTo(Integer.class);
@ -479,7 +479,7 @@ class TypeDescriptorTests { @@ -479,7 +479,7 @@ class TypeDescriptorTests {
assertThat(desc.getName()).isEqualTo("java.util.List");
assertThat(desc.toString()).isEqualTo("java.util.List<java.util.List<java.lang.Integer>>");
assertThat(!desc.isPrimitive()).isTrue();
assertThat(desc.getAnnotations()).hasSize(0);
assertThat(desc.getAnnotations()).isEmpty();
assertThat(desc.isCollection()).isTrue();
assertThat(desc.isArray()).isFalse();
assertThat(desc.getElementTypeDescriptor().getType()).isEqualTo(List.class);
@ -495,7 +495,7 @@ class TypeDescriptorTests { @@ -495,7 +495,7 @@ class TypeDescriptorTests {
assertThat(desc.getName()).isEqualTo("java.util.Map");
assertThat(desc.toString()).isEqualTo("java.util.Map<java.lang.String, java.lang.Integer>");
assertThat(!desc.isPrimitive()).isTrue();
assertThat(desc.getAnnotations()).hasSize(0);
assertThat(desc.getAnnotations()).isEmpty();
assertThat(desc.isCollection()).isFalse();
assertThat(desc.isArray()).isFalse();
assertThat(desc.isMap()).isTrue();
@ -512,7 +512,7 @@ class TypeDescriptorTests { @@ -512,7 +512,7 @@ class TypeDescriptorTests {
assertThat(desc.getName()).isEqualTo("java.util.Map");
assertThat(desc.toString()).isEqualTo("java.util.Map<java.lang.String, java.util.Map<java.lang.String, java.lang.Integer>>");
assertThat(!desc.isPrimitive()).isTrue();
assertThat(desc.getAnnotations()).hasSize(0);
assertThat(desc.getAnnotations()).isEmpty();
assertThat(desc.isCollection()).isFalse();
assertThat(desc.isArray()).isFalse();
assertThat(desc.isMap()).isTrue();

2
spring-core/src/test/java/org/springframework/core/convert/support/GenericConversionServiceTests.java

@ -335,7 +335,7 @@ class GenericConversionServiceTests { @@ -335,7 +335,7 @@ class GenericConversionServiceTests {
TypeDescriptor sourceType = TypeDescriptor.forObject(list);
TypeDescriptor targetType = TypeDescriptor.valueOf(String[].class);
assertThat(conversionService.canConvert(sourceType, targetType)).isTrue();
assertThat(((String[]) conversionService.convert(list, sourceType, targetType))).hasSize(0);
assertThat(((String[]) conversionService.convert(list, sourceType, targetType))).isEmpty();
}
@Test

2
spring-core/src/test/java/org/springframework/core/env/PropertySourceTests.java vendored

@ -89,7 +89,7 @@ class PropertySourceTests { @@ -89,7 +89,7 @@ class PropertySourceTests {
assertThat(propertySources.remove(PropertySource.named("ps1"))).isTrue();
assertThat(propertySources).hasSize(1);
assertThat(propertySources.remove(PropertySource.named("ps1"))).isTrue();
assertThat(propertySources).hasSize(0);
assertThat(propertySources).isEmpty();
PropertySource<?> ps2 = new MapPropertySource("ps2", map2);
propertySources.add(ps1);

10
spring-core/src/test/java/org/springframework/core/env/StandardEnvironmentTests.java vendored

@ -113,7 +113,7 @@ public class StandardEnvironmentTests { @@ -113,7 +113,7 @@ public class StandardEnvironmentTests {
@Test
void activeProfilesIsEmptyByDefault() {
assertThat(environment.getActiveProfiles()).hasSize(0);
assertThat(environment.getActiveProfiles()).isEmpty();
}
@Test
@ -172,7 +172,7 @@ public class StandardEnvironmentTests { @@ -172,7 +172,7 @@ public class StandardEnvironmentTests {
@Test
void addActiveProfile() {
assertThat(environment.getActiveProfiles()).hasSize(0);
assertThat(environment.getActiveProfiles()).isEmpty();
environment.setActiveProfiles("local", "embedded");
assertThat(environment.getActiveProfiles()).contains("local", "embedded");
assertThat(environment.getActiveProfiles()).hasSize(2);
@ -218,9 +218,9 @@ public class StandardEnvironmentTests { @@ -218,9 +218,9 @@ public class StandardEnvironmentTests {
@Test
void getActiveProfiles_systemPropertiesEmpty() {
assertThat(environment.getActiveProfiles()).hasSize(0);
assertThat(environment.getActiveProfiles()).isEmpty();
System.setProperty(ACTIVE_PROFILES_PROPERTY_NAME, "");
assertThat(environment.getActiveProfiles()).hasSize(0);
assertThat(environment.getActiveProfiles()).isEmpty();
System.clearProperty(ACTIVE_PROFILES_PROPERTY_NAME);
}
@ -256,7 +256,7 @@ public class StandardEnvironmentTests { @@ -256,7 +256,7 @@ public class StandardEnvironmentTests {
@Test
void setDefaultProfiles() {
environment.setDefaultProfiles();
assertThat(environment.getDefaultProfiles()).hasSize(0);
assertThat(environment.getDefaultProfiles()).isEmpty();
environment.setDefaultProfiles("pd1");
assertThat(Arrays.asList(environment.getDefaultProfiles())).contains("pd1");
environment.setDefaultProfiles("pd2", "pd3");

8
spring-core/src/test/java/org/springframework/core/type/AnnotationMetadataTests.java

@ -90,7 +90,7 @@ class AnnotationMetadataTests { @@ -90,7 +90,7 @@ class AnnotationMetadataTests {
assertThat(metadata.isConcrete()).isTrue();
assertThat(metadata.hasSuperClass()).isTrue();
assertThat(metadata.getSuperClassName()).isEqualTo(AnnotatedComponent.class.getName());
assertThat(metadata.getInterfaceNames()).hasSize(0);
assertThat(metadata.getInterfaceNames()).isEmpty();
assertThat(metadata.isAnnotated(Component.class.getName())).isFalse();
assertThat(metadata.isAnnotated(Scope.class.getName())).isFalse();
assertThat(metadata.isAnnotated(SpecialAttr.class.getName())).isFalse();
@ -114,7 +114,7 @@ class AnnotationMetadataTests { @@ -114,7 +114,7 @@ class AnnotationMetadataTests {
assertThat(metadata.getAnnotationAttributes(Component.class.getName())).isNull();
assertThat(metadata.getAnnotationAttributes(MetaAnnotation.class.getName(), false)).isNull();
assertThat(metadata.getAnnotationAttributes(MetaAnnotation.class.getName(), true)).isNull();
assertThat(metadata.getAnnotatedMethods(DirectAnnotation.class.getName())).hasSize(0);
assertThat(metadata.getAnnotatedMethods(DirectAnnotation.class.getName())).isEmpty();
assertThat(metadata.isAnnotated(IsAnnotatedAnnotation.class.getName())).isFalse();
assertThat(metadata.getAllAnnotationAttributes(DirectAnnotation.class.getName())).isNull();
}
@ -144,7 +144,7 @@ class AnnotationMetadataTests { @@ -144,7 +144,7 @@ class AnnotationMetadataTests {
assertThat(metadata.getInterfaceNames()).hasSize(2);
assertThat(metadata.getInterfaceNames()[0]).isEqualTo(ClassMetadata.class.getName());
assertThat(metadata.getInterfaceNames()[1]).isEqualTo(AnnotatedTypeMetadata.class.getName());
assertThat(metadata.getAnnotationTypes()).hasSize(0);
assertThat(metadata.getAnnotationTypes()).isEmpty();
}
@Test
@ -363,7 +363,7 @@ class AnnotationMetadataTests { @@ -363,7 +363,7 @@ class AnnotationMetadataTests {
allMeta = metadata.getAllAnnotationAttributes(DirectAnnotation.class.getName()).get("additional");
assertThat(new HashSet<>(allMeta)).isEqualTo(new HashSet<Object>(Arrays.asList("direct", "")));
assertThat(metadata.getAnnotationAttributes(DirectAnnotation.class.getName()).get("additional")).isEqualTo("");
assertThat(((String[]) metadata.getAnnotationAttributes(DirectAnnotation.class.getName()).get("additionalArray"))).hasSize(0);
assertThat(((String[]) metadata.getAnnotationAttributes(DirectAnnotation.class.getName()).get("additionalArray"))).isEmpty();
}
{ // perform tests with classValuesAsString = true
AnnotationAttributes specialAttrs = (AnnotationAttributes) metadata.getAnnotationAttributes(

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

@ -647,7 +647,7 @@ class AntPathMatcherTests { @@ -647,7 +647,7 @@ class AntPathMatcherTests {
@Test
void preventCreatingStringMatchersIfPathDoesNotStartsWithPatternPrefix() {
pathMatcher.setCachePatterns(true);
assertThat(pathMatcher.stringMatcherCache).hasSize(0);
assertThat(pathMatcher.stringMatcherCache).isEmpty();
pathMatcher.match("test?", "test");
assertThat(pathMatcher.stringMatcherCache).hasSize(1);
@ -662,7 +662,7 @@ class AntPathMatcherTests { @@ -662,7 +662,7 @@ class AntPathMatcherTests {
@Test
void creatingStringMatchersIfPatternPrefixCannotDetermineIfPathMatch() {
pathMatcher.setCachePatterns(true);
assertThat(pathMatcher.stringMatcherCache).hasSize(0);
assertThat(pathMatcher.stringMatcherCache).isEmpty();
pathMatcher.match("test", "testian");
pathMatcher.match("test?", "testFf");

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

@ -126,7 +126,7 @@ class ConcurrentReferenceHashMapTests { @@ -126,7 +126,7 @@ class ConcurrentReferenceHashMapTests {
@Test
void shouldPutAndGet() {
// NOTE we are using mock references so we don't need to worry about GC
assertThat(this.map).hasSize(0);
assertThat(this.map).isEmpty();
this.map.put(123, "123");
assertThat(this.map.get(123)).isEqualTo("123");
assertThat(this.map).hasSize(1);
@ -327,7 +327,7 @@ class ConcurrentReferenceHashMapTests { @@ -327,7 +327,7 @@ class ConcurrentReferenceHashMapTests {
@Test
void shouldGetSize() {
assertThat(this.map).hasSize(0);
assertThat(this.map).isEmpty();
this.map.put(123, "123");
this.map.put(123, null);
this.map.put(456, "456");
@ -400,7 +400,7 @@ class ConcurrentReferenceHashMapTests { @@ -400,7 +400,7 @@ class ConcurrentReferenceHashMapTests {
this.map.put(456, null);
this.map.put(null, "789");
this.map.clear();
assertThat(this.map).hasSize(0);
assertThat(this.map).isEmpty();
assertThat(this.map.containsKey(123)).isFalse();
assertThat(this.map.containsKey(456)).isFalse();
assertThat(this.map.containsKey(null)).isFalse();

14
spring-core/src/test/java/org/springframework/util/LinkedCaseInsensitiveMapTests.java

@ -159,7 +159,7 @@ class LinkedCaseInsensitiveMapTests { @@ -159,7 +159,7 @@ class LinkedCaseInsensitiveMapTests {
void removeFromKeySetViaIterator() {
map.put("key", "value");
nextAndRemove(map.keySet().iterator());
assertThat(map).hasSize(0);
assertThat(map).isEmpty();
map.computeIfAbsent("key", k -> "newvalue");
assertThat(map.get("key")).isEqualTo("newvalue");
}
@ -168,7 +168,7 @@ class LinkedCaseInsensitiveMapTests { @@ -168,7 +168,7 @@ class LinkedCaseInsensitiveMapTests {
void clearFromValues() {
map.put("key", "value");
map.values().clear();
assertThat(map).hasSize(0);
assertThat(map).isEmpty();
map.computeIfAbsent("key", k -> "newvalue");
assertThat(map.get("key")).isEqualTo("newvalue");
}
@ -177,7 +177,7 @@ class LinkedCaseInsensitiveMapTests { @@ -177,7 +177,7 @@ class LinkedCaseInsensitiveMapTests {
void removeFromValues() {
map.put("key", "value");
map.values().remove("value");
assertThat(map).hasSize(0);
assertThat(map).isEmpty();
map.computeIfAbsent("key", k -> "newvalue");
assertThat(map.get("key")).isEqualTo("newvalue");
}
@ -186,7 +186,7 @@ class LinkedCaseInsensitiveMapTests { @@ -186,7 +186,7 @@ class LinkedCaseInsensitiveMapTests {
void removeFromValuesViaIterator() {
map.put("key", "value");
nextAndRemove(map.values().iterator());
assertThat(map).hasSize(0);
assertThat(map).isEmpty();
map.computeIfAbsent("key", k -> "newvalue");
assertThat(map.get("key")).isEqualTo("newvalue");
}
@ -195,7 +195,7 @@ class LinkedCaseInsensitiveMapTests { @@ -195,7 +195,7 @@ class LinkedCaseInsensitiveMapTests {
void clearFromEntrySet() {
map.put("key", "value");
map.entrySet().clear();
assertThat(map).hasSize(0);
assertThat(map).isEmpty();
map.computeIfAbsent("key", k -> "newvalue");
assertThat(map.get("key")).isEqualTo("newvalue");
}
@ -204,7 +204,7 @@ class LinkedCaseInsensitiveMapTests { @@ -204,7 +204,7 @@ class LinkedCaseInsensitiveMapTests {
void removeFromEntrySet() {
map.put("key", "value");
map.entrySet().remove(map.entrySet().iterator().next());
assertThat(map).hasSize(0);
assertThat(map).isEmpty();
map.computeIfAbsent("key", k -> "newvalue");
assertThat(map.get("key")).isEqualTo("newvalue");
}
@ -213,7 +213,7 @@ class LinkedCaseInsensitiveMapTests { @@ -213,7 +213,7 @@ class LinkedCaseInsensitiveMapTests {
void removeFromEntrySetViaIterator() {
map.put("key", "value");
nextAndRemove(map.entrySet().iterator());
assertThat(map).hasSize(0);
assertThat(map).isEmpty();
map.computeIfAbsent("key", k -> "newvalue");
assertThat(map.get("key")).isEqualTo("newvalue");
}

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

@ -151,14 +151,14 @@ class ObjectUtilsTests { @@ -151,14 +151,14 @@ class ObjectUtilsTests {
void toObjectArrayWithNull() {
Object[] objects = ObjectUtils.toObjectArray(null);
assertThat(objects).isNotNull();
assertThat(objects).hasSize(0);
assertThat(objects).isEmpty();
}
@Test
void toObjectArrayWithEmptyPrimitiveArray() {
Object[] objects = ObjectUtils.toObjectArray(new byte[] {});
assertThat(objects).isNotNull();
assertThat(objects).hasSize(0);
assertThat(objects).isEmpty();
}
@Test

4
spring-jdbc/src/test/java/org/springframework/jdbc/core/namedparam/NamedParameterUtilsTests.java

@ -249,7 +249,7 @@ public class NamedParameterUtilsTests { @@ -249,7 +249,7 @@ public class NamedParameterUtilsTests {
String expectedSql = "select foo from bar where baz = b:{}z";
String sql = "select foo from bar where baz = b:{}z";
ParsedSql parsedSql = NamedParameterUtils.parseSqlStatement(sql);
assertThat(parsedSql.getParameterNames()).hasSize(0);
assertThat(parsedSql.getParameterNames()).isEmpty();
String finalSql = NamedParameterUtils.substituteNamedParameters(parsedSql, null);
assertThat(finalSql).isEqualTo(expectedSql);
@ -257,7 +257,7 @@ public class NamedParameterUtilsTests { @@ -257,7 +257,7 @@ public class NamedParameterUtilsTests {
String sql2 = "select foo from bar where baz = 'b:{p1}z'";
ParsedSql parsedSql2 = NamedParameterUtils.parseSqlStatement(sql2);
assertThat(parsedSql2.getParameterNames()).hasSize(0);
assertThat(parsedSql2.getParameterNames()).isEmpty();
String finalSql2 = NamedParameterUtils.substituteNamedParameters(parsedSql2, null);
assertThat(finalSql2).isEqualTo(expectedSql2);
}

4
spring-jdbc/src/test/java/org/springframework/jdbc/object/BatchSqlUpdateTests.java

@ -81,7 +81,7 @@ public class BatchSqlUpdateTests { @@ -81,7 +81,7 @@ public class BatchSqlUpdateTests {
}
else {
assertThat(update.getQueueCount()).isEqualTo(2);
assertThat(update.getRowsAffected()).hasSize(0);
assertThat(update.getRowsAffected()).isEmpty();
}
int[] actualRowsAffected = update.flush();
@ -102,7 +102,7 @@ public class BatchSqlUpdateTests { @@ -102,7 +102,7 @@ public class BatchSqlUpdateTests {
assertThat(actualRowsAffected[1]).isEqualTo(rowsAffected[1]);
update.reset();
assertThat(update.getRowsAffected()).hasSize(0);
assertThat(update.getRowsAffected()).isEmpty();
verify(preparedStatement).setObject(1, ids[0], Types.INTEGER);
verify(preparedStatement).setObject(1, ids[1], Types.INTEGER);

6
spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLErrorCodesFactoryTests.java

@ -206,7 +206,7 @@ public class SQLErrorCodesFactoryTests { @@ -206,7 +206,7 @@ public class SQLErrorCodesFactoryTests {
// Should have failed to load without error
TestSQLErrorCodesFactory sf = new TestSQLErrorCodesFactory();
assertThat(sf.getErrorCodes("XX").getBadSqlGrammarCodes().length == 0).isTrue();
assertThat(sf.getErrorCodes("Oracle").getBadSqlGrammarCodes()).hasSize(0);
assertThat(sf.getErrorCodes("Oracle").getBadSqlGrammarCodes()).isEmpty();
}
/**
@ -371,8 +371,8 @@ public class SQLErrorCodesFactoryTests { @@ -371,8 +371,8 @@ public class SQLErrorCodesFactoryTests {
}
private void assertIsEmpty(SQLErrorCodes sec) {
assertThat(sec.getBadSqlGrammarCodes()).hasSize(0);
assertThat(sec.getDataIntegrityViolationCodes()).hasSize(0);
assertThat(sec.getBadSqlGrammarCodes()).isEmpty();
assertThat(sec.getDataIntegrityViolationCodes()).isEmpty();
}
}

2
spring-jms/src/test/java/org/springframework/jms/annotation/EnableJmsTests.java

@ -193,7 +193,7 @@ class EnableJmsTests extends AbstractJmsAnnotationDrivenTests { @@ -193,7 +193,7 @@ class EnableJmsTests extends AbstractJmsAnnotationDrivenTests {
EnableJmsDefaultContainerFactoryConfig.class, LazyBean.class);
JmsListenerContainerTestFactory defaultFactory =
context.getBean("jmsListenerContainerFactory", JmsListenerContainerTestFactory.class);
assertThat(defaultFactory.getListenerContainers()).hasSize(0);
assertThat(defaultFactory.getListenerContainers()).isEmpty();
context.getBean(LazyBean.class); // trigger lazy resolution
assertThat(defaultFactory.getListenerContainers()).hasSize(1);

10
spring-messaging/src/test/java/org/springframework/messaging/simp/broker/DefaultSubscriptionRegistryTests.java

@ -53,17 +53,17 @@ public class DefaultSubscriptionRegistryTests { @@ -53,17 +53,17 @@ public class DefaultSubscriptionRegistryTests {
this.registry.registerSubscription(subscribeMessage(null, subsId, dest));
MultiValueMap<String, String> actual = this.registry.findSubscriptions(createMessage(dest));
assertThat(actual).isNotNull();
assertThat(actual).hasSize(0);
assertThat(actual).isEmpty();
this.registry.registerSubscription(subscribeMessage(sessId, null, dest));
actual = this.registry.findSubscriptions(createMessage(dest));
assertThat(actual).isNotNull();
assertThat(actual).hasSize(0);
assertThat(actual).isEmpty();
this.registry.registerSubscription(subscribeMessage(sessId, subsId, null));
actual = this.registry.findSubscriptions(createMessage(dest));
assertThat(actual).isNotNull();
assertThat(actual).hasSize(0);
assertThat(actual).isEmpty();
}
@Test
@ -210,7 +210,7 @@ public class DefaultSubscriptionRegistryTests { @@ -210,7 +210,7 @@ public class DefaultSubscriptionRegistryTests {
actual = this.registry.findSubscriptions(destNasdaqIbmMessage);
assertThat(actual).isNotNull();
assertThat(actual).hasSize(0);
assertThat(actual).isEmpty();
}
@Test // SPR-11755
@ -296,7 +296,7 @@ public class DefaultSubscriptionRegistryTests { @@ -296,7 +296,7 @@ public class DefaultSubscriptionRegistryTests {
actual = this.registry.findSubscriptions(createMessage(destination));
assertThat(actual).isNotNull();
assertThat(actual).hasSize(0);
assertThat(actual).isEmpty();
}
@Test

8
spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/BufferingStompDecoderTests.java

@ -99,7 +99,7 @@ public class BufferingStompDecoderTests { @@ -99,7 +99,7 @@ public class BufferingStompDecoderTests {
String chunk2 = "\nPayload2a";
messages = stompDecoder.decode(toByteBuffer(chunk2));
assertThat(messages).hasSize(0);
assertThat(messages).isEmpty();
assertThat(stompDecoder.getBufferSize()).isEqualTo(33);
assertThat((int) stompDecoder.getExpectedContentLength()).isEqualTo(contentLength);
@ -127,7 +127,7 @@ public class BufferingStompDecoderTests { @@ -127,7 +127,7 @@ public class BufferingStompDecoderTests {
String chunk2 = "\nPayload2a";
messages = stompDecoder.decode(toByteBuffer(chunk2));
assertThat(messages).hasSize(0);
assertThat(messages).isEmpty();
assertThat(stompDecoder.getBufferSize()).isEqualTo(23);
assertThat(stompDecoder.getExpectedContentLength()).isNull();
@ -171,7 +171,7 @@ public class BufferingStompDecoderTests { @@ -171,7 +171,7 @@ public class BufferingStompDecoderTests {
String chunk = "MESSAG";
List<Message<byte[]>> messages = stompDecoder.decode(toByteBuffer(chunk));
assertThat(messages).hasSize(0);
assertThat(messages).isEmpty();
}
// SPR-13416
@ -182,7 +182,7 @@ public class BufferingStompDecoderTests { @@ -182,7 +182,7 @@ public class BufferingStompDecoderTests {
String chunk = "SEND\na:long\\";
List<Message<byte[]>> messages = stompDecoder.decode(toByteBuffer(chunk));
assertThat(messages).hasSize(0);
assertThat(messages).isEmpty();
}
@Test

14
spring-messaging/src/test/java/org/springframework/messaging/simp/stomp/StompDecoderTests.java

@ -45,8 +45,8 @@ public class StompDecoderTests { @@ -45,8 +45,8 @@ public class StompDecoderTests {
StompHeaderAccessor headers = StompHeaderAccessor.wrap(frame);
assertThat(headers.getCommand()).isEqualTo(StompCommand.DISCONNECT);
assertThat(headers.toNativeHeaderMap()).hasSize(0);
assertThat(frame.getPayload()).hasSize(0);
assertThat(headers.toNativeHeaderMap()).isEmpty();
assertThat(frame.getPayload()).isEmpty();
}
@Test
@ -55,8 +55,8 @@ public class StompDecoderTests { @@ -55,8 +55,8 @@ public class StompDecoderTests {
StompHeaderAccessor headers = StompHeaderAccessor.wrap(frame);
assertThat(headers.getCommand()).isEqualTo(StompCommand.DISCONNECT);
assertThat(headers.toNativeHeaderMap()).hasSize(0);
assertThat(frame.getPayload()).hasSize(0);
assertThat(headers.toNativeHeaderMap()).isEmpty();
assertThat(frame.getPayload()).isEmpty();
}
@Test
@ -73,7 +73,7 @@ public class StompDecoderTests { @@ -73,7 +73,7 @@ public class StompDecoderTests {
assertThat(headers.getFirstNativeHeader("accept-version")).isEqualTo("1.1");
assertThat(headers.getHost()).isEqualTo("github.org");
assertThat(frame.getPayload()).hasSize(0);
assertThat(frame.getPayload()).isEmpty();
}
@Test
@ -173,7 +173,7 @@ public class StompDecoderTests { @@ -173,7 +173,7 @@ public class StompDecoderTests {
assertThat(headers.getFirstNativeHeader("accept-version")).isEqualTo("1.1");
assertThat(headers.getFirstNativeHeader("key")).isEqualTo("\\value");
assertThat(frame.getPayload()).hasSize(0);
assertThat(frame.getPayload()).isEmpty();
}
@Test
@ -220,7 +220,7 @@ public class StompDecoderTests { @@ -220,7 +220,7 @@ public class StompDecoderTests {
assertThat(headers.getFirstNativeHeader("accept-version")).isEqualTo("1.1");
assertThat(headers.getFirstNativeHeader("key")).isEqualTo("");
assertThat(frame.getPayload()).hasSize(0);
assertThat(frame.getPayload()).isEmpty();
}
@Test

2
spring-messaging/src/test/java/org/springframework/messaging/support/ChannelInterceptorTests.java

@ -79,7 +79,7 @@ public class ChannelInterceptorTests { @@ -79,7 +79,7 @@ public class ChannelInterceptorTests {
assertThat(interceptor1.getCounter().get()).isEqualTo(1);
assertThat(interceptor2.getCounter().get()).isEqualTo(1);
assertThat(this.messageHandler.getMessages()).hasSize(0);
assertThat(this.messageHandler.getMessages()).isEmpty();
assertThat(interceptor1.wasAfterCompletionInvoked()).isTrue();
assertThat(interceptor2.wasAfterCompletionInvoked()).isFalse();
}

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

@ -44,7 +44,7 @@ public class MessageHeaderAccessorTests { @@ -44,7 +44,7 @@ public class MessageHeaderAccessorTests {
@Test
public void newEmptyHeaders() {
MessageHeaderAccessor accessor = new MessageHeaderAccessor();
assertThat(accessor.toMap()).hasSize(0);
assertThat(accessor.toMap()).isEmpty();
}
@Test

2
spring-messaging/src/test/java/org/springframework/messaging/support/NativeMessageHeaderAccessorTests.java

@ -79,7 +79,7 @@ public class NativeMessageHeaderAccessorTests { @@ -79,7 +79,7 @@ public class NativeMessageHeaderAccessorTests {
NativeMessageHeaderAccessor headerAccessor = new NativeMessageHeaderAccessor((Message<?>) null);
Map<String, Object> actual = headerAccessor.toMap();
assertThat(actual).hasSize(0);
assertThat(actual).isEmpty();
Map<String, List<String>> actualNativeHeaders = headerAccessor.toNativeHeaderMap();
assertThat(actualNativeHeaders).isEqualTo(Collections.emptyMap());

8
spring-orm/src/test/java/org/springframework/orm/jpa/AbstractContainerEntityManagerFactoryIntegrationTests.java

@ -186,7 +186,7 @@ public abstract class AbstractContainerEntityManagerFactoryIntegrationTests @@ -186,7 +186,7 @@ public abstract class AbstractContainerEntityManagerFactoryIntegrationTests
EntityManager em = entityManagerFactory.createEntityManager();
Query q = em.createQuery("select p from Person as p");
List<Person> people = q.getResultList();
assertThat(people).hasSize(0);
assertThat(people).isEmpty();
assertThatExceptionOfType(NoResultException.class).isThrownBy(q::getSingleResult);
}
@ -198,7 +198,7 @@ public abstract class AbstractContainerEntityManagerFactoryIntegrationTests @@ -198,7 +198,7 @@ public abstract class AbstractContainerEntityManagerFactoryIntegrationTests
EntityManager em = entityManagerFactory.createEntityManager();
Query q = em.createQuery("select p from Person as p");
List<Person> people = q.getResultList();
assertThat(people).hasSize(0);
assertThat(people).isEmpty();
assertThatExceptionOfType(NoResultException.class).isThrownBy(q::getSingleResult);
}
@ -208,7 +208,7 @@ public abstract class AbstractContainerEntityManagerFactoryIntegrationTests @@ -208,7 +208,7 @@ public abstract class AbstractContainerEntityManagerFactoryIntegrationTests
Query q = this.sharedEntityManager.createQuery("select p from Person as p");
q.setFlushMode(FlushModeType.AUTO);
List<Person> people = q.getResultList();
assertThat(people).hasSize(0);
assertThat(people).isEmpty();
assertThatExceptionOfType(NoResultException.class).isThrownBy(q::getSingleResult);
}
@ -221,7 +221,7 @@ public abstract class AbstractContainerEntityManagerFactoryIntegrationTests @@ -221,7 +221,7 @@ public abstract class AbstractContainerEntityManagerFactoryIntegrationTests
Query q = em.createQuery("select p from Person as p");
q.setFlushMode(FlushModeType.AUTO);
List<Person> people = q.getResultList();
assertThat(people).hasSize(0);
assertThat(people).isEmpty();
assertThatException()
.isThrownBy(q::getSingleResult)
.withMessageContaining("closed");

10
spring-orm/src/test/java/org/springframework/orm/jpa/persistenceunit/PersistenceXmlParsingTests.java

@ -95,7 +95,7 @@ public class PersistenceXmlParsingTests { @@ -95,7 +95,7 @@ public class PersistenceXmlParsingTests {
assertThat(info[0].getMappingFileNames()).hasSize(1);
assertThat(info[0].getMappingFileNames().get(0)).isEqualTo("mappings.xml");
assertThat(info[0].getProperties().keySet()).hasSize(0);
assertThat(info[0].getProperties().keySet()).isEmpty();
assertThat(info[0].excludeUnlistedClasses()).as("Exclude unlisted should default false in 1.0.").isFalse();
}
@ -115,7 +115,7 @@ public class PersistenceXmlParsingTests { @@ -115,7 +115,7 @@ public class PersistenceXmlParsingTests {
assertThat(info[0].getJarFileUrls().get(0)).isEqualTo(new ClassPathResource("order.jar").getURL());
assertThat(info[0].getJarFileUrls().get(1)).isEqualTo(new ClassPathResource("order-supplemental.jar").getURL());
assertThat(info[0].getProperties().keySet()).hasSize(0);
assertThat(info[0].getProperties().keySet()).isEmpty();
assertThat(info[0].getJtaDataSource()).isNull();
assertThat(info[0].getNonJtaDataSource()).isNull();
@ -148,7 +148,7 @@ public class PersistenceXmlParsingTests { @@ -148,7 +148,7 @@ public class PersistenceXmlParsingTests {
assertThat(info[0].excludeUnlistedClasses()).as("Exclude unlisted should be true when no value.").isTrue();
assertThat(info[0].getTransactionType()).isSameAs(PersistenceUnitTransactionType.RESOURCE_LOCAL);
assertThat(info[0].getProperties().keySet()).hasSize(0);
assertThat(info[0].getProperties().keySet()).isEmpty();
builder.clear();
}
@ -173,7 +173,7 @@ public class PersistenceXmlParsingTests { @@ -173,7 +173,7 @@ public class PersistenceXmlParsingTests {
assertThat(info[0].getJarFileUrls().get(1)).isEqualTo(new ClassPathResource("order-supplemental.jar").getURL());
assertThat(info[0].getPersistenceProviderClassName()).isEqualTo("com.acme.AcmePersistence");
assertThat(info[0].getProperties().keySet()).hasSize(0);
assertThat(info[0].getProperties().keySet()).isEmpty();
assertThat(info[0].excludeUnlistedClasses()).as("Exclude unlisted should default false in 1.0.").isFalse();
}
@ -249,7 +249,7 @@ public class PersistenceXmlParsingTests { @@ -249,7 +249,7 @@ public class PersistenceXmlParsingTests {
PersistenceUnitInfo[] info = reader.readPersistenceUnitInfos(resource);
assertThat(info).hasSize(1);
assertThat(info[0].getPersistenceUnitName()).isEqualTo("pu");
assertThat(info[0].getProperties().keySet()).hasSize(0);
assertThat(info[0].getProperties().keySet()).isEmpty();
assertThat(info[0].excludeUnlistedClasses()).as("Exclude unlisted should default false in 1.0.").isFalse();
}

2
spring-test/src/test/java/org/springframework/mock/web/MockHttpServletRequestTests.java

@ -273,7 +273,7 @@ class MockHttpServletRequestTests { @@ -273,7 +273,7 @@ class MockHttpServletRequestTests {
request.addParameters(params);
assertThat(request.getParameterMap()).hasSize(3);
request.removeAllParameters();
assertThat(request.getParameterMap()).hasSize(0);
assertThat(request.getParameterMap()).isEmpty();
}
@Test

4
spring-test/src/test/java/org/springframework/mock/web/MockServletContextTests.java

@ -180,7 +180,7 @@ class MockServletContextTests { @@ -180,7 +180,7 @@ class MockServletContextTests {
void getServletRegistrations() {
Map<String, ? extends ServletRegistration> servletRegistrations = servletContext.getServletRegistrations();
assertThat(servletRegistrations).isNotNull();
assertThat(servletRegistrations).hasSize(0);
assertThat(servletRegistrations).isEmpty();
}
/**
@ -198,7 +198,7 @@ class MockServletContextTests { @@ -198,7 +198,7 @@ class MockServletContextTests {
void getFilterRegistrations() {
Map<String, ? extends FilterRegistration> filterRegistrations = servletContext.getFilterRegistrations();
assertThat(filterRegistrations).isNotNull();
assertThat(filterRegistrations).hasSize(0);
assertThat(filterRegistrations).isEmpty();
}
}

2
spring-test/src/test/java/org/springframework/test/context/TestContextConcurrencyTests.java

@ -77,7 +77,7 @@ class TestContextConcurrencyTests { @@ -77,7 +77,7 @@ class TestContextConcurrencyTests {
});
assertThat(actualMethods).isEqualTo(expectedMethods);
});
assertThat(tcm.getTestContext().attributeNames()).hasSize(0);
assertThat(tcm.getTestContext().attributeNames()).isEmpty();
}

2
spring-test/src/test/java/org/springframework/test/context/support/AnnotationConfigContextLoaderUtilsTests.java

@ -47,7 +47,7 @@ class AnnotationConfigContextLoaderUtilsTests { @@ -47,7 +47,7 @@ class AnnotationConfigContextLoaderUtilsTests {
void detectDefaultConfigurationClassesWithoutConfigurationClass() {
Class<?>[] configClasses = detectDefaultConfigurationClasses(NoConfigTestCase.class);
assertThat(configClasses).isNotNull();
assertThat(configClasses).hasSize(0);
assertThat(configClasses).isEmpty();
}
@Test

8
spring-test/src/test/java/org/springframework/test/context/support/ContextLoaderUtilsContextHierarchyTests.java

@ -340,8 +340,8 @@ class ContextLoaderUtilsContextHierarchyTests extends AbstractContextConfigurati @@ -340,8 +340,8 @@ class ContextLoaderUtilsContextHierarchyTests extends AbstractContextConfigurati
assertThat(alphaConfig).hasSize(2);
assertThat(alphaConfig.get(0).getLocations()).hasSize(1);
assertThat(alphaConfig.get(0).getLocations()[0]).isEqualTo("1-A.xml");
assertThat(alphaConfig.get(0).getInitializers()).hasSize(0);
assertThat(alphaConfig.get(1).getLocations()).hasSize(0);
assertThat(alphaConfig.get(0).getInitializers()).isEmpty();
assertThat(alphaConfig.get(1).getLocations()).isEmpty();
assertThat(alphaConfig.get(1).getInitializers()).hasSize(1);
assertThat(alphaConfig.get(1).getInitializers()[0]).isEqualTo(DummyApplicationContextInitializer.class);
@ -349,8 +349,8 @@ class ContextLoaderUtilsContextHierarchyTests extends AbstractContextConfigurati @@ -349,8 +349,8 @@ class ContextLoaderUtilsContextHierarchyTests extends AbstractContextConfigurati
assertThat(betaConfig).hasSize(2);
assertThat(betaConfig.get(0).getLocations()).hasSize(1);
assertThat(betaConfig.get(0).getLocations()[0]).isEqualTo("1-B.xml");
assertThat(betaConfig.get(0).getInitializers()).hasSize(0);
assertThat(betaConfig.get(1).getLocations()).hasSize(0);
assertThat(betaConfig.get(0).getInitializers()).isEmpty();
assertThat(betaConfig.get(1).getLocations()).isEmpty();
assertThat(betaConfig.get(1).getInitializers()).hasSize(1);
assertThat(betaConfig.get(1).getInitializers()[0]).isEqualTo(DummyApplicationContextInitializer.class);
}

6
spring-test/src/test/java/org/springframework/test/context/support/TestPropertySourceUtilsTests.java

@ -215,7 +215,7 @@ class TestPropertySourceUtilsTests { @@ -215,7 +215,7 @@ class TestPropertySourceUtilsTests {
MutablePropertySources propertySources = environment.getPropertySources();
propertySources.remove(MockPropertySource.MOCK_PROPERTIES_PROPERTY_SOURCE_NAME);
assertThat(propertySources).hasSize(0);
assertThat(propertySources).isEmpty();
String pair = "key = value";
ByteArrayResource resource = new ByteArrayResource(pair.getBytes(), "from inlined property: " + pair);
@ -275,10 +275,10 @@ class TestPropertySourceUtilsTests { @@ -275,10 +275,10 @@ class TestPropertySourceUtilsTests {
ConfigurableEnvironment environment = new MockEnvironment();
MutablePropertySources propertySources = environment.getPropertySources();
propertySources.remove(MockPropertySource.MOCK_PROPERTIES_PROPERTY_SOURCE_NAME);
assertThat(propertySources).hasSize(0);
assertThat(propertySources).isEmpty();
addInlinedPropertiesToEnvironment(environment, asArray(" "));
assertThat(propertySources).hasSize(1);
assertThat(((Map<?, ?>) propertySources.iterator().next().getSource())).hasSize(0);
assertThat(((Map<?, ?>) propertySources.iterator().next().getSource())).isEmpty();
}
@Test

32
spring-test/src/test/java/org/springframework/test/web/client/response/ResponseCreatorsTests.java

@ -46,7 +46,7 @@ class ResponseCreatorsTests { @@ -46,7 +46,7 @@ class ResponseCreatorsTests {
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
assertThat(response.getHeaders().isEmpty()).isTrue();
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
}
@Test
@ -77,7 +77,7 @@ class ResponseCreatorsTests { @@ -77,7 +77,7 @@ class ResponseCreatorsTests {
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.CREATED);
assertThat(response.getHeaders().getLocation()).isEqualTo(location);
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
}
@Test
@ -86,7 +86,7 @@ class ResponseCreatorsTests { @@ -86,7 +86,7 @@ class ResponseCreatorsTests {
MockClientHttpResponse response = (MockClientHttpResponse) responseCreator.createResponse(null);
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.ACCEPTED);
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
}
@Test
@ -96,7 +96,7 @@ class ResponseCreatorsTests { @@ -96,7 +96,7 @@ class ResponseCreatorsTests {
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT);
assertThat(response.getHeaders().isEmpty()).isTrue();
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
}
@Test
@ -106,7 +106,7 @@ class ResponseCreatorsTests { @@ -106,7 +106,7 @@ class ResponseCreatorsTests {
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.BAD_REQUEST);
assertThat(response.getHeaders().isEmpty()).isTrue();
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
}
@Test
@ -116,7 +116,7 @@ class ResponseCreatorsTests { @@ -116,7 +116,7 @@ class ResponseCreatorsTests {
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.UNAUTHORIZED);
assertThat(response.getHeaders().isEmpty()).isTrue();
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
}
@Test
@ -125,7 +125,7 @@ class ResponseCreatorsTests { @@ -125,7 +125,7 @@ class ResponseCreatorsTests {
MockClientHttpResponse response = (MockClientHttpResponse) responseCreator.createResponse(null);
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.FORBIDDEN);
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
}
@Test
@ -134,7 +134,7 @@ class ResponseCreatorsTests { @@ -134,7 +134,7 @@ class ResponseCreatorsTests {
MockClientHttpResponse response = (MockClientHttpResponse) responseCreator.createResponse(null);
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
}
@Test
@ -143,7 +143,7 @@ class ResponseCreatorsTests { @@ -143,7 +143,7 @@ class ResponseCreatorsTests {
MockClientHttpResponse response = (MockClientHttpResponse) responseCreator.createResponse(null);
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.CONFLICT);
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
}
@Test
@ -153,7 +153,7 @@ class ResponseCreatorsTests { @@ -153,7 +153,7 @@ class ResponseCreatorsTests {
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.TOO_MANY_REQUESTS);
assertThat(response.getHeaders()).doesNotContainKey(HttpHeaders.RETRY_AFTER);
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
}
@Test
@ -163,7 +163,7 @@ class ResponseCreatorsTests { @@ -163,7 +163,7 @@ class ResponseCreatorsTests {
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.TOO_MANY_REQUESTS);
assertThat(response.getHeaders().getFirst(HttpHeaders.RETRY_AFTER)).isEqualTo("512");
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
}
@Test
@ -173,7 +173,7 @@ class ResponseCreatorsTests { @@ -173,7 +173,7 @@ class ResponseCreatorsTests {
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR);
assertThat(response.getHeaders().isEmpty()).isTrue();
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
}
@Test
@ -182,7 +182,7 @@ class ResponseCreatorsTests { @@ -182,7 +182,7 @@ class ResponseCreatorsTests {
MockClientHttpResponse response = (MockClientHttpResponse) responseCreator.createResponse(null);
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.BAD_GATEWAY);
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
}
@Test
@ -191,7 +191,7 @@ class ResponseCreatorsTests { @@ -191,7 +191,7 @@ class ResponseCreatorsTests {
MockClientHttpResponse response = (MockClientHttpResponse) responseCreator.createResponse(null);
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.SERVICE_UNAVAILABLE);
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
}
@Test
@ -200,7 +200,7 @@ class ResponseCreatorsTests { @@ -200,7 +200,7 @@ class ResponseCreatorsTests {
MockClientHttpResponse response = (MockClientHttpResponse) responseCreator.createResponse(null);
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.GATEWAY_TIMEOUT);
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
}
@Test
@ -210,7 +210,7 @@ class ResponseCreatorsTests { @@ -210,7 +210,7 @@ class ResponseCreatorsTests {
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.FORBIDDEN);
assertThat(response.getHeaders().isEmpty()).isTrue();
assertThat(StreamUtils.copyToByteArray(response.getBody())).hasSize(0);
assertThat(StreamUtils.copyToByteArray(response.getBody())).isEmpty();
}
@Test

4
spring-web/src/test/java/org/springframework/http/HttpHeadersTests.java

@ -619,9 +619,9 @@ public class HttpHeadersTests { @@ -619,9 +619,9 @@ public class HttpHeadersTests {
// clear()
keySet.clear();
assertThat(keySet.isEmpty()).isTrue();
assertThat(keySet).hasSize(0);
assertThat(keySet).isEmpty();
assertThat(headers.isEmpty()).isTrue();
assertThat(headers).hasSize(0);
assertThat(headers).isEmpty();
// Unsupported operations
assertThatExceptionOfType(UnsupportedOperationException.class)

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

@ -155,7 +155,7 @@ public class ServletServerHttpRequestTests { @@ -155,7 +155,7 @@ public class ServletServerHttpRequestTests {
void getHeadersWithWildcardContentType() {
mockRequest.setContentType("*/*");
mockRequest.removeHeader("Content-Type");
assertThat(request.getHeaders()).as("Invalid content-type should not raise exception").hasSize(0);
assertThat(request.getHeaders()).as("Invalid content-type should not raise exception").isEmpty();
}
@Test

2
spring-web/src/test/java/org/springframework/http/server/reactive/ChannelSendOperatorTests.java

@ -66,7 +66,7 @@ class ChannelSendOperatorTests { @@ -66,7 +66,7 @@ class ChannelSendOperatorTests {
assertThat(signal).isNotNull();
assertThat(signal.isOnComplete()).as("Unexpected signal: " + signal).isTrue();
assertThat(this.writer.items).hasSize(0);
assertThat(this.writer.items).isEmpty();
assertThat(this.writer.completed).isTrue();
}

2
spring-web/src/test/java/org/springframework/http/server/reactive/HeadersAdaptersTests.java

@ -110,7 +110,7 @@ class HeadersAdaptersTests { @@ -110,7 +110,7 @@ class HeadersAdaptersTests {
headers.add("TestHeader", "first");
assertThat(headers.keySet()).hasSize(1);
headers.keySet().removeIf("TestHeader"::equals);
assertThat(headers.keySet()).hasSize(0);
assertThat(headers.keySet()).isEmpty();
}
@ParameterizedHeadersTest

2
spring-web/src/test/java/org/springframework/http/server/reactive/ServerHttpRequestTests.java

@ -53,7 +53,7 @@ public class ServerHttpRequestTests { @@ -53,7 +53,7 @@ public class ServerHttpRequestTests {
@Test
public void queryParamsNone() throws Exception {
MultiValueMap<String, String> params = createRequest("/path").getQueryParams();
assertThat(params).hasSize(0);
assertThat(params).isEmpty();
}
@Test

2
spring-web/src/test/java/org/springframework/web/util/WebUtilsTests.java

@ -63,7 +63,7 @@ public class WebUtilsTests { @@ -63,7 +63,7 @@ public class WebUtilsTests {
MultiValueMap<String, String> variables;
variables = WebUtils.parseMatrixVariables(null);
assertThat(variables).hasSize(0);
assertThat(variables).isEmpty();
variables = WebUtils.parseMatrixVariables("year");
assertThat(variables).hasSize(1);

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

@ -577,7 +577,7 @@ public class PathPatternTests { @@ -577,7 +577,7 @@ public class PathPatternTests {
pri = getPathRemaining(pp, "/aaa/bbb");
assertThat(pri.getPathRemaining().value()).isEqualTo("");
assertThat(pri.getPathMatched().value()).isEqualTo("/aaa/bbb");
assertThat(pri.getUriVariables()).hasSize(0);
assertThat(pri.getUriVariables()).isEmpty();
pp = parse("/*/{foo}/b*");
pri = getPathRemaining(pp, "/foo");
@ -807,7 +807,7 @@ public class PathPatternTests { @@ -807,7 +807,7 @@ public class PathPatternTests {
assertThat((Object) checkCapture("/{one}/", "//")).isNull();
assertThat((Object) checkCapture("", "/abc")).isNull();
assertThat(checkCapture("", "").getUriVariables()).hasSize(0);
assertThat(checkCapture("", "").getUriVariables()).isEmpty();
checkCapture("{id}", "99", "id", "99");
checkCapture("/customer/{customerId}", "/customer/78", "customerId", "78");
checkCapture("/customer/{customerId}/banana", "/customer/42/banana", "customerId",
@ -817,7 +817,7 @@ public class PathPatternTests { @@ -817,7 +817,7 @@ public class PathPatternTests {
"apple");
checkCapture("/{bla}.*", "/testing.html", "bla", "testing");
PathPattern.PathMatchInfo extracted = checkCapture("/abc", "/abc");
assertThat(extracted.getUriVariables()).hasSize(0);
assertThat(extracted.getUriVariables()).isEmpty();
checkCapture("/{bla}/foo","/a/foo");
}

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

@ -161,7 +161,7 @@ class ResourceHandlerRegistryTests { @@ -161,7 +161,7 @@ class ResourceHandlerRegistryTests {
assertThat(resolvers.get(1)).isInstanceOf(PathResourceResolver.class);
List<ResourceTransformer> transformers = handler.getResourceTransformers();
assertThat(transformers).hasSize(0);
assertThat(transformers).isEmpty();
}
@Test

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

@ -71,7 +71,7 @@ public class ViewResolverRegistryTests { @@ -71,7 +71,7 @@ public class ViewResolverRegistryTests {
@Test
public void noResolvers() {
assertThat(this.registry.getViewResolvers()).isNotNull();
assertThat(this.registry.getViewResolvers()).hasSize(0);
assertThat(this.registry.getViewResolvers()).isEmpty();
assertThat(this.registry.hasRegistrations()).isFalse();
}

2
spring-webflux/src/test/java/org/springframework/web/reactive/result/condition/RequestMappingInfoTests.java

@ -56,7 +56,7 @@ public class RequestMappingInfoTests { @@ -56,7 +56,7 @@ public class RequestMappingInfoTests {
PathPattern emptyPattern = (new PathPatternParser()).parse("");
assertThat(info.getPatternsCondition().getPatterns()).isEqualTo(Collections.singleton(emptyPattern));
assertThat(info.getMethodsCondition().getMethods()).hasSize(0);
assertThat(info.getMethodsCondition().getMethods()).isEmpty();
assertThat(info.getConsumesCondition().isEmpty()).isTrue();
assertThat(info.getProducesCondition().isEmpty()).isTrue();
assertThat(info.getParamsCondition()).isNotNull();

4
spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ModelInitializerTests.java

@ -141,7 +141,7 @@ public class ModelInitializerTests { @@ -141,7 +141,7 @@ public class ModelInitializerTests {
WebSession session = this.exchange.getSession().block(Duration.ZERO);
assertThat(session).isNotNull();
assertThat(session.getAttributes()).hasSize(0);
assertThat(session.getAttributes()).isEmpty();
context.saveModel();
assertThat(session.getAttributes()).hasSize(1);
@ -198,7 +198,7 @@ public class ModelInitializerTests { @@ -198,7 +198,7 @@ public class ModelInitializerTests {
context.getSessionStatus().setComplete();
context.saveModel();
assertThat(session.getAttributes()).hasSize(0);
assertThat(session.getAttributes()).isEmpty();
}

2
spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ResponseEntityResultHandlerTests.java

@ -173,7 +173,7 @@ public class ResponseEntityResultHandlerTests { @@ -173,7 +173,7 @@ public class ResponseEntityResultHandlerTests {
this.resultHandler.handleResult(exchange, result).block(Duration.ofSeconds(5));
assertThat(exchange.getResponse().getStatusCode()).isEqualTo(HttpStatus.NO_CONTENT);
assertThat(exchange.getResponse().getHeaders()).hasSize(0);
assertThat(exchange.getResponse().getHeaders()).isEmpty();
assertResponseBodyIsEmpty(exchange);
}

2
spring-webflux/src/test/java/org/springframework/web/reactive/result/view/DefaultRenderingBuilderTests.java

@ -40,7 +40,7 @@ public class DefaultRenderingBuilderTests { @@ -40,7 +40,7 @@ public class DefaultRenderingBuilderTests {
assertThat(rendering.view()).isEqualTo("abc");
assertThat(rendering.modelAttributes()).isEqualTo(Collections.emptyMap());
assertThat(rendering.status()).isNull();
assertThat(rendering.headers()).hasSize(0);
assertThat(rendering.headers()).isEmpty();
}
@Test

4
spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfigurationTests.java

@ -112,8 +112,8 @@ public class DelegatingWebMvcConfigurationTests { @@ -112,8 +112,8 @@ public class DelegatingWebMvcConfigurationTests {
assertThat(initializer.getConversionService()).isSameAs(conversionService.getValue());
boolean condition = initializer.getValidator() instanceof LocalValidatorFactoryBean;
assertThat(condition).isTrue();
assertThat(resolvers.getValue()).hasSize(0);
assertThat(handlers.getValue()).hasSize(0);
assertThat(resolvers.getValue()).isEmpty();
assertThat(handlers.getValue()).isEmpty();
assertThat(adapter.getMessageConverters()).isEqualTo(converters.getValue());
assertThat(asyncConfigurer).isNotNull();
}

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

@ -86,7 +86,7 @@ public class ViewResolverRegistryTests { @@ -86,7 +86,7 @@ public class ViewResolverRegistryTests {
@Test
public void noResolvers() {
assertThat(this.registry.getViewResolvers()).isNotNull();
assertThat(this.registry.getViewResolvers()).hasSize(0);
assertThat(this.registry.getViewResolvers()).isEmpty();
assertThat(this.registry.hasRegistrations()).isFalse();
}

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

@ -296,7 +296,7 @@ public class WebMvcConfigurationSupportTests { @@ -296,7 +296,7 @@ public class WebMvcConfigurationSupportTests {
ViewResolverComposite resolver = context.getBean("mvcViewResolver", ViewResolverComposite.class);
assertThat(resolver).isNotNull();
assertThat(resolver.getViewResolvers()).hasSize(0);
assertThat(resolver.getViewResolvers()).isEmpty();
assertThat(resolver.getOrder()).isEqualTo(Ordered.LOWEST_PRECEDENCE);
assertThat(resolver.resolveViewName("anyViewName", Locale.ENGLISH)).isNull();
}

4
spring-webmvc/src/test/java/org/springframework/web/servlet/function/ResourceHandlerFunctionTests.java

@ -162,7 +162,7 @@ public class ResourceHandlerFunctionTests { @@ -162,7 +162,7 @@ public class ResourceHandlerFunctionTests {
assertThat(servletResponse.getStatus()).isEqualTo(200);
byte[] actualBytes = servletResponse.getContentAsByteArray();
assertThat(actualBytes).hasSize(0);
assertThat(actualBytes).isEmpty();
assertThat(servletResponse.getContentType()).isEqualTo(MediaType.TEXT_PLAIN_VALUE);
assertThat(servletResponse.getContentLength()).isEqualTo(this.resource.contentLength());
}
@ -185,7 +185,7 @@ public class ResourceHandlerFunctionTests { @@ -185,7 +185,7 @@ public class ResourceHandlerFunctionTests {
String[] methods = StringUtils.tokenizeToStringArray(allowHeader, ",");
assertThat(methods).containsExactlyInAnyOrder("GET","HEAD","OPTIONS");
byte[] actualBytes = servletResponse.getContentAsByteArray();
assertThat(actualBytes).hasSize(0);
assertThat(actualBytes).isEmpty();
}
}

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

@ -165,7 +165,7 @@ public class HandlerMethodMappingTests { @@ -165,7 +165,7 @@ public class HandlerMethodMappingTests {
mapping1.setApplicationContext(new StaticApplicationContext(cxt));
mapping1.afterPropertiesSet();
assertThat(mapping1.getHandlerMethods()).hasSize(0);
assertThat(mapping1.getHandlerMethods()).isEmpty();
AbstractHandlerMethodMapping<String> mapping2 = new MyHandlerMethodMapping();
mapping2.setDetectHandlerMethodsInAncestorContexts(true);

2
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoTests.java

@ -59,7 +59,7 @@ class RequestMappingInfoTests { @@ -59,7 +59,7 @@ class RequestMappingInfoTests {
// gh-22543
RequestMappingInfo info = infoBuilder.build();
assertThat(info.getPatternValues()).isEqualTo(Collections.singleton(""));
assertThat(info.getMethodsCondition().getMethods()).hasSize(0);
assertThat(info.getMethodsCondition().getMethods()).isEmpty();
assertThat(info.getParamsCondition()).isNotNull();
assertThat(info.getHeadersCondition()).isNotNull();
assertThat(info.getConsumesCondition().isEmpty()).isTrue();

2
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/HttpEntityMethodProcessorMockTests.java

@ -832,7 +832,7 @@ public class HttpEntityMethodProcessorMockTests { @@ -832,7 +832,7 @@ public class HttpEntityMethodProcessorMockTests {
assertResponseBody(body);
}
else {
assertThat(servletResponse.getContentAsByteArray()).hasSize(0);
assertThat(servletResponse.getContentAsByteArray()).isEmpty();
}
if (etag != null) {
assertThat(servletResponse.getHeaderValues(HttpHeaders.ETAG)).hasSize(1);

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

@ -179,7 +179,7 @@ public class AnnotationConfigDispatcherServletInitializerTests { @@ -179,7 +179,7 @@ public class AnnotationConfigDispatcherServletInitializerTests {
initializer.onStartup(servletContext);
assertThat(filterRegistrations).hasSize(0);
assertThat(filterRegistrations).isEmpty();
}

4
spring-webmvc/src/test/java/org/springframework/web/servlet/tags/UrlTagTests.java

@ -351,7 +351,7 @@ public class UrlTagTests extends AbstractTagTests { @@ -351,7 +351,7 @@ public class UrlTagTests extends AbstractTagTests {
String uri = tag.replaceUriTemplateParams("url/path", params, usedParams);
assertThat(uri).isEqualTo("url/path");
assertThat(usedParams).hasSize(0);
assertThat(usedParams).isEmpty();
}
@Test
@ -361,7 +361,7 @@ public class UrlTagTests extends AbstractTagTests { @@ -361,7 +361,7 @@ public class UrlTagTests extends AbstractTagTests {
String uri = tag.replaceUriTemplateParams("url/{path}", params, usedParams);
assertThat(uri).isEqualTo("url/{path}");
assertThat(usedParams).hasSize(0);
assertThat(usedParams).isEmpty();
}
@Test

6
spring-webmvc/src/test/java/org/springframework/web/servlet/view/BaseViewTests.java

@ -191,7 +191,7 @@ public class BaseViewTests { @@ -191,7 +191,7 @@ public class BaseViewTests {
public void ignoresNullAttributes() {
AbstractView v = new ConcreteView();
v.setAttributes(null);
assertThat(v.getStaticAttributes()).hasSize(0);
assertThat(v.getStaticAttributes()).isEmpty();
}
/**
@ -201,14 +201,14 @@ public class BaseViewTests { @@ -201,14 +201,14 @@ public class BaseViewTests {
public void attributeCSVParsingIgnoresNull() {
AbstractView v = new ConcreteView();
v.setAttributesCSV(null);
assertThat(v.getStaticAttributes()).hasSize(0);
assertThat(v.getStaticAttributes()).isEmpty();
}
@Test
public void attributeCSVParsingIgnoresEmptyString() {
AbstractView v = new ConcreteView();
v.setAttributesCSV("");
assertThat(v.getStaticAttributes()).hasSize(0);
assertThat(v.getStaticAttributes()).isEmpty();
}
/**

2
spring-websocket/src/test/java/org/springframework/web/socket/config/annotation/WebMvcStompEndpointRegistryTests.java

@ -72,7 +72,7 @@ public class WebMvcStompEndpointRegistryTests { @@ -72,7 +72,7 @@ public class WebMvcStompEndpointRegistryTests {
@Test
public void handlerMapping() {
SimpleUrlHandlerMapping hm = (SimpleUrlHandlerMapping) this.endpointRegistry.getHandlerMapping();
assertThat(hm.getUrlMap()).hasSize(0);
assertThat(hm.getUrlMap()).isEmpty();
UrlPathHelper pathHelper = new UrlPathHelper();
this.endpointRegistry.setUrlPathHelper(pathHelper);

2
spring-websocket/src/test/java/org/springframework/web/socket/messaging/StompSubProtocolHandlerTests.java

@ -332,7 +332,7 @@ public class StompSubProtocolHandlerTests { @@ -332,7 +332,7 @@ public class StompSubProtocolHandlerTests {
assertThat(stompAccessor.getPasscode()).isEqualTo("guest");
assertThat(stompAccessor.getHeartbeat()).isEqualTo(new long[] {10000, 10000});
assertThat(stompAccessor.getAcceptVersion()).isEqualTo(new HashSet<>(Arrays.asList("1.1","1.0")));
assertThat(this.session.getSentMessages()).hasSize(0);
assertThat(this.session.getSentMessages()).isEmpty();
}
@Test

Loading…
Cancel
Save