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

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