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

Achieved via global search-and-replace.
This commit is contained in:
Sam Brannen 2022-11-22 17:11:50 +01:00
parent d5b0b2b1a1
commit 7fcd1de8e3
79 changed files with 260 additions and 295 deletions

View File

@ -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();
}
}

View File

@ -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 @@
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 {
@Override
protected AbstractRegexpMethodPointcut getRegexpMethodPointcut() {
return new JdkRegexpMethodPointcut();
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();
}
@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();
}
}

View File

@ -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

View File

@ -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 {
public void testHierarchicalNamesForAnnotationWithNoMatch() {
List<String> names = Arrays.asList(
BeanFactoryUtils.beanNamesForAnnotationIncludingAncestors(this.listableBeanFactory, Override.class));
assertThat(names).hasSize(0);
assertThat(names).isEmpty();
}
@Test

View File

@ -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

View File

@ -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

View File

@ -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 {
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

View File

@ -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 {
beanRegistry.destroySingletons();
assertThat(beanRegistry.getSingletonCount()).isEqualTo(0);
assertThat(beanRegistry.getSingletonNames()).hasSize(0);
assertThat(beanRegistry.getSingletonNames()).isEmpty();
assertThat(tb.wasDestroyed()).isTrue();
}

View File

@ -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"));

View File

@ -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

View File

@ -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 {
@Test
void embeddedNonStaticCandidateAreIgnored() {
CandidateComponentsMetadata metadata = compile(SampleNonStaticEmbedded.class);
assertThat(metadata.getItems()).hasSize(0);
assertThat(metadata.getItems()).isEmpty();
}
private void testComponent(Class<?>... classes) {

View File

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

View File

@ -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

View File

@ -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 {
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

View File

@ -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 {
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 {
void withNoFilters() {
ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false);
Set<BeanDefinition> candidates = provider.findCandidateComponents(TEST_BASE_PACKAGE);
assertThat(candidates).hasSize(0);
assertThat(candidates).isEmpty();
}
@Test

View File

@ -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 {
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();
}

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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 {
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 {
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

View File

@ -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

View File

@ -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

View File

@ -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.")

View File

@ -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

View File

@ -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

View File

@ -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 {
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 {
void getMultipleComposedAnnotationsOnBridgeMethod() throws Exception {
Set<Cacheable> cacheables = getAllMergedAnnotations(getBridgeMethod(), Cacheable.class);
assertThat(cacheables).isNotNull();
assertThat(cacheables).hasSize(0);
assertThat(cacheables).isEmpty();
}
@Test

View File

@ -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 {
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 {
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 {
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 {
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 {
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 {
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 {
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 {
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 {
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();

View File

@ -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

View File

@ -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);

View File

@ -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 {
@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 {
@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 {
@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");

View File

@ -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 {
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 {
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 {
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(

View File

@ -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 {
@Test
void creatingStringMatchersIfPatternPrefixCannotDetermineIfPathMatch() {
pathMatcher.setCachePatterns(true);
assertThat(pathMatcher.stringMatcherCache).hasSize(0);
assertThat(pathMatcher.stringMatcherCache).isEmpty();
pathMatcher.match("test", "testian");
pathMatcher.match("test?", "testFf");

View File

@ -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 {
@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 {
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();

View File

@ -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 {
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 {
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 {
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 {
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 {
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 {
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");
}

View File

@ -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

View File

@ -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 {
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);
}

View File

@ -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 {
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);

View File

@ -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 {
}
private void assertIsEmpty(SQLErrorCodes sec) {
assertThat(sec.getBadSqlGrammarCodes()).hasSize(0);
assertThat(sec.getDataIntegrityViolationCodes()).hasSize(0);
assertThat(sec.getBadSqlGrammarCodes()).isEmpty();
assertThat(sec.getDataIntegrityViolationCodes()).isEmpty();
}
}

View File

@ -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);

View File

@ -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 {
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 {
actual = this.registry.findSubscriptions(createMessage(destination));
assertThat(actual).isNotNull();
assertThat(actual).hasSize(0);
assertThat(actual).isEmpty();
}
@Test

View File

@ -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 {
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 {
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 {
String chunk = "SEND\na:long\\";
List<Message<byte[]>> messages = stompDecoder.decode(toByteBuffer(chunk));
assertThat(messages).hasSize(0);
assertThat(messages).isEmpty();
}
@Test

View File

@ -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 {
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 {
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 {
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 {
assertThat(headers.getFirstNativeHeader("accept-version")).isEqualTo("1.1");
assertThat(headers.getFirstNativeHeader("key")).isEqualTo("");
assertThat(frame.getPayload()).hasSize(0);
assertThat(frame.getPayload()).isEmpty();
}
@Test

View File

@ -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();
}

View File

@ -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

View File

@ -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());

View File

@ -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
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
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
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");

View File

@ -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 {
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 {
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 {
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 {
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();
}

View File

@ -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

View File

@ -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 {
void getFilterRegistrations() {
Map<String, ? extends FilterRegistration> filterRegistrations = servletContext.getFilterRegistrations();
assertThat(filterRegistrations).isNotNull();
assertThat(filterRegistrations).hasSize(0);
assertThat(filterRegistrations).isEmpty();
}
}

View File

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

View File

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

View File

@ -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
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);
}

View File

@ -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 {
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

View File

@ -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 {
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 {
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 {
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 {
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 {
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 {
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 {
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 {
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 {
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 {
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 {
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 {
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 {
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 {
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 {
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

View File

@ -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)

View File

@ -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

View File

@ -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();
}

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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 {
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 {
"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");
}

View File

@ -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

View File

@ -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();
}

View File

@ -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();

View File

@ -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 {
context.getSessionStatus().setComplete();
context.saveModel();
assertThat(session.getAttributes()).hasSize(0);
assertThat(session.getAttributes()).isEmpty();
}

View File

@ -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);
}

View File

@ -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

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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 {
String[] methods = StringUtils.tokenizeToStringArray(allowHeader, ",");
assertThat(methods).containsExactlyInAnyOrder("GET","HEAD","OPTIONS");
byte[] actualBytes = servletResponse.getContentAsByteArray();
assertThat(actualBytes).hasSize(0);
assertThat(actualBytes).isEmpty();
}
}

View File

@ -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);

View File

@ -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();

View File

@ -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);

View File

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

View File

@ -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 {
String uri = tag.replaceUriTemplateParams("url/{path}", params, usedParams);
assertThat(uri).isEqualTo("url/{path}");
assertThat(usedParams).hasSize(0);
assertThat(usedParams).isEmpty();
}
@Test

View File

@ -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 {
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();
}
/**

View File

@ -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);

View File

@ -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