Use AssertJ's isEmpty() instead of hasSize(0)
Achieved via global search-and-replace.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user